Ejemplo n.º 1
0
 private void CardClickHandler(CardUI card)
 {
     if (OnPlayerCardThrow != null)
     {
         OnPlayerCardThrow(new Card { CardSuit = card.CardSuit, CardType = card.CardType });
     }
 }
Ejemplo n.º 2
0
        private void CalculateSpriteState_Player(CardUI ui, out Vector2 position, out Texture2D texture, out float rotation, out float zIndex)
        {
            var blockWidth = (_countPlayerCards - 1) * MaxCardOffset + _countPlayerCards * CurrentGameCardWidth;
            var cardsSpace = WindowWidth - 2 * HorizontalWindowPadding;
            var y = VerticalWindowPadding + 2 * CurrentGameCardHeight + DescTopOffset + DescVerticalCardOffset + DescBottomOffset;
            var x = HorizontalWindowPadding;

            if (blockWidth < cardsSpace)
            {
                x = (WindowWidth - blockWidth) / 2 + ui.Index * (CurrentGameCardWidth + MaxCardOffset);
            }
            else
            {
                var cardOffset = MaxCardOffset - (blockWidth - cardsSpace) / (_countPlayerCards - 1);
                x = HorizontalWindowPadding + ui.Index * (CurrentGameCardWidth + cardOffset);
            }

            position = new Vector2(x, y);
            texture = _spriteList;
            rotation = 0;
            zIndex = PlayerCardsMinZIndex + ui.Index * ((PlayerCardsMaxZIndex - PlayerCardsMinZIndex) / _countPlayerCards);
        }
Ejemplo n.º 3
0
 private void CalculateSpriteState_OutOfDesc(CardUI ui, out Vector2 position, out Texture2D texture, out float rotation, out float zIndex)
 {
     var x = -1 * CurrentGameCardWidth - 10;
     var y = VerticalWindowPadding + CurrentGameCardHeight + DescTopOffset;
     position = new Vector2(x, y);
     texture = _backSprite;
     rotation = 0;
     zIndex = 0;
 }
Ejemplo n.º 4
0
        private void CalculateSpriteState_Desc(CardUI ui, out Vector2 position, out Texture2D texture, out float rotation, out float zIndex)
        {
            var y = VerticalWindowPadding + CurrentGameCardHeight + DescTopOffset;
            y += ((ui.Index+1) % 2 == 0) ? DescVerticalCardOffset : 0;

            var x = ((ui.Index + 1) % 2 == 0) ? HorizontalWindowPadding + DescHorizintalCardOffset : HorizontalWindowPadding;
            x += ((ui.Index) / 2) * (CurrentGameCardWidth + DescCardOffset);

            position = new Vector2(x, y);
            texture = _spriteList;
            rotation = 0;
            zIndex = ((ui.Index + 1) % 2 == 0) ? DescUpperCardZIndex : DescLowerCardZIndex;
        }
Ejemplo n.º 5
0
        private void CalculateSpriteState_Deck(CardUI ui, out Vector2 position, out Texture2D texture, out float rotation, out float zIndex)
        {
            float x = 0;
            float y = 0;

            if (ui.Index == 0)
            {
                x = WindowWidth - HorizontalWindowPadding - DeckCardsRightOffset;
                y = VerticalWindowPadding + CurrentGameCardHeight + DescTopOffset + TrumpCardTopOffset;
                zIndex = TrumpCardZIndex;
                rotation = MathHelper.Pi/2;
                texture = _spriteList;
            }
            else
            {
                x = WindowWidth - HorizontalWindowPadding - CurrentGameCardWidth - DeckCardsRightOffset + ui.Index * DeckCardOffset;
                y = VerticalWindowPadding + CurrentGameCardHeight + DescTopOffset + ui.Index * DeckCardOffset;
                zIndex = DeckCardsMinZIndex + ui.Index * 0.001f;
                rotation = 0;
                texture = _backSprite;
            }

            position = new Vector2(x, y);
        }
Ejemplo n.º 6
0
 private void CalculateNewSpriteState(CardUI ui, out Vector2 position, out Texture2D texture, out float rotation, out float zIndex)
 {
     switch (ui.CardPosition)
     {
         case CardPosition.Player:
             CalculateSpriteState_Player(ui, out position, out texture, out rotation, out zIndex);
             break;
         case CardPosition.Enemy:
             CalculateSpriteState_Enemy(ui, out position, out texture, out rotation, out zIndex);
             break;
         case CardPosition.Desc:
             CalculateSpriteState_Desc(ui, out position, out texture, out rotation, out zIndex);
             break;
         case CardPosition.Deck:
             CalculateSpriteState_Deck(ui, out position, out texture, out rotation, out zIndex);
             break;
         case CardPosition.OutOfDesc:
             CalculateSpriteState_OutOfDesc(ui, out position, out texture, out rotation, out zIndex);
             break;
         default:
             CalculateSpriteState_OutOfDesc(ui, out position, out texture, out rotation, out zIndex);
             break;
     }
 }