Example #1
0
 private void OnEnable()
 {
     cardDisplay.GetComponent <Button>().interactable = true;
     doNothingBtn.interactable = false;
     //foreach (CardDisplay button in tipsDisplay)
     //{
     //    if (!button.transform.GetChild(0).gameObject.activeSelf)
     //    {
     //        button.GetComponent<Button>().interactable = true;
     //    }
     //}
 }
Example #2
0
    public override void OnClick(CardDisplay card)
    {
        if (!card.GetComponent <StoreCardDisplay>().isSet)
        {
            return;
        }
        if (PlayerData.Instance.coin >= card.data.preset.price)
        {
            PlayerData.Instance.coin -= card.data.preset.price;

            for (int i = 0; i < 5; i++)
            {
                if (sellCard[i].data.preset.price > PlayerData.Instance.coin)
                {
                    sellCard[i].GetComponent <StoreCardDisplay>().priceText.color = new Color(1.0f, 0.0f, 0.3f, 1.0f);
                }
            }
            BuyCard(card);
            Instantiate(cardRemove, card.transform.position, card.transform.rotation, transform).SetUp(card);
            Instantiate(soldout, card.transform.position, soldout.transform.rotation, transform);
            card.gameObject.SetActive(false);

            audioSource.PlayOneShot(sounds[0]);
        }
        else
        {
            TextManager.Instance.notEnoughCoinText.gameObject.SetActive(true);
            audioSource.PlayOneShot(sounds[1]);
        }
    }
Example #3
0
 public void Show(Card card)
 {
     cardDisplay.card = card;
     cardDisplay.GetComponent <DragAndDropItem>().enabled = false;
     cardDisplay.RenderCard();
     gameObject.SetActive(true);
     Time.timeScale = 0;
 }
Example #4
0
 public void SetNowDraggingCard(CardDisplay card)
 {
     if (nowDraggingCard != null)
     {
         nowDraggingCard.cardDescription.DescriptionUpdate(false);
         nowDraggingCard.GetComponent <CardEventTrigger>().isDrag    = false;
         nowDraggingCard.GetComponent <HandCardElement>().isActivity = true;
         GetComponent <HandCardLayoutGroup>().ElementUpdate();
     }
     nowDraggingCard = card;
     if (nowDraggingCard != null)
     {
         nowDraggingCard.cardDescription.DescriptionUpdate(true);
         nowDraggingCard.GetComponent <CardEventTrigger>().isDrag    = true;
         nowDraggingCard.GetComponent <HandCardElement>().isActivity = false;
         GetComponent <HandCardLayoutGroup>().ElementUpdate();
     }
 }
 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 #6
0
 private void Start()
 {
     cardRect         = cardDisplay.GetComponent <RectTransform>();
     ribbonRect       = GetComponent <RectTransform>();
     parentRibbonRect = ribbonRect.parent.GetComponent <RectTransform>();
     screenWidth      = Screen.width;
     screenHeight     = Screen.height;
     cardRectWidth    = cardRect.rect.width;
     cardRectHeight   = cardRect.rect.height;
 }
    public CardDisplay CreateCardDisplayForRibbon(RectTransform transformParent)
    {
        CardDisplay   cardDisplay     = cardCollectionCardDisplayCreator.CreateOnlyDisply(transformParent);
        RectTransform cardDisplayRect = cardDisplay.GetComponent <RectTransform>();

        // Si, le tengo que cambiar el anclaje por que la UI de Unity es bastante confusa a veces.
        cardDisplayRect.anchorMin = Vector2.zero;
        cardDisplayRect.anchorMax = Vector2.zero;
        return(cardDisplay);
    }
Example #8
0
    public void PlayCard(CardDisplay card)
    {
        Draggable[] draggableCCH = GetChildern();
        MoveCardToHandFromCurrentPlay(draggableCCH);

        Draggable draggableCastingCard = card.GetComponent <Draggable>();

        draggableCastingCard.parentToReturnTo = currentCardHandler.transform;

        deck.CastCard(card.card);
    }
Example #9
0
    public void PowerDisplayUpdate()
    {
        int empty  = CardEffectExecutor.Instance.totalEmptyPower;
        int normal = empty + CardEffectExecutor.Instance.totalNormalPower;
        int broken = normal + CardEffectExecutor.Instance.totalBrokenPower;

        if (broken <= card.data.powerSpace && !card.GetComponent <Animator>().GetBool("isMod"))
        {
            for (int i = 0; i < card.data.powerSpace; i++)
            {
                if (i < empty)
                {
                    powerList[i].sprite = powerDisplay.emptyPowerIcon.sprite;
                }
                else if (i < normal)
                {
                    powerList[i].sprite = powerDisplay.normalPowerIcon.sprite;
                }
                else if (i < broken)
                {
                    powerList[i].sprite = powerDisplay.brokenPowerIcon.sprite;
                }
                else
                {
                    powerList[i].sprite = powerSpaceIcon.sprite;
                }
            }
        }
        else
        {
            foreach (var p in powerList)
            {
                p.sprite = powerSpaceIcon.sprite;
            }
        }
    }
 public override void OnPointExit(CardDisplay card)
 {
     card.GetComponent <Animator>().SetBool("isSelect", false);
 }
Example #11
0
 public override void OnPointEnter(CardDisplay card)
 {
     audioSource.PlayOneShot(sounds[2]);
     card.GetComponent <Animator>().SetBool("isTouch", true);
 }