Esempio n. 1
0
        public PlayerListDisplay GetAllPlayers(int?teamId = null)
        {
            var playerInfo = new PlayerListDisplay();

            if (teamId == null)
            {
                playerInfo.PlayerList = GetAllPlayersInGame().ToList();
            }
            else
            {
                playerInfo.PlayerList = GetTeamSquad(teamId.Value).ToList();
            }
            switch (teamId)
            {
            case 0:
                playerInfo.DisplayType = PlayerListDisplayTypeEnum.TransferMarket;
                break;

            case null:
                playerInfo.DisplayType = PlayerListDisplayTypeEnum.AllPlayers;
                break;

            default:
                playerInfo.DisplayType = teamId == GameCache.ManagedTeamId ?
                                         PlayerListDisplayTypeEnum.MySquad :
                                         PlayerListDisplayTypeEnum.OtherSquad;
                break;
            }
            if (playerInfo.DisplayType == PlayerListDisplayTypeEnum.AllPlayers)
            {
                playerInfo.TeamFormationId = 0;
                playerInfo.TeamFormation   = "";
                playerInfo.TeamName        = "";
            }
            else
            {
                if (playerInfo.DisplayType != PlayerListDisplayTypeEnum.TransferMarket)
                {
                    var team = _teamService.Get(teamId.Value);
                    playerInfo.TeamFormationId = team.FormationId;
                    playerInfo.TeamFormation   = GameCache.Formations.FormationList.First(f => f.Id == team.FormationId).Name;
                    playerInfo.TeamName        = team.Name;
                }
            }

            playerInfo.IsPostSeason = GameCache.CurrentWeek == 23;
            playerInfo.IsPreSeason  = GameCache.CurrentWeek == 0;

            return(playerInfo);
        }
Esempio n. 2
0
    void Setup()
    {
        if (hasAuthority)
        {
            PlayerName = Game.Manager.localPlayerName;
            PlayerList = GameObject.Find("Player List").GetComponent <PlayerListDisplay> ();

            NetMgr.LocalPlayer   = this;
            this.gameObject.name = "Local Player";
            this.PlayerID        = (short)this.netId.Value;
            this.isPlayer        = this.isLocalPlayer;
        }

        if (!hasAuthority)
        {
            this.enabled = false;
        }
    }