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.
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
{
|
|
|
|
public static class PeopleHelper
|
|
|
|
{
|
|
|
|
public static async ETTask<int> Move(Unit unit, long peopleId, float posX, float posY)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
C2M_PeopleMove msg = new C2M_PeopleMove(){PeopleId = peopleId, X = posX, Y = posY};
|
|
|
|
M2C_PeopleMove resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_PeopleMove;
|
|
|
|
if (resp.Error != ErrorCode.ERR_Success)
|
|
|
|
{
|
|
|
|
Log.Error(resp.Error.ToString());
|
|
|
|
return resp.Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Log.Error(e);
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
|
|
|
return ErrorCode.ERR_Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static async ETTask<int> ChangeBehave(Unit unit, People people,int behaveType,long targetId )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
C2M_ChangeBehave msg = new C2M_ChangeBehave(){PeopleId = people.Id,TargetId = targetId,BehaveType = behaveType};
|
|
|
|
M2C_ChangeBehave resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_ChangeBehave;
|
|
|
|
if (resp.Error != ErrorCode.ERR_Success)
|
|
|
|
{
|
|
|
|
Log.Error(resp.Error.ToString());
|
|
|
|
return resp.Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
PeopleOperate.ChangeBehave(unit, people, behaveType,targetId);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Log.Error(e);
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
|
|
|
return ErrorCode.ERR_Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|