| | |
| | | GameObject debugRoot; |
| | | |
| | | bool m_DebugAccount = false; |
| | | public bool debugAccount |
| | | public bool debugAccount // 是否开启debug模式 |
| | | { |
| | | get { return m_DebugAccount; } |
| | | private set |
| | |
| | | if (m_DebugAccount != value) |
| | | { |
| | | m_DebugAccount = value; |
| | | if (m_DebugAccount) |
| | | { |
| | | RunTimeExceptionUtility.Instance.Init(); |
| | | } |
| | | // if (m_DebugAccount) |
| | | // { |
| | | // RunTimeExceptionUtility.Instance.Init(); |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public int debugBranch = -1; |
| | | |
| | | //服务端设置白名单:1.可打开debug模式 2. 可提前登录维护服;缺点需要运维人员配合但安全 |
| | | //其他参考: 客户端自己设置的debug模式,增加debug文件;缺点:ios无法操作 |
| | | // 聊天设置分支同时会开启debug模式,优点:任何情况下可以独立操作,不安全但无实质性影响 |
| | | public bool isWhiteListAccount { get; set; } |
| | | |
| | | public bool autoLogin { get; private set; } |
| | | |
| | | public void Init() |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (debugAccount) |
| | | { |
| | | Launch.Instance.EnableLog = LocalSave.GetBool("DesignEnableLog", true); |
| | | Launch.Instance.EnableLogWarning = LocalSave.GetBool("DesignEnableLogWarning", true); |
| | | Launch.Instance.EnableLogError = LocalSave.GetBool("DesignEnableLogError", true); |
| | | Launch.Instance.EnableNetLog = false; |
| | | } |
| | | else |
| | | { |
| | | Launch.Instance.EnableLog = false; |
| | | Launch.Instance.EnableLogWarning = false; |
| | | Launch.Instance.EnableLogError = false; |
| | | Launch.Instance.EnableNetLog = false; |
| | | } |
| | | |
| | | autoLogin = Resources.Load<TextAsset>("AutoLogin") != null; |
| | | if (autoLogin) |
| | | { |
| | | var update = new LogicUpdate(3f); |
| | | update.Start(OnAutoLoginUpdate); |
| | | } |
| | | } |
| | | |
| | | private void OnAutoLoginUpdate() |
| | | { |
| | | // TODO YYL |
| | | // if (StageLoad.Instance.currentStage is LoginStage) |
| | | // { |
| | | var loginWin = UIManager.Instance.GetUI<LoginWin>(); |
| | | if (loginWin != null) |
| | | { |
| | | var accountIpf = loginWin.transform.FindComponent("InputField", "Container_Account/AccountInput"); |
| | | if (accountIpf != null) |
| | | { |
| | | (accountIpf as InputField).text = StringUtility.Contact("Test_", UnityEngine.Random.Range(10000, 99999)); |
| | | } |
| | | |
| | | var enterGame = loginWin.transform.FindComponent("Button", "Container_EnterGame/LoginButton"); |
| | | (enterGame as Button).onClick.Invoke(); |
| | | } |
| | | // } |
| | | |
| | | |
| | | // if (StageLoad.Instance.currentStage is CreateRoleStage) |
| | | // { |
| | | // var win = WindowCenter.Instance.Get<CreateRoleWin>(); |
| | | // if (win != null) |
| | | // { |
| | | // var enterGame = win.transform.FindComponent("Button", "Container_Right/Btn_CreateRole"); |
| | | // if (enterGame is Button) |
| | | // { |
| | | // (enterGame as Button).onClick.Invoke(); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | public void CreateDebugRoot() |
| | | { |
| | | if (debugRoot == null) |
| | | { |
| | | // var prefab = BuiltInLoader.LoadPrefab("UIRootDebug"); |
| | | // debugRoot = GameObject.Instantiate(prefab); |
| | | // MonoBehaviour.DontDestroyOnLoad(debugRoot); |
| | | // debugRoot.name = "UIRootDebug"; |
| | | var prefab = BuiltInLoader.LoadPrefab("UIRootDebug"); |
| | | debugRoot = GameObject.Instantiate(prefab); |
| | | MonoBehaviour.DontDestroyOnLoad(debugRoot); |
| | | debugRoot.name = "UIRootDebug"; |
| | | } |
| | | } |
| | | |
| | | public void RequestWhiteListAuthority(string _account) |
| | | { |
| | | //isWhiteListAccount = false; |
| | | //var tables = new Dictionary<string, string>(); |
| | | //tables["channel"] = VersionConfig.Get().appId; |
| | | //tables["player"] = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account; |
| | | //tables["game"] = VersionConfig.Get().gameId; |
| | | |
| | | //HttpRequest.Instance.RequestHttpGet(StringUtility.Contact(url, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType, 1, OnDebugAuthority); |
| | | } |
| | | |
| | | private void OnDebugAuthority(bool _ok, string _result) |
| | | { |
| | | if (_ok) |
| | | { |
| | | var debugAuthority = JsonMapper.ToObject<DebugAuthority>(_result); |
| | | isWhiteListAccount = debugAuthority.dbg == 1; |
| | | } |
| | | } |
| | | |
| | | public static void SetLogAble(bool _able) |
| | | { |
| | | LocalSave.SetBool("DesignEnableLog", _able); |
| | | Launch.Instance.EnableLog = _able; |
| | | } |
| | | |
| | | public static void SetLogWarningAble(bool _able) |
| | | { |
| | | LocalSave.SetBool("DesignEnableLogWarning", _able); |
| | | Launch.Instance.EnableLogWarning = _able; |
| | | } |
| | | |
| | | public static void SetLogErrorAble(bool _able) |
| | | { |
| | | LocalSave.SetBool("DesignEnableLogError", _able); |
| | | Launch.Instance.EnableLogError = _able; |
| | | } |
| | | |
| | | public static void SetLogNetAble(bool _able) |
| | | { |
| | | Launch.Instance.EnableNetLog = _able; |
| | | } |
| | | |
| | | struct DebugAuthority |
| | | { |
| | | public int dbg; |
| | | } |
| | | |
| | | public class DebugBranch |
| | | { |