コード例 #1
0
    // -----------------------------------------------------------------------------------
    // updatePlayerParty
    // Checks if there are still players of <Party> around and updates the group list
    // -----------------------------------------------------------------------------------
    protected void updatePlayerParty(Player player, bool remove = false)
    {
        if (!player.InParty())
        {
            return;
        }

        int count = 0;

        foreach (Player plyr in players)
        {
            if (plyr.InParty() && plyr.party.members[0] == player.party.members[0])
            {
                count++;
            }
        }

        if (count == 0)
        {
            if (remove)
            {
                groupNames.Remove(player.party.members[0]);
            }
            else
            {
                groupNames.Add(player.party.members[0]);
            }
        }
    }
コード例 #2
0
    private void RpcPlayersFree()
    {
        // Se guarda en una variable los jugadores que hay en el mapa.
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");

        // Recorre cada jugador del vector de jugadores....
        foreach (GameObject player in players)
        {
            // Lee las variables isSending y isBusy de cada jugador... si es un jugador en modo activo, se añade a la lista.
            if (player.GetComponent <PlayerCode>().IsSending() && !player.GetComponent <PlayerCode>().IsBusy())
            {
                if (!playerFree.Contains(player.GetComponent <PlayerCode>().GetName()))
                {
                    // Se añade a la lista....
                    playerFree.Add(player.GetComponent <PlayerCode>().GetName());
                }
            }
            else
            // Lee las variables isSending y isBusy de cada jugador... si es un jugador en modo ocupado o desocupado, se elimina de la lista.
            {
                if (playerFree.Contains(player.GetComponent <PlayerCode>().GetName()))
                {
                    // Se elimina de la lista....
                    playerFree.Remove(player.GetComponent <PlayerCode>().GetName());
                }
            }
        }
    }
コード例 #3
0
ファイル: PlayerList.cs プロジェクト: kevinl95/unitystation
 public void RemovePlayer(string playerName)
 {
     if (connectedPlayers.ContainsKey(playerName))
     {
         connectedPlayers.Remove(playerName);
         nameList.Remove(playerName);
     }
 }
コード例 #4
0
ファイル: PlayerHub.cs プロジェクト: Glaze96/INO
    /// <summary>
    /// Removes player from the playerlist
    /// </summary>
    /// <param Connection ID of the PLayer="connectionId"></param>
    public void RemovePlayer(int idNumber)
    {
        Player player = GetPlayer(idNumber);

        // Add name back into pool
        _namePool.Add(player.Id.Name);
        _activeIdNumbers.Remove(idNumber);

        // If found player, remove it
        if (_playerUserIdList.Contains(player.Id.FullId))
        {
            _playerUserIdList.Remove(player.Id.FullId);
        }
        else
        {
            Debug.LogError("HUB - TRYING TO REMOVE, BUT CANNOT FIND: " + player.Id.FullId);
        }

        Debug.Log("HUB - FOUND AND REMOVED: " + player.Id.FullId);
    }
コード例 #5
0
    public void PlayerDisconnected(Player player, string _matchID)
    {
        for (int i = 0; i < matches.Count; i++)
        {
            if (matches[i].matchID == _matchID)
            {
                int playerIndex = matches[i].players.IndexOf(player.gameObject);
                matches[i].players.RemoveAt(playerIndex);
                Debug.Log($"Player disconnected from match {_matchID} | {matches[i].players.Count} players remaining");

                if (matches[i].players.Count == 0)
                {
                    Debug.Log($"No more players in Match. Terminating {_matchID}");
                    matches.RemoveAt(i);
                    matchIDs.Remove(_matchID);
                }
                break;
            }
        }
    }
コード例 #6
0
 public void PlayerDisconnected(PlayerNetwork player, string _matchID)
 {
     for (int i = 0; i < matches.Count; i++)
     {
         if (matches[i].matchID == _matchID)
         {
             int playerIndex = matches[i].players.IndexOf(player.gameObject);
             matches[i].players.RemoveAt(playerIndex);
             roomListManager.FillList(matches[i].players.ToArray(), matches[i].matchID);
             Debug.Log($"Player disconnected from match {_matchID} | {matches[i].players.Count} players remaining");
             /* player.currentMatch = new Match(); */
             if (matches[i].players.Count == 0)
             {
                 Debug.Log($"No more players in Match. Terminating {_matchID}");
                 matches.RemoveAt(i);
                 matchIDs.Remove(_matchID);
                 roomListManager.roomData.RemoveAt(i);
             }
             break;
         }
     }
 }
コード例 #7
0
    //Jos pelaaja disconnectaa pelistä
    public void playerDisconnected(PlayerHostScript player, string _matchId)
    {
        //etsitaan kaikki pelit
        for (int i = 0; i < matches.Count; i++)
        {
            if (matches[i].matchID == _matchId)
            {
                //otetaan pelaajan indexi talteen ja poistetaan pelaaja pelistä sen avulla
                int playerIndex = matches[i].pelaajat.IndexOf(player.gameObject);
                matches[i].pelaajat.RemoveAt(playerIndex);
                Debug.Log($"Pelaaja poistui pelista: {_matchId} | {matches[i].pelaajat.Count} pelaajia jaljella");

                if (matches[i].pelaajat.Count == 0)
                {
                    Debug.Log($"Ei pelaajia jaljella, poistutaan pelista");
                    matches.RemoveAt(i);
                    matchIDs.Remove(_matchId);
                }
                break;
            }
        }
    }
コード例 #8
0
 public void Cmd_UCE_Crafting_unlearnRecipe(string recipeName)
 {
     UCE_recipes.Remove(recipeName);
 }
コード例 #9
0
 public void TestRemove()
 {
     serverSyncList.Remove("World");
     SerializeDeltaTo(serverSyncList, clientSyncList);
     Assert.That(clientSyncList, Is.EquivalentTo(new[] { "Hello", "!" }));
 }
コード例 #10
0
 public void ServerRemovePlayer(GameObject obj)
 {
     m_ConnectedPlayerNames.Remove(obj.name);
 }
コード例 #11
0
 private void CmdRemoveAutorizationList(string l)
 {
     _autorizedNameList.Remove(l);
 }