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()); }
private void Refresh() { EventShopItem data = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items[GlobalVars.ShopBuyIndex]; this.ItemWindow.SetActive(!data.IsArtifact); this.ArtifactWindow.SetActive(data.IsArtifact); if (Object.op_Inequality((Object)this.AmountNum, (Object)null)) { this.AmountNum.set_text(data.remaining_num.ToString()); } if (Object.op_Inequality((Object)this.Sold, (Object)null)) { this.Sold.SetActive(!data.IsNotLimited); } if (data.IsArtifact) { ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data.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); 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); } } else { ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data.iname); this.event_shop_item_set_list.Clear(); if (data.IsSet) { for (int index = 0; index < data.children.Length; ++index) { GameObject gameObject = index >= this.event_shop_item_set_list.Count ? (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate) : ((Component)this.event_shop_item_set_list[index]).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); EventShopSetItemListElement component = (EventShopSetItemListElement)gameObject.GetComponent <EventShopSetItemListElement>(); StringBuilder stringBuilder = GameUtility.GetStringBuilder(); if (data.children[index].IsArtifact) { ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data.children[index].iname); if (artifactParam != null) { stringBuilder.Append(artifactParam.name); } component.ArtifactParam = artifactParam; } else { ItemData itemData = new ItemData(); itemData.Setup(0L, data.children[index].iname, data.children[index].num); if (itemData != null) { stringBuilder.Append(itemData.Param.name); } component.itemData = itemData; } stringBuilder.Append("×"); stringBuilder.Append(data.children[index].num.ToString()); component.itemName.set_text(stringBuilder.ToString()); component.SetShopItemDesc(data.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(data.iname)); } DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), data); GameParameter.UpdateAll(((Component)this).get_gameObject()); }