少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-27 7a5e4598f2e9f348f96af3ee6109115fb0d48a6b
3335 添加自动登录工具
1个文件已修改
55 ■■■■■ 已修改文件
System/Debug/DebugUtility.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Debug/DebugUtility.cs
@@ -4,6 +4,7 @@
using Snxxz.UI;
using LitJson;
using System.IO;
using UnityEngine.UI;
[XLua.LuaCallCSharp]
public class DebugUtility : Singleton<DebugUtility>
@@ -30,6 +31,8 @@
    public int debugBranch = -1;
    public bool isWhiteListAccount { get; private set; }
    public bool autoLogin { get; private set; }
    public void Init()
    {
@@ -75,6 +78,58 @@
            DebugEx.EnableLogError = false;
            DebugEx.EnableNetLog = false;
        }
        autoLogin = Resources.Load<TextAsset>("AutoLogin") != null;
        if (autoLogin)
        {
            var update = new LogicUpdate(3f);
            update.Start(OnAutoLoginUpdate);
        }
    }
    private void OnAutoLoginUpdate()
    {
        if (StageLoad.Instance.currentStage is LoginStage)
        {
            var loginWin = WindowCenter.Instance.Get<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 SelectRoleStage)
        {
            var win = WindowCenter.Instance.Get<SelectRoleWin>();
            if (win != null)
            {
                var enterGame = win.transform.FindComponent("Button", "Container_Right/Btn_EnterGame");
                if (enterGame is Button)
                {
                    (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()