2 changed files with 38 additions and 2 deletions
@ -0,0 +1,36 @@ |
|||||||
|
using System; |
||||||
|
|
||||||
|
namespace ET |
||||||
|
{ |
||||||
|
|
||||||
|
public class C2M_ChangeBehaveHandler: AMActorLocationRpcHandler<Unit, C2M_ChangeBehave, M2C_ChangeBehave> |
||||||
|
{ |
||||||
|
protected async override ETTask Run(Unit unit, C2M_ChangeBehave request, M2C_ChangeBehave response, Action reply) |
||||||
|
{ |
||||||
|
try |
||||||
|
{ |
||||||
|
People people = unit.GetComponent<PeopleComponent>().GetChild<People>(request.PeopleId); |
||||||
|
if (people != null) |
||||||
|
{ |
||||||
|
PeopleOperate.ChangeBehave(unit, people, request.BehaveType, request.TargetId); |
||||||
|
response.Error = ErrorCode.ERR_Success; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
response.Error = ErrorCode.ERR_PeopleMoveFail; |
||||||
|
} |
||||||
|
reply(); |
||||||
|
|
||||||
|
} |
||||||
|
catch (Exception e) |
||||||
|
{ |
||||||
|
response.Message = e.ToString(); |
||||||
|
response.Error = ErrorCode.ERR_PeopleMoveFail; |
||||||
|
reply(); |
||||||
|
} |
||||||
|
|
||||||
|
await ETTask.CompletedTask; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue