Example #1
0
    public void PushUnit(CardDisplay cardDisplay, Point position)
    {
        UnitDisplay unitDisplay = cardDisplay.UnitDisplay;

        unitDisplay.transform.DOLocalJump(PointerToIcometric(position, tileWidth, tileHeight), 0.5f, 1, 0.5f);

        this.UpdatePositions(unitDisplay, position);
    }
 public CardSelectionData(CardSelectionData sel)
 {
     type        = sel.type;
     card        = sel.card;
     cardDisplay = sel.cardDisplay;
     place       = sel.place;
     selected    = sel.selected;
 }
Example #3
0
 public void RemoveCard(CardDisplay d)
 {
     if (cards.Contains(d))
     {
         cards.Remove(d);
     }
     Debug.Log("card removed");
 }
    // public Bar bar;

    public CardSelectionData(CardDisplay _card = null, ICard cardData = null, SelectionType _type = null, bool _selected = false, CardPlace _place = null)
    {
        type        = _type;
        card        = cardData;
        cardDisplay = _card;
        place       = _place;
        selected    = _selected;
    }
    public override void Execute(Vector2Int value, int power, CardDisplay cardDisplay)
    {
        DealDamageEvent e = Instantiate(damageEvent, BattleEventManager.Instance.transform);

        e.damage = GetFinalValue(value, power);
        e.target = EnemyArea.Instance.enemy;
        e.from   = PlayerArea.Instance.player;
    }
Example #6
0
 public bool ContainCardAsLast(CardDisplay card)
 {
     if (column.Count > 0 && column[column.Count - 1] == card)
     {
         return(true);
     }
     return(false);
 }
Example #7
0
 public void AddCard(CardDisplay d)
 {
     if (!cards.Contains(d))
     {
         cards.Add(d);
     }
     Debug.Log("card added");
 }
Example #8
0
    public void addMana(int p)
    {
        GameObject  p2C0Atk = GameObject.Find("P2Card " + p);
        CardDisplay a       = p2C0Atk.GetComponent <CardDisplay>();

        GameLevelManager.instance.activeManaCrystalsP2 = GameLevelManager.instance.activeManaCrystalsP2 + a.Amount;
        GameLevelManager.instance.manaTextP2.text      = GameLevelManager.instance.activeManaCrystalsP2.ToString();
    }
Example #9
0
    public CardDisplay CreateCardDisplayForCollection(CardData cardData, CardSlotUI cardSlotUI)
    {
        CardDisplay cardDisplay        = CreateSimpleDisplay(cardData, cardSlotUI);
        CardVisualCollectionUINEW dbUI = cardDisplay.gameObject.AddComponent <CardVisualCollectionUINEW>();

        dbUI.SetSlot(cardSlotUI);
        return(cardDisplay);
    }
Example #10
0
    public bool Contain(CardDisplay card)
    {
        if (deck.Contains(card))
        {
            return(true);
        }

        return(false);
    }
Example #11
0
 protected override void EnteredEvent(Draggable d)
 {
     if (target != null)
     {
         CardDisplay card = d.gameObject.GetComponent <CardDisplay>();
         card.effect.SetTarget(target);
         FSM.singleton.nextTurnButton.interactable = true;
     }
 }
 public void SetData(RibbonData ribbonData, Action <RibbonData> OnRibbonClick, CardDisplay cardDisplay)
 {
     txtName.text       = ribbonData.name;
     txtAmount.text     = ribbonData.amount.ToString();
     this.ribbonData    = ribbonData;
     this.OnRibbonClick = OnRibbonClick;
     this.cardDisplay   = cardDisplay;
     cardRect           = cardDisplay.GetComponent <RectTransform>();
 }
Example #13
0
    public CardDisplay CreateSimpleDisplay(CardData cardData, CardSlotUI cardSlotUI)
    {
        GameObject  cardPrf     = GameObject.Instantiate(cardPrefab, cardSlotUI.GetCardSlotTransform().GetChild(0));
        CardDisplay cardDisplay = cardPrf.GetComponent <CardDisplay>();

        cardDisplay.SetDisplay(cardData);
        cardSlotUI.SetCardDisplay(cardDisplay);
        return(cardDisplay);
    }
Example #14
0
    public CardDisplay CreateCardDisplayForDeckBuilder(CardData cardData, CardSlotUI cardSlotUI, DeckBuilderCreationManager deckBuilderCreationManager, ScrollRect cardScrollRectParent)
    {
        CardDisplay cardDisplay            = CreateSimpleDisplay(cardData, cardSlotUI);
        DeckBuilderCardOnlyClickUINEW dbUI = cardDisplay.gameObject.AddComponent <DeckBuilderCardOnlyClickUINEW>();

        dbUI.SetEvent(deckBuilderCreationManager.OnTryToAddCardToDeck, cardData, cardSlotUI);
        dbUI.SetScrollRect(cardScrollRectParent);
        return(cardDisplay);
    }
Example #15
0
    private void Start()
    {
        int   CurrentSpawn = 0;
        float xPos         = 0f;
        float yPos         = 2f;
        float xAmount      = 3f;

        for (int i = 0; i < 11; i++)
        {
            foreach (Card card in instance.cards)
            {
                if (card.manaCost == i)
                {
                    switch (cardDisplayPosition)
                    {
                    case 0:
                        xPos = -4.5f;
                        break;

                    case 1:
                        xPos = xPos + xAmount;
                        break;

                    case 2:
                        xPos = xPos + xAmount;
                        break;

                    case 3:
                        xPos = xPos + xAmount;
                        break;

                    default:
                        break;
                    }

                    cardDisplayPosition++;

                    if (cardDisplayPosition > 3)
                    {
                        cardDisplayPosition = 0;
                    }

                    GameObject  go      = Instantiate(cardPrefab, new Vector3(xPos, yPos, 0), Quaternion.identity);
                    CardDisplay display = go.GetComponent <CardDisplay>();
                    display.CardSetup(card);

                    CurrentSpawn++;

                    if (CurrentSpawn > 3)
                    {
                        yPos        -= 4f;
                        CurrentSpawn = 0;
                    }
                }
            }
        }
    }
Example #16
0
    public virtual void Start()
    {
        gamemanager     = FindObjectOfType <Gamemanager>();
        display         = FindObjectOfType <CardDisplay>();
        playerSelection = FindObjectOfType <PlayerSelection>();
        colorChange     = FindObjectOfType <ColorChange>();

        // colorChange.Start();
    }
Example #17
0
    /**
     * Discard the card from the hand
     */
    public void DiscardCard(CardDisplay card)
    {
        CardDisplayList.Remove(card);
        //check for a curse effect
        CheckCurseCard(card.card, false);

        //active visual effect
        StartCoroutine(card.transform.GetComponent <DragCardHandler>().PlayGoToDiscard());
    }
Example #18
0
        public void InitializesCard()
        {
            Card        card        = LoadTestUnitCard();
            Transform   transform   = new GameObject().transform;
            CardDisplay cardDisplay = CardDisplay.CreateCardDisplay(card, transform);

            Assert.IsNotNull(cardDisplay);
            Assert.AreEqual(cardDisplay.GetCard().cardName, "Wizard");
        }
Example #19
0
    public override void Execute(Vector2Int value, int power, CardDisplay cardDisplay)
    {
        int discard = GetFinalValue(value, power);

        if (discard > 0)
        {
            Instantiate(discardCardEvent, BattleEventManager.Instance.transform).discardNumber = discard;
        }
    }
Example #20
0
    private void AddToCard(ICard cardData, CardDisplay cardDisplay)
    {
        CardEntity card = new CardEntity();

        card.data    = cardData;
        card.display = cardDisplay;
        cards.Add(card);
        numberChanged.Invoke(cards.Count);
    }
Example #21
0
    private void BuildCard(Card card, int displayIndex)
    {
        CardDisplay cardDisplay = cardDisplays[displayIndex];

        cardDisplay.SetIcon(card.cardIcon);
        cardDisplay.SetBackground(card.cardBorder);
        cardDisplay.SetEnergyCostText(card.energyCost.ToString());
        cardDisplay.SetDescriptionText(card.description);
    }
Example #22
0
    public override void Execute(Vector2Int value, int power, CardDisplay cardDisplay)
    {
        int draw = GetFinalValue(value, power);

        for (int i = 0; i < draw; i++)
        {
            Instantiate(createCardEvent, BattleEventManager.Instance.transform).card.data = card.battleData;
        }
    }
    public void Add(CardBattleData data)
    {
        CardDisplay card = Instantiate(cardSelectDisplay, transform);

        card.data = data;
        card.SetUp();

        cardList.Add(card);
    }
Example #24
0
 public void EmmitCardPlayAction(CardDisplay card, Point point)
 {
     Unibus.Dispatch <PlayCardAction>(ActionEmmiter.CARD_PLAY, new PlayCardAction
     {
         cardId = card.cardData.id,
         x      = point.x.ToString(),
         y      = point.y.ToString()
     });
 }
 /// <summary>
 /// 构造函数
 /// 花色,牌权值 设定后不能修改
 /// </summary>
 /// <param name="name">牌名</param>
 /// <param name="color">花色</param>
 /// <param name="weight">权重</param>
 /// /// <param name="belongTo">归属</param>
 public BaseCard(string name, int id, CardColors color, CardWeight weight, CardBelongTo belongTo, CardDisplay cardDisplay)
 {
     this.cardName     = name;
     this.CardId       = id;
     this.cardColor    = color;
     this.cardWeight   = weight;
     this.cardBelongTo = belongTo;
     this.cardDisplay  = cardDisplay;
 }
    public static void SetCardLocation(this GameObject gameObject, Enums.CardLocation cardLocation)
    {
        CardDisplay cardDisplay = gameObject.transform.GetComponent <CardDisplay>();

        if (cardDisplay != null)
        {
            cardDisplay.card.LocationOfCard = cardLocation;
        }
    }
Example #27
0
    /**
     * Create a card gameObject in the hand and add it to the list
     * Use when a card is draw
     */
    public void AddCard(BasicCard cardDraw)
    {
        CardDisplay cardDisplay = Instantiate(cardDisplayPrefab, this.transform).GetComponent <CardDisplay>();

        //Set the display of the card
        cardDisplay.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(cardWidth, cardHeight);
        cardDisplay.UpdateCard(cardDraw);
        CardDisplayList.Add(cardDisplay);
    }
Example #28
0
 public override void Start()
 {
     Display = GetComponent <CardDisplay>();
     for (int i = 0; i < Size; ++i)
     {
         Cards.Add(null);
     }
     CardActions.Add((CardData c) => Move(c));
 }
Example #29
0
    /// <summary>
    /// Method to be called when only one card needs to be drawn
    /// </summary>
    /// <param name="obj">The method need a reference to the cardDisplay item to use for the new card</param>
    public void DrawCard(GameObject obj)
    {
        CardDisplay _cd = obj.GetComponent <CardDisplay>();

        // Randomly select a card from the possible card list
        Card selectedCard = SelectCard();

        _cd.SetCard(selectedCard);
    }
    private void OnCardMouseExit(CardDisplay card)
    {
        if (card.UnitDisplay)
        {
            var tile = boardCreator.GetTileByUnit(card.UnitDisplay);
            tile.HighlightOff();

            card.UnitDisplay.EnableTeamColor();
        }
    }
Example #31
0
    void Start()
    {
        isActive = false;
        m_SpriteRenderer = gameObject.GetComponent<SpriteRenderer>();
        if (isActive) {
            m_SpriteRenderer.color = activeColor;
        } else {
            m_SpriteRenderer.color = inactiveColor;
        }
        //	m_srcs = GetComponents<AudioSource>();
        //	m_stoneSfx = m_srcs [0];
        //	m_glowSfx = m_srcs [1];

        m_CardDisplay = DisplayControllerObj.GetComponent<CardDisplay> ();
        m_defaultColor = m_SpriteRenderer.color;
    }