浏览代码

登录优化

guodong 3 年之前
父节点
当前提交
c8ff5d108c

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -127,6 +127,7 @@ namespace GFGGame
             {
                 GameController.QuitToLoginView(true);
             }
+            EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL);
         }
 
         public static void Logout()

+ 4 - 0
GameClient/Assets/Game/HotUpdate/Platform/PlatformTapManager.cs

@@ -35,12 +35,14 @@ namespace GFGGame
             {
                 return false;
             }
+            ViewManager.Show<ModalStatusView>("登录中...");
             TDSUser tdsUser = await TDSUser.GetCurrent();
             if (null != tdsUser)
             {
                 InitAntiAddiction(tdsUser.ObjectId);
                 return true;
             }
+            ViewManager.Hide<ModalStatusView>();
             return false;
         }
 
@@ -51,6 +53,7 @@ namespace GFGGame
             {
                 return false;
             }
+            ViewManager.Show<ModalStatusView>("登录中...");
             try
             {
                 var tdsUser = await TDSUser.LoginWithTapTap();
@@ -78,6 +81,7 @@ namespace GFGGame
                     PromptController.Instance.ShowFloatTextPrompt("登录异常");
                 }
             }
+            ViewManager.Hide<ModalStatusView>();
             return false;
         }
 

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -66,6 +66,7 @@ namespace GFGGame
              UpdateServer(recentlyServerInfo);
             _ui.m_btnStart.visible = false;
             _ui.m_btnTapLogin.visible = false;
+            _ui.m_btnLogout.visible = false;
             InitLoginStatus(serverInfosComponent).Coroutine();
             EventAgent.AddEventListener(ConstMessage.SERVER_CHANGE, OnSeverChangeListener);
             EventAgent.AddEventListener(ConstMessage.LOGIN_SUCCESS, OnLoginSuccess);
@@ -114,8 +115,6 @@ namespace GFGGame
 
         private void UpdateServer(ServerInfo info)
         {
-            //登录成功后更新注销按钮显示
-            _ui.m_btnLogout.visible = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>().IsLogin();
             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
             if (serverInfosComponent.ServerInfoList.Count == 0)
             {
@@ -130,6 +129,7 @@ namespace GFGGame
 
         private void OnLoginSuccess(EventContext context)
         {
+            _ui.m_btnLogout.visible = true;
             _ui.m_btnStart.visible = true;
         }
 
@@ -145,7 +145,7 @@ namespace GFGGame
         }
         private void OnClickBtnNotice()
         {
-            if (NoticeDataManager.Instance.LastNoticeInfo.noticeId == 0)
+            if (NoticeDataManager.Instance.LastNoticeInfo == null || NoticeDataManager.Instance.LastNoticeInfo.noticeId == 0)
             {
                 PromptController.Instance.ShowFloatTextPrompt("暂无公告发布");
                 return;