Esempio n. 1
0
    public void SetItemData(ShopGoldData data)      // data item buff
    {
        DataDefault();
        SetTextBtnBuy();
        goldData = data;

        goldName.text = goldData.goldName;

        string goldPriceString = goldData.goldPrice.ToString() + " " + EssentialData.TAG_CURRENCY;

        goldPrice.text = goldPriceString;

        if (goldData.isSprite)
        {
            SetImageItem(goldData.spriteIAP);
        }
        else
        {
            Object     prefab = AssetManager.Instance.GetPrefabByKeyword(goldData.codeIAP);
            GameObject go     = Instantiate(prefab) as GameObject;

            go.transform.SetParent(parentSpineUIObj);
            go.transform.localPosition    = Vector3.zero;
            go.transform.localEulerAngles = Vector3.zero;
            go.transform.localScale       = Vector3.one;
        }
    }
Esempio n. 2
0
    // GOLD -- no GOLD SHELL
    void SetConfirmPopup(ShopGoldData confirmData)
    {
        goldShell.SetActive(false);

        txtConfirm.text = stringPurchase + " " + confirmData.goldName + "?";

        string goldString = confirmData.goldPrice.ToString() + " " + EssentialData.TAG_CURRENCY;

        txtConfirmPrice.text = goldString;

        if (confirmData.isSprite)
        {
            SetConfirmImage(confirmData.spriteIAP);
        }
        else
        {
            imageConfirm.gameObject.SetActive(false);

            Object     prefab = AssetManager.Instance.GetPrefabByKeyword(confirmData.codeIAP);
            GameObject go     = Instantiate(prefab) as GameObject;

            go.transform.SetParent(parentSpineHolder);
            go.transform.localPosition    = Vector3.zero;
            go.transform.localEulerAngles = Vector3.zero;
            go.transform.localScale       = new Vector3(1.2f, 1.2f, 1.2f);
        }
    }
Esempio n. 3
0
    // GOLD -- no GOLD SHELL
    public void InitPopConfirm(ShopGoldData goldShopData, System.Action actBuy, System.Action actExit = null)
    {
        this.gameObject.SetActive(true);

        SetDelegate(actBuy, actExit);

        SetConfirmPopup(goldShopData);

        EssentialData.popupState = EnumData.PopupState.on;
    }
Esempio n. 4
0
    public void ItemGoldSelected(ShopGoldData data)
    {
        selectedGold = data;

        if (!string.IsNullOrEmpty(selectedGold.skuId))
        {
            Debug.Log("Gold open pop up. " + selectedGold.goldName);

            popConfirmScript.InitPopConfirm(selectedGold, ProcessBuyGold);
        }
    }
Esempio n. 5
0
    void SetShopData(string jsonText)
    {
        var jsonData = Json.Deserialize(jsonText) as Dictionary <string, object>;
        Dictionary <string, object> data = null;

        if (NetworkConfig.IsUsingEncryption)
        {
            var enc = jsonData [TAG_DATA] as string;
            data = Json.Deserialize(AES.Decrypt(enc)) as Dictionary <string, object>;
        }
        else
        {
            data = jsonData[TAG_DATA] as Dictionary <string, object>;
        }

        //Load shop gold data
        listShopGold.Clear();
        var shopGolds = data[TAG_SHOP_GOLD] as List <object>;

        for (int i = 0; i < shopGolds.Count; i++)
        {
            var          rawData   = shopGolds[i] as Dictionary <string, object>;
            ShopGoldData sGoldData = new ShopGoldData(rawData);
            listShopGold.Add(sGoldData);
        }

        //Load Shop Skin
        listShopSkin.Clear();
        var shopSkins = data[TAG_SHOP_SKIN] as List <object>;

        for (int i = 0; i < shopSkins.Count; i++)
        {
            var          rawData   = shopSkins[i] as Dictionary <string, object>;
            ShopSkinData sSkinData = new ShopSkinData(rawData);
            listShopSkin.Add(sSkinData);
        }

        //Load Shop Buff
        listShopBuff.Clear();
        var shopBuffs = data[TAG_SHOP_BUFF] as List <object>;

        for (int i = 0; i < shopBuffs.Count; i++)
        {
            var         rawData = shopBuffs[i] as Dictionary <string, object>;
            PowerupData puData  = new PowerupData(rawData);
            listShopBuff.Add(puData);
        }
    }