/// <summary> /// Gets called when the game has been started and player have been notified. /// </summary> protected virtual void OnGameStarted() { // add all currently active players ot the EverActive list lock (AllPlayersSyncRoot) { foreach (ICharacterInfo ci in AllPlayers) { EverActivePlayers.Remove(ci.ID); EverActivePlayers.Add(ci.ID, ci); } } SendMatchChangeNotificationToPlayers(MatchNotificationType.MatchStarted, null, "", false); }
/// <summary> /// Adds a player to the active Players list /// </summary> /// <param name="character">the character to add</param> /// <returns></returns> public virtual bool AddPlayer(ServerCharacterInfo character, ref string msg) { lock (m_Game.AllPlayersSyncRoot) { if (Players.ContainsKey(character.ID) || !CanAddPlayer(character, ref msg)) { return(false); } if (CurrentGameState == GameState.Started) { // player was adde after game started. add to active list EverActivePlayers.Remove(character.ID); EverActivePlayers.Add(character.ID, character); } Players.Add(character.ID, character); character.SetCurrentGame(this); AllPlayers = (List <ICharacterInfo>)Players.Values.ToList <ICharacterInfo>(); OnPlayerAdded(character); } return(true); }