Exemple #1
0
    public Popup_Offer Setup(GlobalConfig.Data.Shop.Package pack, System.Action <bool> onClose = null)
    {
        onCloseFunc = onClose;

        if (pack != null)
        {
            presenter.Setup(pack.sku, success =>
            {
                PurchaseOffer.SetPurchaseResult(success);
                if (success)
                {
                    Exit(true);
                }
            });
        }
        else
        {
            Exit(false);
        }

        return(this);
    }
Exemple #2
0
    private IEnumerator Start()
    {
        var index = PurchaseOffer.GetOfferIndex(Profile.Gems);

        if (index.Between(0, GlobalConfig.Shop.offers.Count - 1))
        {
            var item = combinedItem.Clone <UiShopItem>();
            item.Setup(GlobalConfig.Shop.offers[index].sku, success =>
            {
                PurchaseOffer.SetPurchaseResult(success);
                item.gameObject.SetActive(success == false);
            });
        }

        foreach (var item in GlobalConfig.Shop.combinedPackages)
        {
            combinedItem.Clone <UiShopItem>().Setup(item.sku);
        }

        foreach (var item in GlobalConfig.Shop.gemPackages)
        {
            gemsItem.Clone <UiShopItem>().Setup(item.sku);
        }
        gemsItem.transform.parent.SetAsLastSibling();

        Destroy(combinedItem.gameObject);
        Destroy(gemsItem.gameObject);

        UiShowHide.ShowAll(transform);

        var wait = new WaitForSeconds(0.5f);

        while (true)
        {
            gemsLabel.SetText(Profile.Gems.ToString("#,0"));
            yield return(wait);
        }
    }