コード例 #1
0
ファイル: UIHand.cs プロジェクト: ArshartCloud/LowStone
        /// <summary>
        /// Add the transform of card to hand.
        /// Adjust the position of all hand cards.
        /// </summary>
        /// <param name="go"></param>
        public override void Add(UICard card)
        {
            Assert.IsTrue(Hands.Count < MAXSIZE);

            //UICard card = go.GetComponent<UICard>();
            GameObject go = card.gameObject;

            Hands.Add(card);
            int firstInd = GetFirstCardIndex();

            if (count % 2 == 1)
            {
                MultiAnimation moves = new MultiAnimation();
                for (int i = 0; i < count; ++i)
                {
                    Transform   targetPos = CardPos[firstInd + i];
                    LSAnimation move      = AnimationFactory.Instance.CreatMove(Hands[i].gameObject, targetPos);
                    go.transform.SetParent(transform);
                    moves.Add(move);
                }
                AnimationManager.Instance.AddAnimation(moves);
            }
            Transform   targetPos2 = CardPos[firstInd + count - 1];
            LSAnimation move2      = AnimationFactory.Instance.CreatMove(go, targetPos2);

            go.transform.SetParent(transform);
            AnimationManager.Instance.AddAnimation(move2);
        }
コード例 #2
0
ファイル: PokerGame.cs プロジェクト: PerFrost/P2Projekt
 public void NewHand()
 {
     _dealerButtonPosition = ++_dealerButtonPosition % Settings.NumberOfPlayers;     // Separate function?
     Hands.Add(new Hand(Players, _dealerButtonPosition));
     PayBlinds();
     _handInProgress = true;
 }
コード例 #3
0
    /// <summary>
    /// カードを1枚引く。
    /// </summary>
    /// <param name="card"></param>
    public void DrawCard(Card card)
    {
        if (card.Number == 1)
        {
            AddAce();
        }

        deck.DealCardAnime(card, this, false);
        TotalPoint += Mathf.Min(card.Number, 10);
        Hands.Add(card);
    }
コード例 #4
0
ファイル: Game.cs プロジェクト: Cannonbait/Blackjack
        public Game(Game game)
        {
            Dealer = new Hand(game.Dealer);

            foreach (Hand hand in game.Hands)
            {
                Hands.Add(new Hand(hand));
            }
            Deck     = new Deck(game.Deck);
            this.Rng = game.Rng;
        }
コード例 #5
0
    /// <summary>
    /// 裏向きでカードを引く。
    /// </summary>
    /// <param name="card"></param>
    private void DrawCardSecret(Card card)
    {
        if (card.Number == 1)
        {
            AddAce();
        }

        hiddenCard  = deck.DealCardAnime(card, this, true);
        TotalPoint += Mathf.Min(card.Number, 10);
        Hands.Add(card);
    }
コード例 #6
0
        private void Split(int currentHand)
        {
            Hand newHand = new Hand(Hands[currentHand].Bet);

            newHand.Cards = new List <Card>();
            newHand.Cards.Add(Hands[currentHand].Cards[0]);

            Hands.Remove(Hands[currentHand]);

            Hands.Add(newHand);
            Hands.Add((Hand)newHand.Clone());
        }
コード例 #7
0
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Location);
                Hands.Add(newHand);
            }

            ActiveHand = state.ActiveHand;

            HandsModified();
        }
コード例 #8
0
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Enabled, handState.Location);
                Hands.Add(newHand);
            }
            ActiveHand = state.ActiveHand;

            UpdateHandContainers();
            UpdateHandVisualizer();
            UpdateHandsGuiState();
        }
コード例 #9
0
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Location);
                Hands.Add(newHand);
            }

            ActiveHand = state.ActiveHand;

            UpdateHandContainers();
            UpdateHandVisualizer();
            Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage {
                Hands = this
            });
        }
コード例 #10
0
ファイル: Game.cs プロジェクト: Cannonbait/Blackjack
 public Game(Random rng)
 {
     this.Rng = rng;
     Deck     = new Deck(Rng);
     Hands.Add(new Hand());
 }