123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Text.Json;
- namespace ET.Server
- {
-
-
-
- [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;
- }
-
- int objid = 7;
-
- if(request.Message == BattleNotify.TiktokGift_52.ToString())
- {
-
- int level = 1;
- if (level < 3)
- {
- player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent,
- JsonSerializer.Serialize(new Struct.TriggerEventNotify() { message = BattleNotify.TiktokGift_52.ToString(), TriggerUnits = objid.ToString() }));
- }
- else
- {
-
- player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent,
- JsonSerializer.Serialize(new Struct.TriggerEventNotify() { message = BattleNotify.TiktokGift_52_ext.ToString(), TriggerUnits = objid.ToString() }));
- }
- return;
- }
- Struct.TriggerEventNotify notifyMsg = new Struct.TriggerEventNotify() { message = request.Message };
- if (request.Message == BattleNotify.TiktokGift_1.ToString() )
- {
-
- notifyMsg.TriggerUnits = objid.ToString();
- }
- else if(request.Message == BattleNotify.TiktokGift_10.ToString())
- {
- notifyMsg.TriggerUnits = objid.ToString();
- }
-
- player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent, JsonSerializer.Serialize(notifyMsg));
- reply();
- await ETTask.CompletedTask;
- }
- }
- }
|