示例#1
0
        public static void Clear()
        {
            Player[] removedPlayers = players_.ToArray();

            players_.Clear();

            foreach (Player player in removedPlayers)
            {
                OnPlayerRemoved.Invoke(player);
            }
        }
示例#2
0
        public static void RemovePlayer(string name)
        {
            GetInstance();

            if (instance.players.ContainsKey(name))
            {
                Player aPlayer = instance.players[name];
                instance.players.Remove(name);
                OnPlayerRemoved?.Invoke(aPlayer);
            }
        }
示例#3
0
 public bool RemovePlayer(PinouPlayer player)
 {
     if (player != null)
     {
         player.Destroy();
         _players.Remove(player);
         OnPlayerRemoved.Invoke(player);
         return(true);
     }
     return(false);
 }
        /// <summary>
        /// Удалить игрока из игры
        /// </summary>
        /// <param name="parPlayerId">Данные об удаляемом игроке</param>
        public void RemovePlayer(string parPlayerId)
        {
            MPlayer foundPlayer = _players.FirstOrDefault(parX => parX.PlayerId == parPlayerId);

            if (foundPlayer == null)
            {
                return;
            }

            _players.Remove(foundPlayer);
            OnPlayerRemoved?.Invoke(foundPlayer);
        }
        private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
        {
            var currentLength = Game1.otherFarmers.Count;

            if (currentLength > _prevLength)
            {
                _monitor.VerboseLog("Player added");
                OnPlayerAdded?.Invoke();
                _prevLength = currentLength;
            }
            else if (currentLength < _prevLength)
            {
                _monitor.VerboseLog("Player removed");
                OnPlayerRemoved?.Invoke();
                _prevLength = currentLength;
            }
        }
示例#6
0
 public void RemovePlayer(int playerIndex)
 {
     if (activePlayers.Count > playerIndex)
     {
         var psData = activePlayers[playerIndex];
         activePlayers.RemoveAt(playerIndex);
         OnPlayerRemoved?.Invoke(psData);
         for (int i = playerIndex; i < maxNumberOfPlayers; i++)
         {
             if (i < activePlayers.Count && activePlayers[i] != null)
             {
                 PlayerSessionData pData = activePlayers[i];
                 pData.playerIndex = i;
                 OnPlayerChangedIndex?.Invoke(pData, i + 1);
             }
         }
     }
 }
示例#7
0
 /// <summary>
 /// Deregisters a player from this dict.
 /// </summary>
 /// <param name="player">The player to be removed.</param>
 public void DeRegister(Player player)
 {
     Players.Remove(player);
     OnPlayerRemoved?.Invoke(player);
 }
示例#8
0
 public static void Remove(Player player)
 {
     players_.Remove(player);
     OnPlayerRemoved.Invoke(player);
 }