using System.IO; using UnityEngine; using UnityEngine.Events; public class NetManager : BaseManager { private NetManager() { } /// /// 网络访问的token /// public string token; public string url; /// /// 获取本地配置文件 /// /// public void GetConfig(UnityAction action) { string path = Application.streamingAssetsPath + "/Config/Config.txt"; Debug.Log(path); if (File.Exists(path)) { Debug.Log(File.ReadAllText(path)); url = File.ReadAllText(path); action?.Invoke(true); } else { Debug.Log("没有对应的文件"); action?.Invoke(false); //UIManager.Instance.ShowPanel(E_UI_Layer.System, (panel) => //{ // panel.Init("没有读取到正确的Ip地址文件,请检查项目StreamingAssets文件夹下Config文件是否正常配置地址端口后再试!", E_MessageType.Error, Const.E_QuitApp); //}); } } /// /// /// /// public void SaveInfo(string info) { string path = Application.streamingAssetsPath + "/Config/info.txt"; Debug.Log(path); File.WriteAllText(path, info); } }