瀏覽代碼

排队显示

guodong 1 年之前
父節點
當前提交
6f8d4b585a

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

@@ -222,7 +222,5 @@ namespace GFGGame
         //更新2048游戏关卡状态
         public const string TZFE_GAME_UPDATE = "TZFE_GAME_UPDATE";
         
-        //服务端推送最新排队信息
-        public const string UPDATE_QUEUE = "UPDATE_QUEUE";
     }
 }

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

@@ -9,6 +9,8 @@ namespace GFGGame
         {
             switch (errorCode)
             {
+                case ET.ErrorCode.ERR_Cancel:
+                    return true;
                 case ET.ErrorCode.ERR_NetWorkError:
                     {
                         AlertSystem.Show("网络异常,也有可能是服务器异常,请稍后再试!")

+ 5 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/DisConnected/DisConnectedCompnentSystem.cs

@@ -26,10 +26,14 @@ namespace ET
                         });
                         return;
                     }
-                    else
+                    else if(self.SessionState == SessionState.Gate)
                     {
                         LoginController.ReqReConnectGate().Coroutine();
                     }
+                    else
+                    {
+                        LogUtil.LogDev("DisConnectedCompnentDestroy");
+                    }
                 }
                 else
                 {

+ 8 - 4
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Login/LoginHelper.cs

@@ -81,7 +81,7 @@ namespace ET
         {
             zoneScene.GetComponent<SessionComponent>().AccountSession = accountSession;
             accountSession.AddComponent<PingComponent>();
-            accountSession.AddComponent<DisConnectedCompnent>();
+            accountSession.AddComponent<DisConnectedCompnent>().SessionState = SessionState.Login;
             zoneScene.GetComponent<SessionComponent>().SessionState = SessionState.Login;
             AccountInfoComponent accountInfoComponent = zoneScene.GetComponent<AccountInfoComponent>();
             accountInfoComponent.Token = a2CLoginAccount.Token;
@@ -289,6 +289,7 @@ namespace ET
 
             zoneScene.GetComponent<AccountInfoComponent>().RealmKey = a2C_GetRealmKey.RealmKey;
             zoneScene.GetComponent<AccountInfoComponent>().RealmAddress = a2C_GetRealmKey.RealmAddress;
+            zoneScene.GetComponent<SessionComponent>().DisconnectAccount();
 
             await ETTask.CompletedTask;
             return ErrorCode.ERR_Success;
@@ -325,7 +326,7 @@ namespace ET
             LogUtil.LogDev($"GateAddress : {r2C_LoginRealm.GateAddress}");
             Session gateSession = zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(r2C_LoginRealm.GateAddress));
             gateSession.AddComponent<PingComponent>();
-            gateSession.AddComponent<DisConnectedCompnent>();
+            gateSession.AddComponent<DisConnectedCompnent>().SessionState = SessionState.Gate;
             zoneScene.GetComponent<SessionComponent>().GateSession = gateSession;
             zoneScene.GetComponent<SessionComponent>().SessionState = SessionState.Gate;
 
@@ -375,9 +376,12 @@ namespace ET
                 return g2C_EnterGame.Error;
             }
             zoneScene.GetComponent<PlayerComponent>().MyId = g2C_EnterGame.MyId;
-            await GameGlobal.zoneScene.GetComponent<ObjectWait>().Wait<ET.WaitType.Wait_SceneChangeStart>();
+            var result = await GameGlobal.zoneScene.GetComponent<ObjectWait>().Wait<ET.WaitType.Wait_SceneChangeStart>();
+            if(result.Error == WaitTypeError.Cancel)
+            {
+                return ErrorCode.ERR_Cancel;
+            }
             LogUtil.LogDev("角色进入游戏成功!");
-            zoneScene.GetComponent<SessionComponent>().DisconnectAccount();
             return ErrorCode.ERR_Success;
         }
 

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/DisConnected/DisConnectedCompnent.cs

@@ -3,5 +3,6 @@
     public class DisConnectedCompnent : Entity, IAwake, IDestroy
     {
         public bool ToReconnect = true;
+        public SessionState SessionState;
     }
 }

+ 10 - 8
GameClient/Assets/Game/HotUpdate/ServerProxy/QueueSProxy.cs

@@ -6,14 +6,14 @@ namespace GFGGame
     {
         protected override async ETTask Run(Session session, G2C_UpdateQueue message)
         {
-            Log.Debug(JsonHelper.ToJson(message));
-
-            AlertSystem.Show($"您前面还有{message.Index}人", "当前人数爆满,正在为您排队")
-                .SetLeftButton(true, "取消", (obj) => {
-                    QueueSProxy.ReqSevenCancelQueue().Coroutine();
-                });
-            EventAgent.DispatchEvent(ConstMessage.UPDATE_QUEUE);
-            await ETTask.CompletedTask;
+            if(message.Index > 1)
+            {
+                AlertSystem.Show($"您前面还有{message.Index}位玩家", "当前服务器爆满,正在为您排队")
+                    .SetLeftButton(true, "取消", (obj) => {
+                        QueueSProxy.ReqSevenCancelQueue().Coroutine();
+                    });
+                await ETTask.CompletedTask;
+            }
         }
     }
 
@@ -29,6 +29,8 @@ namespace GFGGame
             if(response.Error == ErrorCode.ERR_Success)
             {
                 ViewManager.Hide<ModalStatusView>();
+                GameGlobal.zoneScene.GetComponent<ObjectWait>().Notify(new ET.WaitType.Wait_SceneChangeStart() { Error = WaitTypeError.Cancel});
+                GameController.QuitToLoginView(false);
             }
         }
     }