示例#1
0
    /* PUBLIC API */

    public void clickStartTrial()
    /* Click handler for button that starts the campaign. */
    {
        // Put the purchased packs into the deck.
        foreach (string packId in ShopLogic.packsAddedToCart)
        {
            Pack            pack      = ShopLogic.packInventory[packId];
            List <CardInfo> packCards = pack.cardList;
            foreach (CardInfo cardInfo in packCards)
            {
                CampaignLogic.campaignDeck[cardInfo.cardId] = cardInfo;
            }
        }

        // Pay the money.
        CampaignLogic.currentCash -= ShopLogic.getExpensesInCart();
        ShopLogic.clearCart();

        // Start the trial.
        SceneManager.LoadScene("TrialScene");
    }
示例#2
0
    /* PUBLIC API */

    public void clickAddPack()

    /* Override this function of IPointerClickHandler. Triggers when this PackDisplay is clicked.
     *
     * :param PointerEventData eventData: This interface is defined by Unity.
     */
    {
        if (ShopLogic.packsAddedToCart.Contains(packId))
        {
            ShopLogic.packsAddedToCart.Remove(packId);
            labelTextObj.GetComponent <Text>().fontStyle = FontStyle.Normal;
        }
        else
        {
            int availableCash = CampaignLogic.currentCash - ShopLogic.getExpensesInCart();
            int packPrice     = ShopLogic.getBaseCashValueOfPack(packId);
            if (availableCash >= packPrice)
            {
                ShopLogic.packsAddedToCart.Add(packId);
                labelTextObj.GetComponent <Text>().fontStyle = FontStyle.Bold;
            }
        }
    }
示例#3
0
    void Update()
    {
        int availableCash = CampaignLogic.currentCash - ShopLogic.getExpensesInCart();

        GetComponent <Text>().text = availableCash.ToString("N0");
    }