Exemple #1
0
    public void AddLobbyEntry(ClientConnectedPlayer player)
    {
        LobbyEntry lobbyEntry = Instantiate(LobbyEntryPrefab, LobbyEntriesPanel.transform).GetComponent <LobbyEntry>();

        lobbyEntry.Username        = player.Username;
        player.PlayerPingUpdated  += lobbyEntry.OnConnectedPlayerPingUpdated;
        player.PlayerReady        += lobbyEntry.OnConnectedPlayerReadyUpdated;
        player.PlayerDisconnected += lobbyEntry.OnPlayerDisconnected;
    }
Exemple #2
0
 public bool TryUpdate(LobbyEntry entry)
 {
     try {
         return(entries.Update(entry));
     }
     catch {
         return(false);
     }
 }
Exemple #3
0
    public void AddLobbyEntry(Client client)
    {
        LobbyEntry scoreboardEntry = Instantiate(LobbyEntryPrefab, LobbyEntriesPanel.transform).GetComponent <LobbyEntry>();

        scoreboardEntry.Username     = client.Username;
        client.PlayerLatencyUpdated += scoreboardEntry.OnClientLatencyUpdated;
        client.PlayerReadyUpdated   += scoreboardEntry.OnClientReadyUpdated;
        client.PlayerDisconnected   += scoreboardEntry.OnPlayerDisconnected;
    }
Exemple #4
0
 public bool TryRegister(LobbyEntry entry)
 {
     try {
         entries.Insert(new BsonValue(entry.Id), entry);
         return(true);
     }
     catch {
         return(false);
     }
 }
Exemple #5
0
 public bool TryGetById(Guid id, out LobbyEntry entry)
 {
     try {
         entry = entries.FindById(new BsonValue(id));
         return(true);
     }
     catch {
         entry = default;
         return(false);
     }
 }
    void OnPlayerConnect(NetworkPlayer player)
    {
        GameObject entryGameObject = Instantiate(playerEntryPrefab) as GameObject;
        LobbyEntry lobbyEntry      = entryGameObject.GetComponent <LobbyEntry>();

        lobbyEntry.transform.SetParent(transform);

        lobbyEntry.SetPlayer(player);
        lobbyEntry.UpdateEntry();

        lobbyEntries.Add(player, lobbyEntry);
    }
Exemple #7
0
        public IActionResult Register(string guid, string name, string phoneNumber, int partySize, string specialRequests)
        {
            if (Guid.TryParse(guid, out var id) && !string.IsNullOrWhiteSpace(name) && name.Length != 0)
            {
                var entry = new LobbyEntry {
                    Id              = id,
                    Name            = name,
                    PhoneNumber     = phoneNumber,
                    PartySize       = partySize,
                    SpecialRequests = specialRequests?.Trim() ?? string.Empty,
                    CreationTime    = DateTime.UtcNow,
                    Status          = LobbyEntryStatus.Waiting
                };

                _lobbyPad.TryRegister(entry);
            }

            return(RedirectToAction("Index"));
        }
Exemple #8
0
    private void AddLobbyEntry(string lobbyId, LobbyData lobbyData)
    {
        GameObject obj = Instantiate(lobbyEntryPrefab);

        obj.transform.parent = lobbyList.transform;

        LobbyEntry lobbyEntry = obj.GetComponent <LobbyEntry>();

        lobbyEntry.lobbyName.text   = lobbyData.lobbyName;
        lobbyEntry.lobbyStatus.text = lobbyData.lobbyStatus;
        lobbyEntry.playerCount.text = lobbyData.players.Count + "/" + lobbyData.maxPlayers;

        if (lobbyData.lobbyStatus == "Waiting")
        {
            lobbyEntry.OnJoin = () => { OnJoinLobby(lobbyId); };
        }
        else
        {
            lobbyEntry.joinButton.SetActive(false);
        }
    }