示例#1
0
        public void AddGame(Game game)
        {
            this.GamesPlayed.Add(game);
            ScoreCalculation scoreCalculation = new ScoreCalculation(game);

            this.AddScore(scoreCalculation.CalculateHomeTeamScore());
            this.AddScore(scoreCalculation.CalculateGuestTeamScore());
        }
示例#2
0
        public void AddGame(Game game)
        {
            this.GamesPlayed++;
            ScoreCalculation scoreCalculation = new ScoreCalculation(game);
            Score            homeScore        = scoreCalculation.CalculateHomeTeamScore();
            Score            guestScore       = scoreCalculation.CalculateGuestTeamScore();

            this.GoalsScored      = this.GoalsScored + homeScore.Goals + guestScore.Goals;
            this.HomeGoalsScored  = this.HomeGoalsScored + homeScore.Goals;
            this.GuestGoalsScored = this.GuestGoalsScored + guestScore.Goals;
            this.HomePoints       = this.HomePoints + homeScore.Points;
            this.GuestPoints      = this.GuestPoints + guestScore.Points;

            switch (homeScore.Result)
            {
            case EScoreResult.Loss:
                this.GuestWins++;
                this.GamesDecidedInNormalTime++;
                break;

            case EScoreResult.OTLoss:
                this.GuestWins++;
                this.GamesDecidedInOverTime++;
                break;

            case EScoreResult.PSLoss:
                this.GuestWins++;
                this.GamesDecidedInPenaltyShots++;
                break;

            case EScoreResult.Win:
                this.HomeWins++;
                this.GamesDecidedInNormalTime++;
                break;

            case EScoreResult.OTWin:
                this.HomeWins++;
                this.GamesDecidedInOverTime++;
                break;

            case EScoreResult.PSWin:
                this.HomeWins++;
                this.GamesDecidedInPenaltyShots++;
                break;
            }

            this.Completion = SeasonStatistics.CalculateRelativeValue(this.GamesPlayed, SeasonStatistics.NumberOfGamesPerSeason, 2) * 100;
            this.GamesDecidedInNormalTimePercent   = SeasonStatistics.CalculateRelativeValue(this.GamesDecidedInNormalTime, this.GamesPlayed, 2) * 100;
            this.GamesDecidedInOverTimePercent     = SeasonStatistics.CalculateRelativeValue(this.GamesDecidedInOverTime, this.GamesPlayed, 2) * 100;
            this.GamesDecidedInPenaltyShotsPercent = SeasonStatistics.CalculateRelativeValue(this.GamesDecidedInPenaltyShots, this.GamesPlayed, 2) * 100;
            this.HomeWinsPercent         = SeasonStatistics.CalculateRelativeValue(this.HomeWins, this.GamesPlayed, 2) * 100;
            this.GuestWinsPercent        = SeasonStatistics.CalculateRelativeValue(this.GuestWins, this.GamesPlayed, 2) * 100;
            this.GoalsScoredPerGame      = SeasonStatistics.CalculateRelativeValue(this.GoalsScored, this.GamesPlayed, 1);
            this.HomePointsPerGame       = SeasonStatistics.CalculateRelativeValue(this.HomePoints, this.GamesPlayed, 1);
            this.GuestPointsPerGame      = SeasonStatistics.CalculateRelativeValue(this.GuestPoints, this.GamesPlayed, 1);
            this.HomeGoalsScoredPerGame  = SeasonStatistics.CalculateRelativeValue(this.HomeGoalsScored, this.GamesPlayed, 1);
            this.GuestGoalsScoredPerGame = SeasonStatistics.CalculateRelativeValue(this.GuestGoalsScored, this.GamesPlayed, 1);
        }