示例#1
0
        private void Refresh()
        {
            GameUtility.DestroyGameObjects(this.mItems);
            this.mItems.Clear();
            LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData();

            if (limitedShopData == null || limitedShopData.items.Count <= 0 || UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            int                      shopdata_index       = GlobalVars.ShopBuyIndex;
            Transform                parent               = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemParent, (UnityEngine.Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform();
            LimitedShopItem          limitedShopItem      = limitedShopData.items.FirstOrDefault <LimitedShopItem>((Func <LimitedShopItem, bool>)(item => item.id == shopdata_index));
            List <Json_ShopItemDesc> jsonShopItemDescList = new List <Json_ShopItemDesc>();

            if (limitedShopItem.IsArtifact)
            {
                jsonShopItemDescList.Add(new Json_ShopItemDesc()
                {
                    iname = limitedShopItem.iname,
                    itype = ShopData.ShopItemType2String(limitedShopItem.ShopItemType),
                    num   = limitedShopItem.num
                });
            }
            else if (limitedShopItem.children != null && limitedShopItem.children.Length > 0)
            {
                jsonShopItemDescList.AddRange((IEnumerable <Json_ShopItemDesc>)limitedShopItem.children);
            }
            if (jsonShopItemDescList.Count > 0)
            {
                for (int index = 0; index < jsonShopItemDescList.Count; ++index)
                {
                    Json_ShopItemDesc shop_item_desc = jsonShopItemDescList[index];
                    string            empty          = string.Empty;
                    GameObject        gameObject;
                    string            name;
                    if (shop_item_desc.IsArtifact)
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shop_item_desc.iname);

                        if (artifactParam != null)
                        {
                            gameObject = this.InstantiateItem <ArtifactParam>(this.ItemTemplate, parent, artifactParam);
                            name       = artifactParam.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (shop_item_desc.IsConceptCard)
                    {
                        ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(shop_item_desc.iname);
                        if (cardDataForDisplay != null)
                        {
                            gameObject = this.InstantiateItem <ConceptCardData>(this.ItemTemplate, parent, cardDataForDisplay);
                            ConceptCardIcon componentInChildren = (ConceptCardIcon)gameObject.GetComponentInChildren <ConceptCardIcon>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null))
                            {
                                componentInChildren.Setup(cardDataForDisplay);
                            }
                            name = cardDataForDisplay.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, shop_item_desc.iname, shop_item_desc.num))
                        {
                            gameObject = this.InstantiateItem <ItemData>(this.ItemTemplate, parent, itemData);
                            name       = itemData.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    LimitedShopGiftItem component = (LimitedShopGiftItem)gameObject.GetComponent <LimitedShopGiftItem>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        component.SetShopItemInfo(shop_item_desc, name, GlobalVars.ShopBuyAmount);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)parent).get_gameObject());
        }
        private void Refresh()
        {
            GameUtility.DestroyGameObjects(this.mItems);
            this.mItems.Clear();
            LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData();

            if (limitedShopData == null || limitedShopData.items.Count <= 0 || Object.op_Equality((Object)this.ItemTemplate, (Object)null))
            {
                return;
            }
            int             shopBuyIndex    = GlobalVars.ShopBuyIndex;
            Transform       parent          = !Object.op_Inequality((Object)this.ItemParent, (Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform();
            LimitedShopItem limitedShopItem = limitedShopData.items[shopBuyIndex];

            if (limitedShopItem.IsArtifact)
            {
                limitedShopItem.children          = new Json_ShopItemDesc[1];
                limitedShopItem.children[0]       = new Json_ShopItemDesc();
                limitedShopItem.children[0].iname = limitedShopItem.iname;
                limitedShopItem.children[0].num   = limitedShopItem.num;
            }
            if (limitedShopItem.children != null && limitedShopItem.children.Length > 0)
            {
                foreach (Json_ShopItemDesc child in limitedShopItem.children)
                {
                    string     empty = string.Empty;
                    GameObject gameObject;
                    string     name;
                    if (child.IsArtifact)
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(child.iname);

                        if (artifactParam != null)
                        {
                            gameObject = this.InstantiateItem <ArtifactParam>(this.ItemTemplate, parent, artifactParam);
                            name       = artifactParam.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, child.iname, child.num))
                        {
                            gameObject = this.InstantiateItem <ItemData>(this.ItemTemplate, parent, itemData);
                            name       = itemData.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    LimitedShopGiftItem component = (LimitedShopGiftItem)gameObject.GetComponent <LimitedShopGiftItem>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.SetShopItemInfo(child, name);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)parent).get_gameObject());
        }