public override void OnGUI() { if (this.listingMatches == false && (Time.time - this.lastMatchListingTime) > 5) { this.UpdateMatchList(); } if (this.matches != null) { if (this.matches.Count == 0) { GUILayout.Label("No games currently hosted, you should create one!"); } else { foreach (MatchDesc match in this.matches) { GUILayout.Label(match.name); if (GUILayout.Button("Join")) { WaitForJoinGameState waitForJoinGameState = new WaitForJoinGameState(this.networkManager, this.networkMatch); this.networkMatch.JoinMatch(match.networkId, "", waitForJoinGameState.OnJoinMatch); this.nextState = waitForJoinGameState; } } } } GUILayout.Label(this.errorMessage); int maxLength = 32; this.gameName = GUILayout.TextField(this.gameName, maxLength); if (GUILayout.Button("Create Game")) { CreateMatchRequest createMatchRequest = new CreateMatchRequest(); createMatchRequest.name = this.gameName; createMatchRequest.size = 3; createMatchRequest.advertise = true; createMatchRequest.password = ""; WaitForCreateGameState waitForCreateGameState = new WaitForCreateGameState(this.networkManager, this.networkMatch); this.networkMatch.CreateMatch(createMatchRequest, waitForCreateGameState.OnCreateMatch); this.nextState = waitForCreateGameState; } }
public override void OnGUI() { if (this.listingMatches == false && (Time.time - this.lastMatchListingTime) > 5) { this.UpdateMatchList(); } if (this.matches != null) { if (this.matches.Count == 0) { GUILayout.Label("No games currently hosted, you should create one!"); } else { foreach (MatchDesc match in this.matches) { GUILayout.Label(match.name); if (GUILayout.Button("Join")) { WaitForJoinGameState waitForJoinGameState = new WaitForJoinGameState(this.networkManager, this.networkMatch); this.networkMatch.JoinMatch(match.networkId, "", waitForJoinGameState.OnJoinMatch); this.nextState = waitForJoinGameState; } } } } GUILayout.Label(this.errorMessage); int maxLength = 32; this.gameName = GUILayout.TextField(this.gameName, maxLength); if(GUILayout.Button("Create Game")) { CreateMatchRequest createMatchRequest = new CreateMatchRequest(); createMatchRequest.name = this.gameName; createMatchRequest.size = 3; createMatchRequest.advertise = true; createMatchRequest.password = ""; WaitForCreateGameState waitForCreateGameState = new WaitForCreateGameState(this.networkManager, this.networkMatch); this.networkMatch.CreateMatch(createMatchRequest, waitForCreateGameState.OnCreateMatch); this.nextState = waitForCreateGameState; } }