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.
67 lines
2.2 KiB
67 lines
2.2 KiB
3 years ago
|
|
||
|
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[FriendClass(typeof(UnitGateComponent))]
|
||
|
public static class MessageHelper
|
||
|
{
|
||
|
public static void Broadcast(Unit unit, IActorMessage message)
|
||
|
{
|
||
|
// Dictionary<long, AOIEntity> dict = unit.GetBeSeePlayers();
|
||
|
// foreach (AOIEntity u in dict.Values)
|
||
|
// {
|
||
|
// SendToClient(u.Unit, message);
|
||
|
// }
|
||
|
}
|
||
|
|
||
|
public static void SendToClient(Unit unit, IActorMessage message)
|
||
|
{
|
||
|
SendActor(unit.GetComponent<UnitGateComponent>().GateSessionActorId, message);
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送协议给ActorLocation
|
||
|
/// </summary>
|
||
|
/// <param name="id">注册Actor的Id</param>
|
||
|
/// <param name="message"></param>
|
||
|
public static void SendToLocationActor(long id, IActorLocationMessage message)
|
||
|
{
|
||
|
ActorLocationSenderComponent.Instance.Send(id, message);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送协议给Actor
|
||
|
/// </summary>
|
||
|
/// <param name="actorId">注册Actor的InstanceId</param>
|
||
|
/// <param name="message"></param>
|
||
|
public static void SendActor(long actorId, IActorMessage message)
|
||
|
{
|
||
|
ActorMessageSenderComponent.Instance.Send(actorId, message);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送RPC协议给Actor
|
||
|
/// </summary>
|
||
|
/// <param name="actorId">注册Actor的InstanceId</param>
|
||
|
/// <param name="message"></param>
|
||
|
/// <returns></returns>
|
||
|
public static async ETTask<IActorResponse> CallActor(long actorId, IActorRequest message)
|
||
|
{
|
||
|
return await ActorMessageSenderComponent.Instance.Call(actorId, message);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送RPC协议给ActorLocation
|
||
|
/// </summary>
|
||
|
/// <param name="id">注册Actor的Id</param>
|
||
|
/// <param name="message"></param>
|
||
|
/// <returns></returns>
|
||
|
public static async ETTask<IActorResponse> CallLocationActor(long id, IActorLocationRequest message)
|
||
|
{
|
||
|
return await ActorLocationSenderComponent.Instance.Call(id, message);
|
||
|
}
|
||
|
}
|
||
|
}
|