Beispiel #1
0
        public void HistoryCardDealt(RawCard card, Player player)
        {
            Card cardToAdd = new Card(card);

            cardToAdd.Raw.Player = player.ID;
            cardsInHands.addCard(cardToAdd);

            if (playingLastRound)
            {
                if (cardsInHands.getCards().Contains(cardToAdd))
                {
                    UltraServer.Instance.network.SendCard(card, player);
                }
            }
        }
Beispiel #2
0
        public override void update(GameTime gameTime)
        {
            base.update(gameTime);

            // Handle touches
            foreach (GestureSample gesture in GestureManager.Gestures)
            {
                switch (gesture.GestureType)
                {
                case GestureType.FreeDrag:
                {
                    if (dragTarget == null)
                    {
                        dragTarget = hand.getTopmostHit(gesture.Position);
                        if (dragTarget == null)
                        {
                            break;
                        }

                        dragTarget.halt();
                        dragTarget.Glow = true;
                        dragTarget.translate(gesture.Position - dragTarget.Position);
                        hand.bringToTop(dragTarget);
                    }
                    dragTarget.translate(gesture.Delta);
                    break;
                }

                case GestureType.DragComplete:
                {
                    if (dragTarget != null)
                    {
                        if (dropZone.checkForHit(lastGesture.Position))
                        {
                            dropZone.drop(dragTarget);
                        }
                        dragTarget.Glow = false;
                        hand.sort();
                        dragTarget = null;
                    }
                    break;
                }

                default:
                    break;
                }
                lastGesture = gesture;
            }

            // Move Cards
            if (dragTarget != null)
            {
                dragTarget.scaleTo(ScaleManager.CardScale * 1.2f, 10f);
            }

            List <Card> snapCards = new List <Card>(hand.getCards());

            if (dragTarget != null)
            {
                snapCards.Remove(dragTarget);
            }

            handSnap.arrange(snapCards);

            foreach (Card card in hand.getCards())
            {
                try { card.update(gameTime); } catch { }
            }
            table.update(gameTime);
        }