コード例 #1
0
ファイル: PlayerValues.cs プロジェクト: Middlederg/Splendor
        public void SetInfo(Player player)
        {
            NameLabel.Text      = player.ToString();
            NameLabel.BackColor = CloseButton.BackColor = player.Color.StrongColor;
            int i = 0;

            foreach (var gem in Gems.GetAllGems())
            {
                ResourceControls().ElementAt(i).Developments = player.GetDevelopmentsOfType(gem);
                ResourceControls().ElementAt(i).Gems         = player.GemsOfType(gem);
                i++;
            }

            PrestigeLabel.Text = ((int)player.Prestige).ToString();

            NoblesButton.Text = player.VisitedNobles.Count().ToString();
            NoblesButton.FlatAppearance.MouseOverBackColor = player.Color.SoftColor.Darken(10);
            NoblesButton.Visible = player.VisitedNobles.Any();
            NoblesButton.Tag     = player.VisitedNobles;

            ReservesButton.Text    = player.ReservedDevelopments.Count().ToString();
            ReservesButton.Visible = player.ReservedDevelopments.Any();

            GoldCounter.Gems    = player.GemsOfType(Gems.Gold);
            GoldCounter.Visible = player.GemsOfType(Gems.Gold).Any();

            TotalGemsButton.Text = $"{player.TotalGems().ToString()}/10";
        }
コード例 #2
0
ファイル: MarketTests.cs プロジェクト: Middlederg/Splendor
 private void CheckMarket(Market market, int[] values, int gold)
 {
     foreach (var gem in Gems.GetAllGems())
     {
         market.AvaliableOfType(gem).Should().Be(values[gem.Id - 1]);
         market.AvaliableGold().Should().Be(gold);
     }
 }
コード例 #3
0
        public GemsServiceTests()
        {
            game = new Game(Prestige.FromScalar(15),
                            (Avatars.Danilo, ColorFactory.DefaultBlue),
                            (Avatars.Debra, ColorFactory.Gray));

            foreach (var gem in Gems.GetAllGems())
            {
                Take(gem.Get(2).ToArray());
            }
            //Take(new Gem[3] { Gems.Diamond, Gems.Ruby, Gems.Onyx });
            //Take(new Gem[3] { Gems.Diamond, Gems.Ruby, Gems.Onyx });
        }
コード例 #4
0
        public void Development_requirements_should_be_compensated()
        {
            var list = new List <(Gem gem, int count)>();

            foreach (var gem in Gems.GetAllGems())
            {
                int count = 0;
                foreach (var item in deck)
                {
                    count += item.TotalGemsOfType(gem);
                }
                list.Add((gem, count));
            }

            list.Select(x => x.count).Distinct().Count().Should().Be(1);
        }
コード例 #5
0
ファイル: MarketTests.cs プロジェクト: Middlederg/Splendor
        public void Should_contain_gems()
        {
            foreach (var gem in Gems.GetAllGems())
            {
                simpleMarket.AvaliableOfType(gem).Should().Be(2);
                simpleMarket.CanBeTakenTwoOfType(gem).Should().BeFalse();

                completeMarket.AvaliableOfType(gem).Should().Be(7);
                completeMarket.CanBeTakenTwoOfType(gem).Should().BeTrue();
            }

            simpleMarket.AvaliableOfType(Gems.Gold).Should().Be(1);
            completeMarket.AvaliableOfType(Gems.Gold).Should().Be(5);

            simpleMarket.CanBeTakenTwoOfType(Gems.Gold).Should().BeFalse();
            completeMarket.CanBeTakenTwoOfType(Gems.Gold).Should().BeFalse();
        }
コード例 #6
0
ファイル: NobleTests.cs プロジェクト: Middlederg/Splendor
        public void Noble_requirements_should_be_compensated()
        {
            var nobles = Nobles.GetNobles();

            var list = new List <(Gem gem, int count)>();

            foreach (var gem in Gems.GetAllGems())
            {
                int count = 0;
                foreach (var noble in nobles)
                {
                    count += noble.RequiredQuantity(gem);
                }
                list.Add((gem, count));
            }

            list.Select(x => x.count).Distinct().Count().Should().Be(1);
        }