// for each listed room, set a join button from the available button/slots void OnGUI() { if (!gamesPanel.gameObject.GetActive()) { return; } foreach (RoomJoiner bt in roomButtons) { bt.gameObject.SetActive(false); } int index = 0; foreach (RoomInfo game in PhotonNetwork.GetRoomList()) { if (index >= roomButtons.Length || !game.open) { break; } RoomJoiner button = roomButtons[index++]; button.gameObject.SetActive(true); button.RoomName = game.name; string info = game.name.Trim() + " (" + game.playerCount + "/" + game.maxPlayers + ")"; button.GetComponentInChildren <Text>().text = info; } }
public void TestCanCreateRoomWithNullCode() { var chameleonGame = new Mock <IChameleonGame>(); var roomJoiner = new RoomJoiner(chameleonGame.Object); const string requestBody = "{\"PersonName\": \"Anita\", \"RoomCode\": null}"; roomJoiner.Join(requestBody); chameleonGame.Verify(x => x.CreateRoom("Anita"), Times.Once); }
public void TestErrorsIfPersonNameIsEmpty() { var chameleonGame = new Mock <IChameleonGame>(); var roomJoiner = new RoomJoiner(chameleonGame.Object); const string requestBody = "{\"PersonName\": \"\", \"RoomCode\": \"ABCD\"}"; Assert.Throws <PersonNameMustBeSpecifiedException>(() => { roomJoiner.Join(requestBody); }); chameleonGame.Verify(x => x.CreateRoom(It.IsAny <string>()), Times.Never); chameleonGame.Verify(x => x.JoinRoom(It.IsAny <string>(), It.IsAny <string>()), Times.Never); }