using System; namespace ET { [FriendClass(typeof(Unit))] public class C2M_BattleAtkOverHandler: AMActorLocationRpcHandler { protected async override ETTask Run(Unit unit, C2M_BattleAtkOver request, M2C_BattleAtkOver response, Action reply) { try { var battle = unit.GetChild(unit.BattleId); if (battle == null) { response.Error = ErrorCode.ERR_CanNotFoundBattle; reply(); return; } var seed = RandomHelper.RandInt32(); response.Seed = seed; battle.SetRandomSeed(seed); battle.BattleAtk(); response.Error = ErrorCode.ERR_Success; reply(); } catch (Exception e) { response.Message = e.ToString(); reply(); throw; } await ETTask.CompletedTask; } } }