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()); }
private void Refresh() { this.mShopitem = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items.FirstOrDefault <EventShopItem>((Func <EventShopItem, 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.event_shop_item_set_list.Clear(); if (this.mShopitem.IsSet) { for (int index = 0; index < this.mShopitem.children.Length; ++index) { GameObject gameObject = index >= this.event_shop_item_set_list.Count ? (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate) : ((Component)this.event_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); EventShopSetItemListElement component = (EventShopSetItemListElement)gameObject.GetComponent <EventShopSetItemListElement>(); 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.event_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((ShopItem)this.mShopitem); int buyPrice = ShopData.GetBuyPrice((ShopItem)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 <EventShopItem>(((Component)this).get_gameObject(), this.mShopitem); GameParameter.UpdateAll(((Component)this).get_gameObject()); }