Exemple #1
0
    public void RecycleConfirmButton()
    {
        if (UIManager.Instance.LastSelectedCard)
        {
            object[] data = new object[] { GameManager.Instance.RemoveCardAtIndex };
            PhotonNetwork.RaiseEvent(RECYCLE_SYNC_EVENT, data, new RaiseEventOptions {
                Receivers = ReceiverGroup.Others
            },
                                     SendOptions.SendReliable);

            CardVisual cv = UIManager.Instance.LastSelectedCard.GetComponent <CardVisual>();
            //move the selected card to top of the deck.
            deckList = UIManager.Instance.GetActiveDeckList(true);
            deckList.Insert(0, cv.GetCardData());

            TMP_Text deckCounter = GameManager.Instance.GetActiveDeck(true).transform.Find("DeckCounter").GetComponent <TMP_Text>();
            deckCounter.text = deckList.Count.ToString();

            Destroy(GameManager.Instance.GetActiveDiscardPile(true).GetChild(GameManager.Instance.RemoveCardAtIndex).gameObject);
            UIManager.Instance.GetActiveDiscardList(true).RemoveAt(GameManager.Instance.RemoveCardAtIndex);
            GameManager.Instance.RemoveCardAtIndex = -1;

            //Add the power to the Queue
            EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_RECYCLE);
        }

        GameManager.Instance.GetActiveDiscardUI(true).gameObject.SetActive(false);
        SetupRecycleUI(false);
        GameManager.Instance.allyDiscardPileButton.interactable  = true;
        GameManager.Instance.enemyDiscardPileButton.interactable = true;

        //Call the Next Effect in the Queue
        InvokeEventCommand.InvokeNextEvent();

        UIManager.Instance.RemoveEffectIcon = true;
    }