hexiaojie 1 жил өмнө
parent
commit
71f89aa3ec

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

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

+ 21 - 0
GameClient/Assets/Game/HotUpdate/Data/QueueDataManager.cs

@@ -0,0 +1,21 @@
+namespace GFGGame
+{
+    public class QueueDataManager : SingletonBase<QueueDataManager>
+    {
+        public int Index { get; private set; }
+
+        public int Count { get; private set; }
+
+        public void UpQueueData(int index, int count)
+        {
+            Index = index;
+            count = count;
+        }
+
+        public void ClaerQueueData()
+        {
+            Index = 0;
+            Count = 0;
+        }
+    }
+}

+ 28 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/QueueSProxy.cs

@@ -0,0 +1,28 @@
+using ET;
+
+namespace GFGGame
+{
+    public class G2C_UpdateQueueHandler : AMHandler<G2C_UpdateQueue>
+    {
+        protected override async ETTask Run(Session session, G2C_UpdateQueue message)
+        {
+            Log.Debug(JsonHelper.ToJson(message));
+            QueueDataManager.Instance.UpQueueData(message.Index, message.Count);
+            EventAgent.DispatchEvent(ConstMessage.UPDATE_QUEUE);
+            await ETTask.CompletedTask;
+        }
+    }
+
+    public static class QueueSProxy
+    {
+        /// <summary>
+        /// 请求服务端取消排队
+        /// </summary>
+        /// <returns></returns>
+        public static async ETTask<bool> ReqSevenCancelQueue()
+        {
+            var response = (G2C_CancelQueue)await MessageHelper.SendToServer(new C2G_CancelQueue());
+            return response is { Error: ErrorCode.ERR_Success };
+        }
+    }
+}