Files
FunGameServer-Test/src/FunGame.Server.Contracts/Gaming/IGameSession.cs
T
2026-08-28 19:44:46 +08:00

40 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using FunGame.Core.Entity;
using FunGame.Core.Model.Queue;
using FunGame.Server.Contracts.Networking;
namespace FunGame.Server.Contracts.Gaming;
/// <summary>
/// 对局会话(宿主维护,暴露给游戏模式模组 GameModuleServer)<para/>
/// 模组能力:读参与角色 / 广播局内事件 / 结束对局
/// </summary>
public interface IGameSession
{
/// <summary>对局唯一标识</summary>
Guid Id { get; }
/// <summary>战斗引擎队列(模组建房时创建)</summary>
GamingQueue Queue { get; }
/// <summary>游戏模式(GameModule 名 / 服务器插件名)</summary>
string Mode { get; }
/// <summary>用户 Id -> 客户端会话(本局参与者)</summary>
IReadOnlyDictionary<long, IClientSession> Clients { get; }
/// <summary>对局是否仍在运行</summary>
bool Running { get; }
/// <summary>自定义数据(模组私有状态)</summary>
Dictionary<string, object> CustomData { get; }
/// <summary>本局参与角色(宿主装配,供模组取用)</summary>
IReadOnlyList<Character> Characters { get; }
/// <summary>广播消息给本局全部用户(userIds 为空)或指定用户</summary>
Task BroadcastAsync(string messageType, Dictionary<string, object> data, params long[] userIds);
/// <summary>结束对局(宿主负责归档回合记录与广播结算)</summary>
Task EndGameAsync(bool aborted = false);
}