Files
hjha-server/ServerCore/Actor/MessageSenderStruct.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

45 lines
1.0 KiB
C#

using System;
using System.Threading.Tasks;
using NetWorkMessage;
namespace ActorCore
{
public readonly struct MessageSenderStruct
{
/// <summary>
/// 目的地
/// </summary>
public ActorId ActorId { get; }
/// <summary>
/// 请求类型
/// </summary>
public Type RequestType { get; }
private readonly TaskCompletionSource<IResponse> tcs;
public MessageSenderStruct(ActorId actorId, Type requestType)
{
this.ActorId = actorId;
this.RequestType = requestType;
this.tcs = new TaskCompletionSource<IResponse>();
}
public void SetResult(IResponse response)
{
this.tcs.SetResult(response);
}
public void SetException(Exception exception)
{
this.tcs.SetException(exception);
}
public async Task<IResponse> Wait()
{
return await this.tcs.Task;
}
}
}