コード例 #1
0
 public static void refreshLobbyList()
 {
     availableLobbies.Clear();
     middleViewController.Data.Clear();
     try
     {
         Dictionary <ulong, LobbyInfo> lobbies = SteamAPI.LobbyData;
         foreach (KeyValuePair <ulong, LobbyInfo> entry in lobbies)
         {
             LobbyInfo info = SteamAPI.LobbyData[entry.Key];
             availableLobbies.Add(entry.Key, info.Joinable);
             middleViewController.Data.Add(new CustomCellInfo($"{(info.Joinable && info.TotalSlots - info.UsedSlots > 0 ? "":"[LOCKED]")}[{info.UsedSlots}/{info.TotalSlots}] {info.HostName}'s Lobby", $"{info.Status}"));
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
     middleViewController._customListTableView.ReloadData();
     middleViewController._customListTableView.ScrollToRow(0, false);
     middleViewController.DidSelectRowEvent = (TableView view, int row) =>
     {
         ulong     clickedID = availableLobbies.Keys.ToArray()[row];
         LobbyInfo info      = SteamAPI.LobbyData[clickedID];
         if (clickedID != 0 && availableLobbies.Values.ToArray()[row] && info.TotalSlots - info.UsedSlots > 0)
         {
             Scoreboard.Instance.UpsertScoreboardEntry(Controllers.PlayerController.Instance._playerInfo.playerId, Controllers.PlayerController.Instance._playerInfo.playerName);
             Instance.Dismiss();
             MultiplayerLobby.Instance.Present();
             SteamAPI.JoinLobby(new CSteamID(clickedID));
         }
     };
     if (refresh)
     {
         refresh.interactable = true;
     }
 }
コード例 #2
0
 private void OnGameLobbyJoinRequested(GameLobbyJoinRequested_t pCallback)
 {
     Logger.Debug($"Attempting to join {pCallback.m_steamIDFriend}'s lobby @ {pCallback.m_steamIDLobby}");
     SteamAPI.JoinLobby(pCallback.m_steamIDLobby);
 }