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.
36 lines
1.2 KiB
36 lines
1.2 KiB
3 years ago
|
using System;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
public class C2M_TestReplaceSkillHandler : AMActorLocationRpcHandler<Unit, C2M_TestReplaceSkill, M2C_TestReplaceSkill>
|
||
|
{
|
||
|
protected async override ETTask Run(Unit unit, C2M_TestReplaceSkill request, M2C_TestReplaceSkill response, Action reply)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var peopleComp = unit.GetComponent<PeopleComponent>();
|
||
|
var people = peopleComp.GetChild<People>(request.PeopleId);
|
||
|
var skillComp = people.GetComponent<SkillComponent>();
|
||
|
|
||
|
if (skillComp == null)
|
||
|
{
|
||
|
response.Error = ErrorCode.ERR_ResponseError;
|
||
|
reply();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
skillComp.TestReplaceSkill(request.OldSkillId, request.NewSkillId);
|
||
|
response.Error = ErrorCode.ERR_Success;
|
||
|
reply();
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
response.Message = e.ToString();
|
||
|
response.Error = ErrorCode.ERR_ResponseError;
|
||
|
reply();
|
||
|
}
|
||
|
|
||
|
await ETTask.CompletedTask;
|
||
|
}
|
||
|
}
|
||
|
}
|