コード例 #1
0
ファイル: InteractiveRunner.cs プロジェクト: rba100/splendor
        private ConsoleColor ToConsole(TokenColour colour)
        {
            switch (colour)
            {
            case TokenColour.White:
                return(ConsoleColor.White);

            case TokenColour.Blue:
                return(ConsoleColor.Blue);

            case TokenColour.Red:
                return(ConsoleColor.Red);

            case TokenColour.Green:
                return(ConsoleColor.Green);

            case TokenColour.Black:
                return(ConsoleColor.DarkGray);

            case TokenColour.Gold:
                return(ConsoleColor.DarkYellow);

            default: throw new ArgumentOutOfRangeException(nameof(colour));
            }
        }
コード例 #2
0
 public Card(int tier, int victoryPoints, IPool cost, TokenColour givesDiscount)
 {
     Tier          = tier;
     VictoryPoints = victoryPoints;
     Cost          = cost ?? throw new ArgumentNullException(nameof(cost));
     BonusGiven    = givesDiscount;
 }
コード例 #3
0
        public int this[TokenColour index]    // Indexer declaration
        {
            get
            {
                switch (index)
                {
                case TokenColour.Gold:
                    return(Gold);

                case TokenColour.White:
                    return(White);

                case TokenColour.Red:
                    return(Red);

                case TokenColour.Blue:
                    return(Blue);

                case TokenColour.Green:
                    return(Green);

                case TokenColour.Black:
                    return(Black);

                default: throw new ArgumentOutOfRangeException();
                }
            }
            set
            {
                if (value < 0)
                {
                    throw new ArgumentOutOfRangeException();
                }

                switch (index)
                {
                case TokenColour.Gold:
                    Gold = value; break;

                case TokenColour.White:
                    White = value; break;

                case TokenColour.Red:
                    Red = value; break;

                case TokenColour.Blue:
                    Blue = value; break;

                case TokenColour.Green:
                    Green = value; break;

                case TokenColour.Black:
                    Black = value; break;

                default: throw new ArgumentOutOfRangeException();
                }
            }
        }
コード例 #4
0
ファイル: InteractiveRunner.cs プロジェクト: rba100/splendor
        private string FromCoinColour(TokenColour col)
        {
            switch (col)
            {
            case TokenColour.White: return("W");

            case TokenColour.Blue: return("U");

            case TokenColour.Red: return("R");

            case TokenColour.Green: return("G");

            case TokenColour.Black: return("B");

            case TokenColour.Gold: return("$");

            default: throw new ArgumentOutOfRangeException(nameof(col));
            }
        }
コード例 #5
0
        private Card CreateFromStats(TokenColour colour, int tier, int points, int black, int white, int red, int blue, int green)
        {
            var cost = new Pool(0, white, blue, red, green, black);

            return(new Card(tier, points, cost, colour));
        }
コード例 #6
0
ファイル: ExtensionMethods.cs プロジェクト: rba100/splendor
 public static string CardColour(this TokenColour c) => c switch
 {