Переглянути джерело

修改事件开端协议命名,删除无意义的条件check

大爷 1 рік тому
батько
коміт
d2fe5cd348

+ 4 - 4
Config/Proto/OuterMessage_C_10001.proto

@@ -353,14 +353,14 @@ message HttpGetVersionResponse
 	string Url = 4;	// 新包地址
 }
 
-//ResponseType G2C_GameStart
-message C2G_GameStart // IRequest
+//ResponseType G2C_BattleNotify
+message C2G_BattleNotify // IRequest
 {
 	int32 RpcId = 1;
-	string NameType = 2;
+	string Message = 2;
 }
 
-message G2C_GameStart // IResponse
+message G2C_BattleNotify // IResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;

+ 5 - 25
DotNet/Hotfix/Scenes/Game/Handler/C2G_GameStartHandler.cs → DotNet/Hotfix/Scenes/Game/Handler/C2G_BattleNotifyHandler.cs

@@ -7,9 +7,9 @@ namespace ET.Server
     /// 游戏开始
     /// </summary>
     [MessageHandler(SceneType.Game)]
-    public class C2G_GameStartHandler : AMRpcHandler<C2G_GameStart, G2C_GameStart>
+    public class C2G_BattleNotifyHandler : AMRpcHandler<C2G_BattleNotify, G2C_BattleNotify>
     {
-        protected override async ETTask Run(Session session, C2G_GameStart request, G2C_GameStart response, Action reply)
+        protected override async ETTask Run(Session session, C2G_BattleNotify request, G2C_BattleNotify response, Action reply)
         {
             WNPlayer player = session.GetComponent<SessionPlayerComponent>().GetMyPlayer();
             if (player == null)
@@ -21,37 +21,17 @@ namespace ET.Server
             }
 
             // 判断参数
-            if (string.IsNullOrEmpty(request.NameType.Trim()))
+            if (string.IsNullOrEmpty(request.Message))
             {
-                Log.Debug($"参数错误, request.NameType={request.NameType}");
+                Log.Debug($"参数错误, request.NameType={request.Message}");
                 response.Error = ErrorCode.ERR_ParameterError;
                 reply();
                 return;
             }
 
-            long roomId = long.Parse(session.GetComponent<SessionPlayerComponent>().RoomId);
-            if (roomId <= 0)
-            {
-                Log.Debug($"操作错误, roomId is null");
-                response.Error = ErrorCode.ERR_OperationError;
-                reply();
-                return;
-            }
-
-            Scene scene = session.DomainScene();
-
-            Map map = scene.GetComponent<GameMapComponent>().GetMapByRoomId(roomId);
-            if (map == null)
-            {
-                Log.Debug($"操作错误, map is null");
-                response.Error = ErrorCode.ERR_OperationError;
-                reply();
-                return;
-            }
-
             // 通知战斗服
             Struct.TriggerEventNotify notifyMsg = new Struct.TriggerEventNotify();
-            notifyMsg.name = request.NameType;
+            notifyMsg.message = request.Message;
 
             player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent, JsonSerializer.Serialize(notifyMsg));
 

+ 1 - 1
DotNet/Model/Const/Struct.cs

@@ -293,7 +293,7 @@
         public class TriggerEventNotify
         {
             /** 事件名称 **/
-            public string name { get; set; }
+            public string message { get; set; }
         }
     }
 }

+ 9 - 9
DotNet/Model/Generate/Message/OuterMessage_C_10001.cs

@@ -1,4 +1,4 @@
-using ET;
+using ET;
 using ProtoBuf;
 using System.Collections.Generic;
 namespace ET
@@ -727,22 +727,22 @@ namespace ET
 
 	}
 
-	[ResponseType(nameof(G2C_GameStart))]
-	[Message(OuterMessage.C2G_GameStart)]
+	[ResponseType(nameof(G2C_BattleNotify))]
+	[Message(OuterMessage.C2G_BattleNotify)]
 	[ProtoContract]
-	public partial class C2G_GameStart: ProtoObject, IRequest
+	public partial class C2G_BattleNotify: ProtoObject, IRequest
 	{
 		[ProtoMember(1)]
 		public int RpcId { get; set; }
 
 		[ProtoMember(2)]
-		public string NameType { get; set; }
+		public string Message { get; set; }
 
 	}
 
-	[Message(OuterMessage.G2C_GameStart)]
+	[Message(OuterMessage.G2C_BattleNotify)]
 	[ProtoContract]
-	public partial class G2C_GameStart: ProtoObject, IResponse
+	public partial class G2C_BattleNotify: ProtoObject, IResponse
 	{
 		[ProtoMember(1)]
 		public int RpcId { get; set; }
@@ -806,7 +806,7 @@ namespace ET
 		 public const ushort R2C_Disconnect = 10048;
 		 public const ushort HttpDouyinApiCallbackResponse = 10049;
 		 public const ushort HttpGetVersionResponse = 10050;
-		 public const ushort C2G_GameStart = 10051;
-		 public const ushort G2C_GameStart = 10052;
+		 public const ushort C2G_BattleNotify = 10051;
+		 public const ushort G2C_BattleNotify = 10052;
 	}
 }