FunGame-Core/Interface/Base/IServerModel.cs
milimoe 2de1e57e0c
针对服务器端的新功能支持与改进 (#90)
* 添加SQLite模式

* 将Hashtable转为Dictionary<string, object>,因为它具有性能优势

* 添加GamingRequest用于区分Gaming

* 模组中AfterLoad方法现已移动至加载器完全加载完毕后触发

* 删除了服务器对GameModule的加载,现在只会加载GameModuleServer
2024-09-25 09:24:53 +08:00

80 lines
2.6 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 Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Network;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Interface.Base
{
public interface IServerModel
{
/// <summary>
/// 服务器实例是否在运行
/// </summary>
public abstract bool Running { get; }
/// <summary>
/// 客户端的套接字实例
/// </summary>
public abstract ISocketMessageProcessor? Socket { get; }
/// <summary>
/// 客户端的用户实例,在用户登录后有效
/// </summary>
public abstract User User { get; }
/// <summary>
/// 客户端的名称默认是客户端的IP地址
/// </summary>
public abstract string ClientName { get; }
/// <summary>
/// 客户端是否启动了开发者模式
/// </summary>
public bool IsDebugMode { get; }
/// <summary>
/// 客户端的游戏模组服务器
/// </summary>
public GameModuleServer? NowGamingServer { get; set; }
/// <summary>
/// 向客户端发送消息
/// </summary>
/// <param name="socket"></param>
/// <param name="type"></param>
/// <param name="objs"></param>
/// <returns></returns>
public bool Send(ISocketMessageProcessor socket, SocketMessageType type, params object[] objs);
/// <summary>
/// 向客户端发送系统消息
/// </summary>
/// <param name="showtype"></param>
/// <param name="msg"></param>
/// <param name="title"></param>
/// <param name="autoclose"></param>
/// <param name="usernames"></param>
public void SendSystemMessage(ShowMessageType showtype, string msg, string title, int autoclose, params string[] usernames);
/// <summary>
/// 获取客户端的名称通常未登录时显示为客户端的IP地址登录后显示为账号名
/// </summary>
/// <returns></returns>
public string GetClientName();
/// <summary>
/// 开始接收客户端消息
/// <para>请勿在 <see cref="GameModuleServer"/> 中调用此方法</para>
/// </summary>
/// <param name="socket"></param>
/// <returns></returns>
public bool Read(ISocketMessageProcessor socket);
/// <summary>
/// 启动对客户端的监听
/// <para>请勿在 <see cref="GameModuleServer"/> 中调用此方法</para>
/// </summary>
public void Start();
}
}