You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
using System; |
|
|
|
namespace ET |
|
{ |
|
[FriendClass(typeof(Unit))] |
|
public class C2M_BattleAtkOverHandler: AMActorLocationRpcHandler<Unit, C2M_BattleAtkOver, M2C_BattleAtkOver> |
|
{ |
|
protected async override ETTask Run(Unit unit, C2M_BattleAtkOver request, M2C_BattleAtkOver response, Action reply) |
|
{ |
|
try |
|
{ |
|
var battle = unit.GetChild<Battle>(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; |
|
} |
|
} |
|
} |