Exemplo n.º 1
0
        public override async void Init()
        {
            var ExtensionManager = new ExtensionManager();
            var GMToolsManager   = new GMToolsManager();

            //JEvent.ShowLog = true;//是否显示一些log

            JEvent.defaultEvent.Register(UIManager);
            JEvent.defaultEvent.Register(ExtensionManager);
            JEvent.defaultEvent.Register(GMToolsManager);

            //先搞一个登录失败数据
            LoginErrorData d = new LoginErrorData
            {
                username = "******",
                errorMsg = "故意让它错误的",
            };

            //广播错误数据
            JEvent.defaultEvent.Post(d);

            //取消注册ExtensionManager,这样下次不会post到这个实例内的方法
            JEvent.defaultEvent.Unregister(ExtensionManager);

            await Task.Delay(3000);

            //创建独立的JEvent
            JEvent e = new JEvent();

            //登录成功数据
            LoginSuccessData dt = new LoginSuccessData
            {
                username = "******",
                money    = 10000
            };

            //给独立的JEvent注册方法
            e.Register(UIManager);
            e.Register(GMToolsManager);
            //广播
            e.Post(dt);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Log错误信息
 /// </summary>
 /// <param name="data"></param>
 public void ProcessErrorMsg(LoginErrorData data)
 {
     Log.PrintError("登录失败:" + data.errorMsg);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 登录失败的时候的UI界面更新
 /// </summary>
 /// <param name="data"></param>
 public void OnError(LoginErrorData data)
 {
     ErrorMsgText.text = $"账号:{data.username}登录失败,{data.errorMsg}";
     ErrorPanel.SetActive(true);
 }