Beispiel #1
0
        private void AddGemContents(BundleParam bundleInfo, bool isFreeGems = false)
        {
            GameObject gameObject = this.itemCount >= this.limited_shop_item_set_list.Count ? (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate) : ((Component)this.limited_shop_item_set_list[this.itemCount]).get_gameObject();

            if (Object.op_Inequality((Object)gameObject, (Object)null))
            {
                gameObject.SetActive(true);
                Vector3 localScale = gameObject.get_transform().get_localScale();
                gameObject.get_transform().SetParent(this.ItemParent.get_transform());
                gameObject.get_transform().set_localScale(localScale);
                LimitedShopSetItemListElement component = (LimitedShopSetItemListElement)gameObject.GetComponent <LimitedShopSetItemListElement>();
                ItemData      itemData      = new ItemData();
                StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                if (isFreeGems)
                {
                    itemData.Setup(0L, "$COIN", bundleInfo.AdditionalFreeCoin);
                    stringBuilder.Append(LocalizedText.Get("sys.CONFIG_CHECKCOIN_FREE"));
                    stringBuilder.Append(" × ");
                    stringBuilder.Append(bundleInfo.AdditionalFreeCoin.ToString());
                }
                else
                {
                    itemData.Setup(0L, "$COIN", bundleInfo.AdditionalPaidCoin);
                    stringBuilder.Append(LocalizedText.Get("sys.CONFIG_CHECKCOIN_PAY"));
                    stringBuilder.Append(" × ");
                    stringBuilder.Append(bundleInfo.AdditionalPaidCoin.ToString());
                }
                component.itemName.set_text(stringBuilder.ToString());
                component.itemData = itemData;
                this.limited_shop_item_set_list.Add(component);
            }
            ++this.itemCount;
        }
        public bool Deserialize(JSON_BundleParamResponse json)
        {
            if (json == null || json.bundles == null)
            {
                return(true);
            }
            this.bundles.Clear();
            for (int index = 0; index < json.bundles.Length; ++index)
            {
                BundleParam bundleParam = new BundleParam();
                if (!bundleParam.Deserialize(json.bundles[index]))
                {
                    return(false);
                }
                this.bundles.Add(bundleParam);
            }
            this.bundles_all.Clear();
            foreach (JSON_BundleParam json1 in json.bundles_all)
            {
                BundleParam bundleParam = new BundleParam();
                if (!bundleParam.Deserialize(json1))
                {
                    return(false);
                }
                this.bundles_all.Add(bundleParam);
            }
            MonoSingleton <GameManager> .Instance.Player.SetBundleParam(this.bundles);

            return(true);
        }
Beispiel #3
0
        private void Refresh()
        {
            List <BundleParam> bundleParam1 = MonoSingleton <GameManager> .Instance.Player.GetBundleParam();

            BundleParam bundleParam2 = bundleParam1[0];

            using (List <BundleParam> .Enumerator enumerator = bundleParam1.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BundleParam current = enumerator.Current;
                    if (current.ProductId == GlobalVars.SelectedProductID)
                    {
                        bundleParam2 = current;
                        break;
                    }
                }
            }
            ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(bundleParam2.ProductId);

            this.limited_shop_item_set_list.Clear();
            this.itemCount = 0;
            if (bundleParam2 != null)
            {
                if (bundleParam2.AdditionalPaidCoin > 0)
                {
                    this.AddGemContents(bundleParam2, false);
                }
                if (bundleParam2.AdditionalFreeCoin > 0)
                {
                    this.AddGemContents(bundleParam2, true);
                }
                if (bundleParam2.Contents.Items != null)
                {
                    for (int index = 0; index < bundleParam2.Contents.Items.Count; ++index)
                    {
                        this.AddItemContents(bundleParam2.Contents.Items[index], false);
                    }
                }
                if (bundleParam2.Contents.Units != null)
                {
                    for (int index = 0; index < bundleParam2.Contents.Units.Count; ++index)
                    {
                        this.AddItemContents(bundleParam2.Contents.Units[index], true);
                    }
                }
                if (bundleParam2.Contents.Equipments != null)
                {
                    for (int index = 0; index < bundleParam2.Contents.Equipments.Count; ++index)
                    {
                        this.AddArtifactContents(bundleParam2.Contents.Equipments[index]);
                    }
                }
            }
            DataSource.Bind <BundleParam>(((Component)this).get_gameObject(), bundleParam2);
            DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }