|
@@ -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));
|
|
|
|