protected override void onRefresh() { Player player = GameLogic.Binder.GameState.Player; CharacterInstance activeCharacter = player.ActiveCharacter; GameLogic.Item item = this.getReferenceItem(); if (this.ItemInstance != null) { int num; this.PowerText.text = MenuHelpers.BigValueToString(App.Binder.ConfigMeta.ItemPowerCurve(this.ItemInstance.Item.Type, player.getRiggedItemLevel(this.ItemInstance), this.ItemInstance.Rank)); int num2 = activeCharacter.getItemInstantUpgradeCount(this.ItemInstance, out num); if (num2 > ConfigMeta.ITEM_INSTANT_UPGRADE_LEVEL_THRESHOLD) { this.SpecialOfferPanel.SetActive(true); this.InstantUpgradeText.text = _.L(ConfigLoca.ITEMINFO_INSTANT_UPGRADE_DESCIPTION, new < > __AnonType8 <int>(num), false); this.InstantUpgradeButton.ButtonScript.interactable = num2 > 0; this.InstantUpgradeButton.ButtonImage.material = !this.InstantUpgradeButton.ButtonScript.interactable ? PlayerView.Binder.DisabledUiMaterial : null; this.InstantUpgradeButton.ButtonIcon.material = this.InstantUpgradeButton.ButtonImage.material; } else { this.SpecialOfferPanel.SetActive(false); } if (player.canEvolveItem(this.ItemInstance)) { this.EquipButton.enabled = true; this.EquipButtonImage.material = null; this.EquipButtonText.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_UPGRADE, null, false)); this.EquipButtonPulse.enabled = true; } else if (activeCharacter.isItemInstanceEquipped(this.ItemInstance)) { this.EquipButton.enabled = false; this.EquipButtonImage.material = PlayerView.Binder.DisabledUiMaterial; this.EquipButtonText.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_EQUIPPED, null, false)); this.EquipButtonPulse.enabled = false; this.IconSelectedBorder.enabled = true; } else if (!activeCharacter.hasReachedUnlockFloorForItem(this.ItemInstance)) { this.EquipButton.enabled = false; this.EquipButtonImage.material = PlayerView.Binder.DisabledUiMaterial; this.EquipButtonText.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_FLOOR_X, new < > __AnonType15 <int>(this.ItemInstance.UnlockFloor), false)); this.EquipButtonPulse.enabled = false; this.IconSelectedBorder.enabled = false; } else if (!this.ItemInstance.Unlocked) { this.EquipButton.enabled = false; this.EquipButtonImage.material = PlayerView.Binder.DisabledUiMaterial; this.EquipButtonText.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_LOCKED, null, false)); this.EquipButtonPulse.enabled = false; this.IconSelectedBorder.enabled = false; } else { this.EquipButton.enabled = true; this.EquipButtonImage.material = null; this.EquipButtonText.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_EQUIP, null, false)); this.EquipButtonPulse.enabled = false; this.IconSelectedBorder.enabled = false; } this.LevelText.text = (player.getRiggedItemLevel(this.ItemInstance) + this.ItemInstance.Rank).ToString(); } else { this.PowerText.text = "0"; this.LevelText.text = "1"; this.SpecialOfferPanel.SetActive(false); } if ((this.ItemInstance != null) && (this.ItemInstance.Perks.count() > 0)) { this.RerollButton.interactable = true; this.RerollCost.text = App.Binder.ConfigMeta.ItemRerollDiamondCostCurve(this.ItemInstance.Rarity, this.ItemInstance.RerollCount).ToString(); } else { this.RerollButton.interactable = false; this.RerollCost.text = "-"; } this.RerollButtonImage.material = !this.RerollButton.interactable ? PlayerView.Binder.DisabledUiMaterial : null; int num3 = item.FixedPerks.count(); if (num3 > 0) { IconWithText text = this.Perks[0]; PerkInstance instance2 = item.FixedPerks.PerkInstances[0]; ConfigPerks.SharedData data = ConfigPerks.SHARED_DATA[instance2.Type]; text.gameObject.SetActive(true); text.Text.text = MenuHelpers.GetFormattedPerkDescription(instance2.Type, instance2.Modifier, data.DurationSeconds, data.Threshold, 0f, false); } else { this.Perks[0].gameObject.SetActive(false); } int count = this.ItemInstance.Perks.PerkInstances.Count; for (int i = 1; i < this.Perks.Count; i++) { IconWithText text2 = this.Perks[i]; PerkInstance instance3 = null; if ((this.ItemInstance != null) && ((i - 1) < count)) { instance3 = this.ItemInstance.Perks.PerkInstances[i - 1]; } if (instance3 != null) { ConfigPerks.SharedData data2 = ConfigPerks.SHARED_DATA[instance3.Type]; text2.gameObject.SetActive(true); text2.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", data2.SmallSprite); if (this.ItemInstance != null) { text2.Text.text = MenuHelpers.GetFormattedPerkDescription(instance3.Type, instance3.Modifier, data2.DurationSeconds, data2.Threshold, 0f, true); } else { text2.Text.text = "CHANGE ME"; } } else { text2.gameObject.SetActive(false); } } this.PerksTitleDivier.SetActive((num3 + count) > 0); }
public void initialize(GameLogic.Item item) { this.Item = item; this.Button.interactable = this.Item != null; }
protected override void onPreShow([Optional, DefaultParameterValue(null)] object param) { this.m_inputParameters = (InputParameters)param; CharacterInstance activeCharacter = GameLogic.Binder.GameState.Player.ActiveCharacter; GameLogic.Item item = this.getReferenceItem(); switch (item.Type) { case ItemType.Weapon: this.Header.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.ITEMS_WEAPON, null, false)); this.PowerIcon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "icon_mini_weapon"); this.PowerDescription.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_POWER_ATTACK, null, false)); break; case ItemType.Armor: this.Header.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.ITEMS_ARMOR, null, false)); this.PowerIcon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "icon_mini_armor"); this.PowerDescription.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_POWER_DEFENSE, null, false)); break; case ItemType.Cloak: this.Header.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.ITEMS_CLOAK, null, false)); this.PowerIcon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "icon_mini_spell"); this.PowerDescription.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_POWER_SKILLDMG, null, false)); break; default: this.Header.text = "CHANGE ME"; this.PowerIcon.sprite = null; break; } this.Title.text = StringExtensions.ToUpperLoca(item.Name); this.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", item.SpriteId); MenuHelpers.RefreshStarContainer(this.Stars, item.Rarity); if (this.ItemInstance != null) { double num; double num2; if (!this.ItemInstance.InspectedByPlayer) { CmdInspectItem.ExecuteStatic(this.ItemInstance); } App.Binder.ConfigMeta.ItemSellCurve(activeCharacter, this.ItemInstance.Item.Type, this.ItemInstance.Rarity, this.ItemInstance.Level, this.ItemInstance.Rank, out num, out num2); this.SellButton.gameObject.SetActive(true); if (num > 0.0) { this.SellButton.ButtonLabelIcon.sprite = PlayerView.Binder.SpriteResources.getSprite(ConfigUi.RESOURCE_TYPE_SPRITES[ResourceType.Token]); this.SellButton.ButtonLabel.text = MenuHelpers.BigValueToString(num); } else { this.SellButton.ButtonLabelIcon.sprite = PlayerView.Binder.SpriteResources.getSprite(ConfigUi.RESOURCE_TYPE_SPRITES[ResourceType.Coin]); this.SellButton.ButtonLabel.text = MenuHelpers.BigValueToString(num2); } if (!ConfigMeta.CAN_SELL_HIGHEST_RARITY_ITEM && (this.ItemInstance.Rarity == ConfigMeta.ITEM_HIGHEST_RARITY)) { this.SellButton.ButtonHeader.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_VALUE, null, false)); } else { this.SellButton.ButtonHeader.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_SELL, null, false)); } this.EquipButton.gameObject.SetActive(true); this.EquipButtonImage.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "uix_button_selected"); } else { this.SellButton.gameObject.SetActive(false); this.EquipButton.gameObject.SetActive(false); } this.onRefresh(); }
public void refresh(CharacterInstance owner, GameLogic.ItemInstance itemInstance, GameLogic.Item item) { this.ItemInstance = itemInstance; this.Item = item; if (itemInstance != null) { this.Background.gameObject.SetActive(true); if (owner.isItemEquipped(itemInstance.Item)) { this.Background.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "sprite_ui_itemcard_equipped"); } else { this.Background.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "sprite_ui_itemcard_active"); } this.Button.interactable = true; this.Icon.gameObject.SetActive(true); this.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", itemInstance.Item.SpriteId); this.Icon.color = Color.white; this.IconBorders.gameObject.SetActive(true); this.IconBorders.enabled = true; this.IconBorders.material = null; if (owner.hasReachedUnlockFloorForItem(itemInstance)) { this.Icon.material = null; } else { this.Icon.material = !ConfigUi.MENU_UNEQUIPPABLE_ITEM_GREYSCALE_ENABLED ? null : this.m_greyscaleMaterial; } this.LevelIcon.gameObject.SetActive(false); this.Level.gameObject.SetActive(false); MenuHelpers.RefreshStarContainer(this.Stars, this.m_originalStarLocalPositions, itemInstance.Rarity, false); this.IndicatorNew.enabled = !itemInstance.InspectedByPlayer; this.IndicatorNewIcon.enabled = !itemInstance.InspectedByPlayer; this.ProgressBar.gameObject.SetActive(true); this.ProgressText.gameObject.SetActive(true); this.ProgressBarFill.color = Color.white; this.ProgressText.text = "Lv 0"; this.ProgressBar.setNormalizedValue(0f); this.ProgressBarFill.sprite = PlayerView.Binder.SpriteResources.getSprite("DungeonHud", "sprite_ui_progressbar_front_gold"); this.UnlockButtonRoot.SetActive(false); this.Name.gameObject.SetActive(true); this.Name.text = StringExtensions.ToUpperLoca(itemInstance.Item.Name); this.Type.text = itemInstance.Item.Type.ToString(); } else if (item != null) { this.Background.gameObject.SetActive(true); this.Background.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "sprite_ui_itemcard_inactive"); this.Button.interactable = true; this.Icon.gameObject.SetActive(true); this.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", item.SpriteId); this.Icon.material = this.m_greyscaleMaterial; this.Icon.color = Color.white; this.IconBorders.gameObject.SetActive(true); this.IconBorders.enabled = true; this.LevelIcon.gameObject.SetActive(false); this.Level.gameObject.SetActive(false); MenuHelpers.RefreshStarContainer(this.Stars, this.m_originalStarLocalPositions, item.Rarity, false); this.IconBorders.material = this.m_greyscaleMaterial; this.LevelIcon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", ConfigUi.RARITY_ITEM_LEVEL_BACKGROUND_SPRITES[0]); this.IndicatorNew.enabled = false; this.IndicatorNewIcon.enabled = false; int num = owner.getShardCountForItem(item); this.UnlockButtonRoot.SetActive(false); this.ProgressBar.gameObject.SetActive(true); this.ProgressText.gameObject.SetActive(true); this.ProgressBar.setNormalizedValue(Mathf.Clamp01(((float)num) / 1f)); this.ProgressText.text = num + "/" + 1f; this.ProgressBarFill.sprite = PlayerView.Binder.SpriteResources.getSprite("DungeonHud", "sprite_ui_progressbar_front_blue"); this.Name.gameObject.SetActive(true); this.Name.text = StringExtensions.ToUpperLoca(item.Name); this.Type.text = item.Type.ToString(); } else { this.Background.gameObject.SetActive(false); this.Button.interactable = false; this.Icon.gameObject.SetActive(false); this.IconBorders.gameObject.SetActive(false); for (int i = 0; i < 5; i++) { this.Stars[i].enabled = false; } this.LevelIcon.gameObject.SetActive(false); this.Level.gameObject.SetActive(false); this.IndicatorNew.enabled = false; this.IndicatorNewIcon.enabled = false; this.ProgressBar.gameObject.SetActive(false); this.ProgressText.gameObject.SetActive(false); this.UnlockButtonRoot.SetActive(false); this.Name.gameObject.SetActive(false); this.Type.gameObject.SetActive(false); } }