/// <summary> /// Sends a chatmessage to the chatroom. /// </summary> public void SendChatMessage(int privateRoomId, string privateMessage, ConnectionCore connection) { if (PrivateChatrooms.ContainsKey(privateRoomId)) { Chatroom room = PrivateChatrooms[privateRoomId]; room.SendMessage(connection, privateMessage); } }
/// <summary> /// Creates and returns a private chatroom. /// </summary> public Chatroom CreatePrivateRoom(int joincount) { if (ConnectionQueue.Count < joincount) { return(null); } Chatroom privateRoom = new Chatroom(ServerManager.ChatroomManager.LastRoomId++); PrivateChatrooms.Add(privateRoom.ID, privateRoom); ServerManager.ChatroomManager.AddChatroom(privateRoom); for (int i = 0; i < joincount; i++) { ConnectionCore core = ConnectionQueue.Dequeue(); privateRoom.Join(core); core.SendMessage(new CreatePrivateRoomComposer(privateRoom)); core.SendMessage(new JoinChatroomComposer(privateRoom.ID, JoinState.JoinChatRoomOk)); } return(privateRoom); }
/// <summary> /// Removes a private chatroom. /// </summary> public void RemoveChatroom(int chatRoomId) { PrivateChatrooms.Remove(chatRoomId); }