提交 27b531a3 编写于 作者: T tanghai

MapUnitActorTypeHandler.cs仔细看了一下貌似不太需要,OneFrameMessage直接统一放到ActorMessageHandle处理就行了

上级 d7a14b95
using System.Threading.Tasks;
using ETModel;
namespace ETHotfix
{
/// <summary>
/// 玩家收到帧同步消息交给帧同步组件处理
/// </summary>
[ActorTypeHandler(AppType.Map, ActorType.Unit)]
public class MapUnitActorTypeHandler : IActorTypeHandler
{
public async Task Handle(Session session, Entity entity, IActorMessage actorMessage)
{
if (actorMessage is OneFrameMessage aFrameMessage)
{
Game.Scene.GetComponent<ServerFrameComponent>().Add(aFrameMessage);
ActorResponse actorResponse = new ActorResponse
{
RpcId = actorMessage.RpcId
};
session.Reply(actorResponse);
return;
}
await Game.Scene.GetComponent<ActorMessageDispatherComponent>().Handle(session, entity, actorMessage);
}
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@ namespace ETHotfix
{
Unit unit = ComponentFactory.Create<Unit>();
await unit.AddComponent<ActorComponent, string>(ActorType.Unit).AddLocation();
await unit.AddComponent<ActorComponent>().AddLocation();
unit.AddComponent<UnitGateComponent, long>(message.GateSessionId);
Game.Scene.GetComponent<UnitComponent>().Add(unit);
response.UnitId = unit.Id;
......
using System.Threading.Tasks;
using ETModel;
namespace ETHotfix
{
[ActorMessageHandler(AppType.Map)]
public class OneFrameMessageHandler: AMActorHandler<Unit, OneFrameMessage>
{
protected override async Task Run(Unit entity, OneFrameMessage message)
{
Game.Scene.GetComponent<ServerFrameComponent>().Add(message);
await Task.CompletedTask;
}
}
}
......@@ -4,6 +4,5 @@
{
public const string Common = "Common";
public const string GateSession = "GateSession";
public const string Unit = "Unit";
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册