void RemoveGameRoom(GameRoom gameRoom) { gameRoom.OnAfterError -= AfterErrorDetected; gameRoom.OnAfterGameEnd -= AfterGameEnd; gameRooms.Remove(gameRoom); }
void RegisterGameRoom(GameRoom gameRoom) { gameRoom.OnAfterError += AfterErrorDetected; gameRoom.OnAfterGameEnd += AfterGameEnd; gameRooms.Add(gameRoom); }
void OnStartGameRoom( Dictionary<IClientHolder, string> clients ) { var gameRoom = new GameRoom(clients); RegisterGameRoom(gameRoom); gameRoom.StartGame(); }
void AfterGameEnd(GameRoom gameRoom) { RemoveGameRoom(gameRoom); }
void AfterErrorDetected(GameRoom gameRoom) { RemoveGameRoom(gameRoom); }
void TestInputLines(string filepath) { clients = new List<ClientHolderForTest>() { new ClientHolderForTest(), new ClientHolderForTest(), new ClientHolderForTest(), new ClientHolderForTest() }; clientDict = new Dictionary<IClientHolder, string>() { { clients[0], "player0"}, { clients[1], "player1"}, { clients[2], "player2"}, { clients[3], "player3"}, }; room = new GameRoom(clientDict); // read file var msgList = ReadTestFile(filepath); // start game room.StartGame(); // test each kyoku var splitedEachKyokuMsgList = SplitEachKyoku(msgList); foreach (var kyokuMsg in splitedEachKyokuMsgList) { // start kyoku room.gameModel.StartKyoku(); // Replase Yama and Tehai ReplaceYamaAndTehaiForTest(kyokuMsg); // execution client to server mesages ExecLines(kyokuMsg); } }