Ejemplo n.º 1
0
 public void Initialize(PlayerStanding initialStandingDir)
 {
     WalkingDirection  = null;
     StandingDirection = initialStandingDir;
     PushingDirection  = null;
     SwingingDirection = null;
     CollidedWith      = null;
     PushedFrom        = null;
 }
Ejemplo n.º 2
0
        public void SetStandingFacing(PlayerStanding dir)
        {
            CollidedWith      = null;
            PushedFrom        = null;
            WalkingDirection  = null;
            PushingDirection  = null;
            SwingingDirection = null;

            StandingDirection = dir;
        }
Ejemplo n.º 3
0
        public static List <PlayerStanding> CalculateLeagueStandings(League league)
        {
            List <PlayerStanding> playerStandings = new List <PlayerStanding>();

            foreach (var player in league.Players)
            {
                PlayerStanding playerStanding = new PlayerStanding()
                {
                    FplPlayerId = player.FplPlayerId,
                    Name        = player.Name,
                    TeamName    = player.TeamName,
                    Points      = player.Gameweeks.OrderBy(x => x.Number).Last()
                                  .OverallPoints, // total uten fratrekk for bytter
                    PointsOnBench = player.Gameweeks.Sum(x => x.PointsOnBench),
                    Transfers     = player.Gameweeks.Sum(x => x.Transfers),
                    TransferCosts = player.Gameweeks.Sum(x => x.TransferCosts),
                    PointsTransferCostsExcluded = player.Gameweeks.Sum(x => x.Points), // total med fratrekk for bytter
                    Chips        = player.Gameweeks.Select(x => x.Chip).ToList(),
                    Value        = player.Gameweeks.OrderBy(x => x.Number).Last().Value.GetValueOrDefault(),
                    Rank         = player.Gameweeks.OrderBy(x => x.Number).Last().OverallRank,
                    Cash         = CalculateGameweekWinnerCash(player, league),
                    GameweeksWon = CalculatePlayerGameweekWinners(player, league),
                    CupRounds    = player.Gameweeks.Count(x => x.Cup != null)
                };

                if (playerStanding.Cash != 0)
                {
                    playerStanding.Winnings.Add($"Seiere: {playerStanding.Cash}");
                }

                playerStandings.Add(playerStanding);
            }

            playerStandings = playerStandings.OrderBy(x => x.Points).ToList();

            CalculateCupCash(playerStandings, league);
            CalculateEndOfSeasonCash(playerStandings, league);
            CalculateMostValuableCash(playerStandings, league);

            foreach (var playerStanding in playerStandings)
            {
                playerStanding.Winnings.Add($"Total: {playerStanding.Cash}");
            }

            return(playerStandings);
        }
Ejemplo n.º 4
0
 public StandingViewCellElement(PlayerStanding PlayerStanding, int PlayerRank, bool IsMe)
 {
     this.PlayerStanding = PlayerStanding;
     this.playerRank     = PlayerRank;
     this.IsMe           = IsMe;
 }
Ejemplo n.º 5
0
 public StandingViewCellElement(PlayerStanding playerStanding, int playerRank, bool isMe)
 {
     this.PlayerStanding = playerStanding;
     this.playerRank     = playerRank;
     this.isMe           = isMe;
 }