/// <summary> /// 更新房间列表 /// </summary> void updateRoomList() { while (true) { lock_roomList.WaitOne(); for (int i = RoomList.Count - 1; i >= 0; i--) { Room t = RoomList[i]; if (t.RoomOwner.isGame || !t.RoomOwner.isLink || !t.RoomOwner.isLogin || !t.RoomOwner.isStayRoom) { t.Clear(); RoomList.Remove(t); Console.WriteLine(t.name + " 被移除"); } //检查有无可以开始的房间 if (t.isReadyGame) { GameplayManagement.getInstance().startGame(t); t.Clear(); RoomList.Remove(t); Console.WriteLine(t.name + " 开始游戏"); } } lock_roomList.ReleaseMutex(); Thread.Sleep(50); } }
public static GameplayManagement getInstance() { if (instance == null) { instance = new GameplayManagement(); } return(instance); }