/* * @Author: 白哉 * @Description: * @Date: 2025年09月16日 星期二 16:09:43 * @Modify: */ using System.Collections.Generic; namespace TH1_Logic.Net { // 房间状态 public enum LobbyState { None, // 未在房间中 Creating, // 正在创建房间 Joining, // 正在加入房间 InLobby, // 在房间中 Leaving // 正在离开房间 } public interface ILobby { public void Cleanup(); // 邀请好友 public void InviteFriend(ulong memberId); // 踢出成员 public void KickMember(ulong memberId); public Dictionary GetOnlineFriendsDict(); public void CreateFriendsLobby(int maxMembers = 4); public void LeaveLobby(); // 获取房间所有成员 public List GetAllMemberIds(); // 获取房间所有成员信息 public Dictionary GetAllMemberInfo(); // 获取成员数量 public int GetMemberCount(); // 获取最大成员数 public int GetMemberLimit(); // 判断成员是否在房间中 public bool IsMemberInLobby(ulong memberId); // 获取自己的 memberId public ulong GetSelfMemberId(); // 获取房主的 memberId public ulong GetLobbyOwnerId(); public LobbyState GetCurState(); public bool IsLobbyOwner(); public bool IsInLobby(); // 发送P2P消息 public bool SendMessageToPeer(ulong member, byte[] data, bool reliable = true); // 广播P2P消息 public void BroadcastMessage(byte[] data, bool reliable = true); } public class LobbyBase : ILobby { public void LeaveLobby() { } // 获取房间所有成员 public List GetAllMemberIds() { return null; } public Dictionary GetAllMemberInfo() { return null; } public void Cleanup() { } public void InviteFriend(ulong memberId) { } public void KickMember(ulong memberId) { } public Dictionary GetOnlineFriendsDict() { return null; } public void CreateFriendsLobby(int maxMembers = 4) { } // 获取成员数量 public int GetMemberCount() { return 0; } // 获取最大成员数 public int GetMemberLimit() { return 0; } // 判断成员是否在房间中 public bool IsMemberInLobby(ulong memberId) { return false; } // 获取自己的 memberId public ulong GetSelfMemberId() { return 0; } // 获取房主的 memberId public ulong GetLobbyOwnerId() { return 0; } public LobbyState GetCurState() { return LobbyState.None; } public bool IsLobbyOwner() { return false; } public bool IsInLobby() { return false; } public bool SendMessageToPeer(ulong member, byte[] data, bool reliable = true) { return false; } public void BroadcastMessage(byte[] data, bool reliable = true) { return; } } }