public override void OnServerDisconnect(NetworkConnection conn)
    {
        base.OnServerDisconnect(conn);

        if (!this.isSinglePlayer)
        {
            MapMP mpMap = (MapMP)this.map;

            //TODO use the method in Map to get the connected player.
            for (int i = this.map.allPlayers.Count - 1; i >= 0; i--)
            {
                ConnectedPlayer connectedPlayer = this.map.allPlayers[i];
                if (connectedPlayer.getConnection().connectionId == conn.connectionId)
                {
                    mpMap.allPlayers.RemoveAt(i);
                    mpMap.savePlayer(connectedPlayer);
                    mpMap.availibleTeams.freeTeam(connectedPlayer.getTeam());
                    return;
                }
            }
        }
    }
예제 #2
0
 public void savePlayer(ConnectedPlayer cPlayer)
 {
     Logger.log("Saving Player for team " + cPlayer.getTeam().getTeamName() + " to disk...");
     this.gameSaver.savePlayerToFile(cPlayer.getPlayer());
 }