public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches) { status.text = ""; if (!success || matches == null) { status.text = "Couldn't get lobby list."; return; } foreach (MatchInfoSnapshot match in matches) { GameObject lobbyListItemGO = Instantiate(lobbyListItemPrefab); lobbyListItemGO.transform.SetParent(lobbyListParent); LobbyListItem lobbyListItem = lobbyListItemGO.GetComponent <LobbyListItem>(); if (lobbyListItem != null) { lobbyListItem.Setup(match, JoinRoom); } // as well as setting up a callback function that will join the game. lobbyList.Add(lobbyListItemGO); } if (lobbyList.Count == 0) { status.text = "No rooms at the moment."; } }
private void Row_DoubleClick(object sender, MouseButtonEventArgs e) { DataGridRow row = sender as DataGridRow; LobbyListItem item = row.Item as LobbyListItem; if (int.TryParse(item.ID, out int id)) { Dispatcher?.Invoke(() => ViewController.SetView(new LoadingLobbyView(LobbyType.User, id))); } }
public override void OnServerAddPlayer(NetworkConnection conn) { if (SceneManager.GetActiveScene().name.Equals(menuScene)) { LobbyListItem PlayerInstance = Instantiate(LobbyPlayerPrefab, ParentFolder); PlayerInstance.isLeader = playerListings.Count == 0; NetworkServer.AddPlayerForConnection(conn, PlayerInstance.gameObject); } }