Example #1
0
        private static void UpdateBlackTeamStats(GameResult result)
        {
            if (result.WinType != WinType.Forfeit)
            {
                _blackTeamStats.WinCount++;
                _blackTeamStats.Player = result.Player;
            }

            _blackTeamStats = _blackTeamStats.AddCorrectWinType(result.WinType);
        }
        void BuildView()
        {
            TeamStats redTeamStats   = ScoreKeeper.GetRedTeamStats();
            TeamStats blackTeamStats = ScoreKeeper.GetBlackTeamStats();

            RedTeamWinCount.text         = BuildWinCountDisplay(redTeamStats);
            BlackTeamWinCount.text       = BuildWinCountDisplay(blackTeamStats);
            RedTeamWintypeDisplay.text   = BuildWinTypeDisplay(redTeamStats);
            BlackTeamWinTypeDisplay.text = BuildWinTypeDisplay(blackTeamStats);
            RedTeamPlayedByText.text     = BuildPlayedByText(redTeamStats);
            BlackTeamPlayedByText.text   = BuildPlayedByText(blackTeamStats);
        }
        string BuildPlayedByText(TeamStats stats)
        {
            string playedByText = "";

            if (stats.Player != null)
            {
                playedByText = $"Played by:   {stats.Player.GetName()}";
            }
            else
            {
                playedByText = "Played by:";
            }
            return(playedByText);
        }
Example #4
0
        private static TeamStats AddCorrectWinType(this TeamStats stats, WinType type)
        {
            switch (type)
            {
            case WinType.Diagonal:
                stats.DiagonalWins++;
                break;

            case WinType.Horizontal:
                stats.HorizontalWins++;
                break;

            case WinType.Vertical:
                stats.VerticalWins++;
                break;

            case WinType.Forfeit:
                stats.Forfeits++;
                break;
            }
            return(stats);
        }
        string BuildWinTypeDisplay(TeamStats stats)
        {
            string wintypeDisplay = $" Horizontal Wins -- {stats.HorizontalWins} \n Vertical Wins -- {stats.VerticalWins} \n Diagonal Wins -- {stats.DiagonalWins} \n Forfeitures {stats.Forfeits}";

            return(wintypeDisplay);
        }
        string BuildWinCountDisplay(TeamStats stats)
        {
            string winCountMessage = $"Wins -- {stats.WinCount}";

            return(winCountMessage);
        }