123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Text.Json;
- namespace ET.Server
- {
- /// <summary>
- /// 游戏开始
- /// </summary>
- [MessageHandler(SceneType.Game)]
- public class C2G_BattleNotifyHandler : AMRpcHandler<C2G_BattleNotify, G2C_BattleNotify>
- {
- protected override async ETTask Run(Session session, C2G_BattleNotify request, G2C_BattleNotify response, Action reply)
- {
- WNPlayer player = session.GetComponent<SessionPlayerComponent>().GetMyPlayer();
- if (player == null)
- {
- Log.Debug($"操作错误, player is null");
- response.Error = ErrorCode.ERR_OperationError;
- reply();
- return;
- }
- // 判断参数
- if (string.IsNullOrEmpty(request.Message))
- {
- Log.Debug($"参数错误, request.NameType={request.Message}");
- response.Error = ErrorCode.ERR_ParameterError;
- reply();
- return;
- }
- // 通知战斗服
- Struct.TriggerEventNotify notifyMsg = new Struct.TriggerEventNotify();
- notifyMsg.message = request.Message;
- player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent, JsonSerializer.Serialize(notifyMsg));
- reply();
- await ETTask.CompletedTask;
- }
- }
- }
|