ソースを参照

Merge branch 'master' of http://git.gfggame.com:3000/gfg/client

zhaoyang 3 年 前
コミット
c97b3d0dc5

+ 4 - 4
FGUIProject/assets/Login/LoginUI.xml

@@ -20,16 +20,16 @@
       <relation target="" sidePair="right-right,top-top"/>
     </group>
     <component id="n1_ul4p" name="btnStart" src="ul4p6" fileName="components/ButtonKS.xml" xy="0,1473" size="1080,219">
-      <relation target="" sidePair="bottom-bottom"/>
+      <relation target="" sidePair="center-center,middle-middle"/>
     </component>
     <component id="n12_pcul" name="btnChange" src="pcul5f" fileName="components/Button4.xml" xy="211,1336">
-      <relation target="" sidePair="center-center,bottom-bottom"/>
+      <relation target="" sidePair="center-center,middle-middle"/>
     </component>
     <component id="n13_es2q" name="btnAge" src="es2q5i" fileName="components/Button5.xml" xy="924,1740">
       <relation target="" sidePair="right-right,bottom-bottom"/>
     </component>
-    <component id="n15_pwpm" name="btnTapLogin" src="pwpm5k" fileName="components/ButtonTapLogin.xml" xy="333,1549">
-      <relation target="" sidePair="bottom-bottom"/>
+    <component id="n15_pwpm" name="btnTapLogin" src="pwpm5k" fileName="components/ButtonTapLogin.xml" xy="240,1534" size="600,97" aspect="true">
+      <relation target="" sidePair="center-center,middle-middle"/>
     </component>
   </displayList>
 </component>

+ 5 - 5
FGUIProject/assets/Login/components/ButtonTapLogin.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="413,67" extention="Button">
-  <Button/>
-  <controller name="button" pages="0,up,1,down,2,over,3,selectedOver"/>
+<component size="825,134" extention="Button">
+  <controller name="button" pages="0,up,1,down,2,over,3,selectedOver" selected="0"/>
   <displayList>
-    <image id="n0_pwpm" src="pwpm5j" name="n0" xy="0,0">
-      <relation target="" sidePair="width,height"/>
+    <image id="n0_pwpm" name="n0" src="pwpm5j" fileName="images/Taplogin_button.png" xy="0,0" size="825,134">
+      <relation target="" sidePair="width-width,height-height"/>
     </image>
   </displayList>
+  <Button/>
 </component>

BIN
FGUIProject/assets/Login/images/Taplogin_button.png


BIN
FGUIProject/assets/Login/images/Taplogin_button_16.png


+ 1 - 1
FGUIProject/assets/Login/package.xml

@@ -44,7 +44,7 @@
     <component id="hmrw5g" name="ComContent.xml" path="/components/"/>
     <image id="es2q5h" name="shilingts.png" path="/images/"/>
     <component id="es2q5i" name="Button5.xml" path="/components/"/>
-    <image id="pwpm5j" name="Taplogin_button_16.png" path="/images/"/>
+    <image id="pwpm5j" name="Taplogin_button.png" path="/images/"/>
     <component id="pwpm5k" name="ButtonTapLogin.xml" path="/components/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\Login" packageCount="2" genCode="true" extractAlpha="true"/>

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -53,6 +53,8 @@ namespace GFGGame
         public const string BUY_GIFT_SUCCESS = "BUY_GIFT_SUCCESS";//购买礼包成功
         public const string BUY_EXCHANGE_SUCCESS = "BUY_EXCHANGE_SUCCESS";//商城兑换成功
 
+        public const string LOGIN_SUCCESS = "LOGIN_SUCCESS";//登录成功
+        public const string LOGIN_FAIL = "LOGIN_FAIL";//登录失败
         public const string SERVER_CHANGE = "SERVER_CHANGE";//更换区服
 
         public const string FIELD_RESULT = "FIELD_RESULT";//田野结算

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

@@ -92,6 +92,7 @@ namespace GFGGame
             await GetServerInfos();
             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
             EventAgent.DispatchEvent(ConstMessage.SERVER_CHANGE, serverInfosComponent.CurrentServerId);
+            EventAgent.DispatchEvent(ConstMessage.LOGIN_SUCCESS);
             await ReqNoticeInfo();
 
             ViewManager.Hide<ModalStatusView>();
@@ -126,6 +127,7 @@ namespace GFGGame
             {
                 GameController.QuitToLoginView(true);
             }
+            EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL);
         }
 
         public static void Logout()

+ 14 - 3
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();
@@ -60,10 +63,17 @@ namespace GFGGame
             }
             catch (Exception e)
             {
-                if (e is TapException error)
+                if (e is TapException tapError)
                 {
-                    Log.Error($"Login Error:{error.code} message:{error.message}");
-                    PromptController.Instance.ShowFloatTextPrompt(error.message);
+                    if (tapError.code == (int)TapErrorCode.ERROR_CODE_BIND_CANCEL) // 取消登录
+                    {
+                        Log.Debug("登录取消");
+                    }
+                    else
+                    {
+                        Log.Error($"Login Error:{tapError.code} message:{tapError.message}");
+                        PromptController.Instance.ShowFloatTextPrompt(tapError.message);
+                    }
                 }
                 else
                 {
@@ -71,6 +81,7 @@ namespace GFGGame
                     PromptController.Instance.ShowFloatTextPrompt("登录异常");
                 }
             }
+            ViewManager.Hide<ModalStatusView>();
             return false;
         }
 

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

@@ -47,7 +47,6 @@ namespace GFGGame
 
             _ui.m_imgLogo.visible = LauncherConfig.netType != LauncherConfig.EnumNetType.TEMP;
 
-            EventAgent.AddEventListener(ConstMessage.SERVER_CHANGE, OnSeverChangeListener);
 
             _ui.m_btnChange.onClick.Add(OnBtnChangeClick);
 
@@ -67,11 +66,16 @@ 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);
         }
 
         protected override void OnHide()
         {
+            EventAgent.RemoveEventListener(ConstMessage.SERVER_CHANGE, OnSeverChangeListener);
+            EventAgent.RemoveEventListener(ConstMessage.LOGIN_SUCCESS, OnLoginSuccess);
             if (_sceneObject != null)
             {
                 GameObject.Destroy(_sceneObject);
@@ -86,7 +90,6 @@ namespace GFGGame
             {
                 var success = await PlatformTapManager.Instance.LoginCache();
                 _ui.m_btnTapLogin.visible = !success;
-                _ui.m_btnStart.visible = success;
             }
             else//自有登录
             {
@@ -108,13 +111,10 @@ namespace GFGGame
         {
             var success = await PlatformTapManager.Instance.Login();
             _ui.m_btnTapLogin.visible = !success;
-            _ui.m_btnStart.visible = success;
         }
 
         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)
             {
@@ -126,6 +126,13 @@ namespace GFGGame
 
             LogServerHelperHttp.SendNodeLog((int)LogNode.ShowSelectServer);
         }
+
+        private void OnLoginSuccess(EventContext context)
+        {
+            _ui.m_btnLogout.visible = true;
+            _ui.m_btnStart.visible = true;
+        }
+
         private void OnSeverChangeListener(EventContext context)
         {
             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
@@ -138,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;
@@ -146,20 +153,27 @@ namespace GFGGame
             ViewManager.Show<SystemNoticeView>(new object[] { NoticeDataManager.Instance.LastNoticeInfo.title, NoticeDataManager.Instance.LastNoticeInfo.content });
         }
 
-        private async void OnClickBtnStart()
+        private void OnClickBtnStart()
         {
-            var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
-            if (serverInfosComponent.ServerInfoList.Count <= 0)
+            if (PlatformManager.IsTaptap)//taptap平台
             {
-                bool login = GameController.CheckLoginCache(true);
-                if (!login)
-                {
-                    ViewManager.Show<LoginInputView>();
-                }
+                LoginController.GetRoles().Coroutine();
             }
             else
             {
-                await LoginController.GetRoles();
+                var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
+                if (serverInfosComponent.ServerInfoList.Count <= 0)
+                {
+                    bool login = GameController.CheckLoginCache(true);
+                    if (!login)
+                    {
+                        ViewManager.Show<LoginInputView>();
+                    }
+                }
+                else
+                {
+                    LoginController.GetRoles().Coroutine();
+                }
             }
         }
 

BIN
GameClient/Assets/ResIn/UI/Login/Login_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/Login/Login_atlas0.png


BIN
GameClient/Assets/ResIn/UI/Login/Login_fui.bytes