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); } }