Ejemplo n.º 1
0
        private void Refresh()
        {
            if (Object.op_Equality((Object)this.UnitTemplate, (Object)null))
            {
                return;
            }
            List <UnitData> units = MonoSingleton <GameManager> .Instance.Player.Units;

            for (int index = 0; index < this.mUnits.Count; ++index)
            {
                this.mUnits[index].get_gameObject().SetActive(false);
            }
            ShopItem data1 = MonoSingleton <GameManager> .Instance.Player.GetShopData(GlobalVars.ShopType).items[GlobalVars.ShopBuyIndex];

            bool flag1 = !data1.IsNotLimited || data1.saleType == ESaleType.Coin_P;

            if (Object.op_Inequality((Object)this.limited_item, (Object)null))
            {
                this.limited_item.SetActive(flag1);
            }
            if (Object.op_Inequality((Object)this.no_limited_item, (Object)null))
            {
                this.no_limited_item.SetActive(!flag1);
            }
            if (Object.op_Inequality((Object)this.Sold, (Object)null))
            {
                this.Sold.SetActive(!data1.IsNotLimited);
            }
            if (Object.op_Inequality((Object)this.SoldNum, (Object)null))
            {
                this.SoldNum.set_text(data1.remaining_num.ToString());
            }
            ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data1.iname);

            if (Object.op_Inequality((Object)this.EnableEquipUnitWindow, (Object)null))
            {
                this.EnableEquipUnitWindow.get_gameObject().SetActive(false);
                int index1 = 0;
                for (int index2 = 0; index2 < units.Count; ++index2)
                {
                    UnitData data2 = units[index2];
                    bool     flag2 = false;
                    for (int index3 = 0; index3 < data2.Jobs.Length; ++index3)
                    {
                        JobData job = data2.Jobs[index3];
                        if (job.IsActivated)
                        {
                            int equipSlotByItemId = job.FindEquipSlotByItemID(data1.iname);
                            if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId))
                            {
                                flag2 = true;
                                break;
                            }
                        }
                    }
                    if (flag2)
                    {
                        if (index1 >= this.mUnits.Count)
                        {
                            this.UnitTemplate.SetActive(true);
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitTemplate);
                            gameObject.get_transform().SetParent((Transform)this.UnitLayoutParent, false);
                            this.mUnits.Add(gameObject);
                            this.UnitTemplate.SetActive(false);
                        }
                        GameObject gameObject1 = this.mUnits[index1].get_gameObject();
                        DataSource.Bind <UnitData>(gameObject1, data2);
                        gameObject1.SetActive(true);
                        this.EnableEquipUnitWindow.get_gameObject().SetActive(true);
                        ++index1;
                    }
                }
            }
            DataSource.Bind <ShopItem>(((Component)this).get_gameObject(), data1);
            if (data1.IsArtifact)
            {
                DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname));
            }
            else
            {
                DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
                DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 2
0
        private void Refresh()
        {
            this.mShopitem = MonoSingleton <GameManager> .Instance.Player.GetShopData(GlobalVars.ShopType).items.FirstOrDefault <ShopItem>((Func <ShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));

            this.ItemWindow.SetActive(!this.mShopitem.IsArtifact);
            this.ArtifactWindow.SetActive(this.mShopitem.IsArtifact);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountNum, (UnityEngine.Object)null))
            {
                this.AmountNum.set_text(this.mShopitem.remaining_num.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Sold, (UnityEngine.Object)null))
            {
                this.Sold.SetActive(!this.mShopitem.IsNotLimited);
            }
            if (this.mShopitem.IsArtifact)
            {
                ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.iname);

                DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), artifactParam);
                this.mArtifactParam = artifactParam;
                ArtifactData artifactData = new ArtifactData();
                artifactData.Deserialize(new Json_Artifact()
                {
                    iname = artifactParam.iname,
                    rare  = artifactParam.rareini
                });
                BaseStatus fixed_status = new BaseStatus();
                BaseStatus scale_status = new BaseStatus();
                artifactData.GetHomePassiveBuffStatus(ref fixed_status, ref scale_status, (UnitData)null, 0, true);
                this.ArtifactStatus.SetValues(fixed_status, scale_status, false);
                if (artifactParam.abil_inames != null && artifactParam.abil_inames.Length > 0)
                {
                    AbilityParam abilityParam = MonoSingleton <GameManager> .Instance.MasterParam.GetAbilityParam(artifactParam.abil_inames[0]);

                    List <AbilityData> learningAbilities = artifactData.LearningAbilities;
                    bool flag = false;
                    if (learningAbilities != null)
                    {
                        for (int index = 0; index < learningAbilities.Count; ++index)
                        {
                            AbilityData abilityData = learningAbilities[index];
                            if (abilityData != null && abilityParam.iname == abilityData.Param.iname)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    DataSource.Bind <AbilityParam>(this.ArtifactAbility, abilityParam);
                    if (flag)
                    {
                        this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Unlocked);
                    }
                    else
                    {
                        this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Hidden);
                    }
                }
                else
                {
                    this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Hidden);
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_SetEffectsButton, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_SetEffectsButton, (UnityEngine.Object)null) && artifactParam != null)
                {
                    ((Selectable)this.m_SetEffectsButton).set_interactable(MonoSingleton <GameManager> .Instance.MasterParam.ExistSkillAbilityDeriveDataWithArtifact(artifactParam.iname));
                    if (((Selectable)this.m_SetEffectsButton).get_interactable())
                    {
                        ArtifactSetList.SetSelectedArtifactParam(artifactParam);
                    }
                }
            }
            else
            {
                ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(this.mShopitem.iname);

                this.shop_item_set_list.Clear();
                if (this.mShopitem.IsSet)
                {
                    for (int index = 0; index < this.mShopitem.children.Length; ++index)
                    {
                        GameObject gameObject = index >= this.shop_item_set_list.Count ? (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate) : ((Component)this.shop_item_set_list[index]).get_gameObject();
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject, (UnityEngine.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);
                            ShopSetItemListElement component     = (ShopSetItemListElement)gameObject.GetComponent <ShopSetItemListElement>();
                            StringBuilder          stringBuilder = GameUtility.GetStringBuilder();
                            if (this.mShopitem.children[index].IsArtifact)
                            {
                                ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.children[index].iname);

                                if (artifactParam != null)
                                {
                                    stringBuilder.Append(artifactParam.name);
                                }
                                component.ArtifactParam = artifactParam;
                            }
                            else if (this.mShopitem.children[index].IsConceptCard)
                            {
                                ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(this.mShopitem.children[index].iname);
                                if (cardDataForDisplay != null)
                                {
                                    stringBuilder.Append(cardDataForDisplay.Param.name);
                                }
                                component.SetupConceptCard(cardDataForDisplay);
                            }
                            else
                            {
                                ItemData itemData = new ItemData();
                                itemData.Setup(0L, this.mShopitem.children[index].iname, this.mShopitem.children[index].num);
                                if (itemData != null)
                                {
                                    stringBuilder.Append(itemData.Param.name);
                                }
                                component.itemData = itemData;
                            }
                            stringBuilder.Append("×");
                            stringBuilder.Append(this.mShopitem.children[index].num.ToString());
                            component.itemName.set_text(stringBuilder.ToString());
                            component.SetShopItemDesc(this.mShopitem.children[index]);
                            this.shop_item_set_list.Add(component);
                        }
                    }
                }
                DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
                DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(this.mShopitem.iname));
            }
            if (this.mShopitem.IsArtifact)
            {
                this.AmountSliderHolder = this.ArtifactAmountSliderHolder;
                this.AmountSlider       = this.ArtifactAmountSlider;
                this.AmountSliderNum    = this.ArtifactAmountSliderNum;
                this.IncrementButton    = this.ArtifactIncrementButton;
                this.DecrementButton    = this.ArtifactDecrementButton;
            }
            else
            {
                this.AmountSliderHolder = this.ItemAmountSliderHolder;
                this.AmountSlider       = this.ItemAmountSlider;
                this.AmountSliderNum    = this.ItemAmountSliderNum;
                this.IncrementButton    = this.ItemIncrementButton;
                this.DecrementButton    = this.ItemDecrementButton;
            }
            this.mEnabledSlider = false;
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderHolder, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSlider, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderNum, (UnityEngine.Object)null))
            {
                if (!this.mShopitem.IsNotLimited && this.mShopitem.remaining_num > 1)
                {
                    this.mEnabledSlider = true;
                    GameParameter component = (GameParameter)((Component)this.LimitedItemPriceText).GetComponent <GameParameter>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.AmountSliderHolder.SetActive(true);
                    int remainingCurrency = ShopData.GetRemainingCurrency(this.mShopitem);
                    int buyPrice          = ShopData.GetBuyPrice(this.mShopitem);
                    int num1 = 1;
                    if (buyPrice > 0)
                    {
                        while (buyPrice * num1 <= remainingCurrency)
                        {
                            ++num1;
                        }
                    }
                    int num2 = Math.Max(Math.Min(num1 - 1, this.mShopitem.remaining_num), 1);
                    this.AmountSlider.set_minValue(1f);
                    this.AmountSlider.set_maxValue((float)num2);
                    this.SetSliderValue(1f);
                    // ISSUE: method pointer
                    ((UnityEvent <float>) this.AmountSlider.get_onValueChanged()).AddListener(new UnityAction <float>((object)this, __methodptr(OnSliderValueChanged)));
                }
                else
                {
                    this.mEnabledSlider = false;
                    this.AmountSliderHolder.SetActive(false);
                }
            }
            DataSource.Bind <ShopItem>(((Component)this).get_gameObject(), this.mShopitem);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }