Exemplo n.º 1
0
        private void AddInsuranceChipAnimation(float amount)
        {
            BlackJack21.CardFramework.AnimatedGameComponent chipComponent = new BlackJack21.CardFramework.AnimatedGameComponent(cardGame, blankChip)
            {
                TextColor = Color.Black,
                Enabled   = true,
                Visible   = false
            };
            Game.Components.Add(chipComponent);

            chipComponent.AddAnimation(new BlackJack21.CardFramework.TransitionGameComponentAnimation(positions[0], new Vector2(GraphicsDevice.Viewport.Width / 2, insurancePosition))
            {
                PerformBeforeStart   = ShowComponent,
                PerformBeforSartArgs = chipComponent,
                PerformWhenDone      = ShowChipAmountAndPlayBetSound,
                PerformWhenDoneArgs  = new object[] { chipComponent, amount },
                Duration             = TimeSpan.FromSeconds(1),
                StartTime            = DateTime.Now
            });

            chipComponent.AddAnimation(new BlackJack21.CardFramework.FlipGameComponentAnimation()
            {
                Duration        = TimeSpan.FromSeconds(1f),
                AnimationCycles = 3
            });
        }
Exemplo n.º 2
0
        public void AddChip(int playerIndex, int chipValue, bool secondHand)
        {
            if (((CardsGame.Players.BlackjackPlayer)players[playerIndex]).Bet(chipValue))
            {
                currentBet += chipValue;

                BlackJack21.CardFramework.AnimatedGameComponent chipComponent = new BlackJack21.CardFramework.AnimatedGameComponent(cardGame, chipAssets[chipValue])
                {
                    Visible = false
                };
                Game.Components.Add(chipComponent);

                Vector2 position;
                position = cardGame.GameTable[playerIndex] + ChipOffset + new Vector2(-currentChipComponent.Count * 2, currentChipComponent.Count * 1);

                int currentChipIndex = 0;
                for (int chipIndex = 0; chipIndex < chipAssets.Count; chipIndex++)
                {
                    if (assetNames[chipIndex] == chipValue)
                    {
                        currentChipIndex = chipIndex;
                        break;
                    }
                }

                chipComponent.AddAnimation(new BlackJack21.CardFramework.TransitionGameComponentAnimation(positions[currentChipIndex], position)
                {
                    Duration             = TimeSpan.FromSeconds(1f),
                    PerformBeforeStart   = ShowComponent,
                    PerformBeforSartArgs = chipComponent,
                    PerformWhenDone      = PlayBetSound
                });

                chipComponent.AddAnimation(new BlackJack21.CardFramework.FlipGameComponentAnimation()
                {
                    Duration        = TimeSpan.FromSeconds(1f),
                    AnimationCycles = 3
                });
            }
        }