Esempio 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];

            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     flag  = 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))
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (flag)
                    {
                        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);
            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());
        }
        private void Refresh()
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.UnitTemplate, (UnityEngine.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);
            }
            this.mShopitem = MonoSingleton <GameManager> .Instance.Player.GetShopData(GlobalVars.ShopType).items.FirstOrDefault <ShopItem>((Func <ShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));

            bool flag1 = !this.mShopitem.IsNotLimited || this.mShopitem.saleType == ESaleType.Coin_P;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.limited_item, (UnityEngine.Object)null))
            {
                this.limited_item.SetActive(flag1);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.no_limited_item, (UnityEngine.Object)null))
            {
                this.no_limited_item.SetActive(!flag1);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Sold, (UnityEngine.Object)null))
            {
                this.Sold.SetActive(!this.mShopitem.IsNotLimited);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SoldNum, (UnityEngine.Object)null))
            {
                this.SoldNum.set_text(this.mShopitem.remaining_num.ToString());
            }
            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);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasJem, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasCoin, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasZenny, (UnityEngine.Object)null))
            {
                switch (this.mShopitem.saleType)
                {
                case ESaleType.Gold:
                    this.HasJem.SetActive(false);
                    this.HasCoin.SetActive(false);
                    this.HasZenny.SetActive(true);
                    break;

                case ESaleType.Coin:
                case ESaleType.Coin_P:
                    this.HasJem.SetActive(true);
                    this.HasCoin.SetActive(false);
                    this.HasZenny.SetActive(false);
                    break;

                default:
                    this.HasJem.SetActive(false);
                    this.HasCoin.SetActive(true);
                    this.HasZenny.SetActive(false);
                    break;
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.EnableEquipUnitWindow, (UnityEngine.Object)null))
            {
                this.EnableEquipUnitWindow.get_gameObject().SetActive(false);
                int index1 = 0;
                for (int index2 = 0; index2 < units.Count; ++index2)
                {
                    UnitData data  = units[index2];
                    bool     flag2 = false;
                    for (int index3 = 0; index3 < data.Jobs.Length; ++index3)
                    {
                        JobData job = data.Jobs[index3];
                        if (job.IsActivated)
                        {
                            int equipSlotByItemId = job.FindEquipSlotByItemID(this.mShopitem.iname);
                            if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId))
                            {
                                flag2 = true;
                                break;
                            }
                        }
                    }
                    if (flag2)
                    {
                        if (index1 >= this.mUnits.Count)
                        {
                            this.UnitTemplate.SetActive(true);
                            GameObject gameObject = (GameObject)UnityEngine.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, data);
                        gameObject1.SetActive(true);
                        this.EnableEquipUnitWindow.get_gameObject().SetActive(true);
                        GameUtility.SetGameObjectActive(this.LayoutRight, true);
                        ++index1;
                    }
                }
            }
            DataSource.Bind <ShopItem>(((Component)this).get_gameObject(), this.mShopitem);
            if (this.mShopitem.IsArtifact)
            {
                DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.iname));
            }
            else if (this.mShopitem.IsConceptCard)
            {
                GameUtility.SetGameObjectActive(this.ItemIconRoot, false);
                GameUtility.SetGameObjectActive(this.ConceptCardIconRoot, true);
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ConceptCardDetail, (UnityEngine.Object)null))
                {
                    ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(this.mShopitem.iname);
                    GlobalVars.SelectedConceptCardData.Set(cardDataForDisplay);
                    GameUtility.SetGameObjectActive(this.ConceptCardDetail, true);
                    GameUtility.SetGameObjectActive(this.LayoutRight, true);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null))
                    {
                        this.TextDesc.set_text(cardDataForDisplay.Param.expr);
                    }
                }
            }
            else
            {
                ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(this.mShopitem.iname);

                if (itemDataByItemId != null)
                {
                    DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null))
                    {
                        this.TextDesc.set_text(itemDataByItemId.Param.Expr);
                    }
                }
                else
                {
                    ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(this.mShopitem.iname);

                    if (itemParam != null && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null))
                    {
                        DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), itemParam);
                        this.TextDesc.set_text(itemParam.Expr);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Esempio n. 3
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);
            }
            LimitedShopItem data1 = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData().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());
            }
            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 <LimitedShopItem>(((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(), MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data1.iname));
                DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }