zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Server/Hotfix/Demo/Actor_TransferHandler.cs

42 lines
1.8 KiB
C#
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
namespace ET
{
[ActorMessageHandler]
public class Actor_TransferHandler : AMActorLocationRpcHandler<Unit, C2M_TransferRequest, M2C_TransferRequest>
{
protected override async ETTask Run(Unit unit, C2M_TransferRequest request, M2C_TransferRequest response, Action reply)
{
//long unitId = unit.Id;
//// 先在location锁住unit的地址
//await Game.Scene.GetComponent<LocationProxyComponent>().Lock(unitId, unit.InstanceId);
//// 删除unit,让其它进程发送过来的消息找不到actor重发
//Game.EventSystem.Remove(unitId);
//long instanceId = unit.InstanceId;
//int mapIndex = request.MapIndex;
//StartSceneConfigCategory startConfigComponent = StartSceneConfigCategory.Instance;
// StartSceneConfig startSceneConfig = startConfigComponent.TryGet(mapIndex) as StartSceneConfig;
//// 传送到map
////StartConfig mapConfig = startConfigComponent.MapConfigs[mapIndex];
//string address = startSceneConfig.InnerOuterAddress;
//Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(address);
//// 只删除不disponse否则M2M_TrasferUnitRequest无法序列化Unit
//Game.Scene.GetComponent<UnitComponent>().RemoveNoDispose(unitId);
//M2M_TrasferUnitResponse m2m_TrasferUnitResponse = (M2M_TrasferUnitResponse)await session.Call(new M2M_TrasferUnitRequest() { Unit = unit });
//unit.Dispose();
//// 解锁unit的地址,并且更新unit的instanceId
//await Game.Scene.GetComponent<LocationProxyComponent>().UnLock(unitId, instanceId, m2m_TrasferUnitResponse.InstanceId);
await ETTask.CompletedTask;
reply();
}
}
}