protected override void UpdateData() { var skill = Data; if (uiCraftingItem != null) { if (skill == null || skill.craftingItem == null) { uiCraftingItem.Hide(); } else { uiCraftingItem.Show(); uiCraftingItem.Data = new CharacterItemLevelTuple(CharacterItem.Create(skill.craftingItem), 1); } } if (uiRequireItemAmounts != null) { if (skill == null) { uiRequireItemAmounts.Hide(); } else { uiRequireItemAmounts.Show(); uiRequireItemAmounts.Data = skill.CacheCraftRequirements; } } }
protected override void UpdateData() { var characterHotkey = Data; var skill = characterHotkey.GetSkill(); var item = characterHotkey.GetItem(); var owningCharacter = BasePlayerCharacterController.OwningCharacter; if (uiCharacterSkill != null) { if (skill == null) { uiCharacterSkill.Hide(); } else { var index = owningCharacter.IndexOfSkill(characterHotkey.dataId); if (index >= 0 && index < owningCharacter.skills.Count) { var characterSkill = owningCharacter.skills[index]; uiCharacterSkill.Setup(new CharacterSkillLevelTuple(characterSkill, characterSkill.level), owningCharacter, index); uiCharacterSkill.Show(); } else { uiCharacterSkill.Hide(); } } } if (uiCharacterItem != null) { if (item == null) { uiCharacterItem.Hide(); } else { var index = owningCharacter.IndexOfNonEquipItem(characterHotkey.dataId); if (index >= 0 && index < owningCharacter.nonEquipItems.Count) { var characterItem = owningCharacter.nonEquipItems[index]; uiCharacterItem.Setup(new CharacterItemLevelTuple(characterItem, characterItem.level), owningCharacter, index, string.Empty); uiCharacterItem.Show(); } else { uiCharacterItem.Hide(); } } } }
protected void OnSelectCharacterItem(UICharacterItem ui) { var uiGameplay = UISceneGameplay.Singleton; if (uiGameplay != null) { uiGameplay.DeselectSelectedItem(); } if (uiItemDialog != null && ui.Data.characterItem.IsValid()) { uiItemDialog.selectionManager = SelectionManager; uiItemDialog.Setup(ui.Data, character, ui.indexOfData, ui.equipPosition); uiItemDialog.Show(); } else if (uiGameplay != null) { uiGameplay.DeselectSelectedItem(); } }
protected override void UpdateData() { var characterItem = Data.characterItem; var level = Data.targetLevel; var item = characterItem.GetItem(); var equipmentItem = characterItem.GetEquipmentItem(); var armorItem = characterItem.GetArmorItem(); var weaponItem = characterItem.GetWeaponItem(); if (level <= 0) { onSetLevelZeroData.Invoke(); } else { onSetNonLevelZeroData.Invoke(); } if (equipmentItem != null) { if (!string.IsNullOrEmpty(equipPosition)) { onSetEquippedData.Invoke(); } else { onSetUnEquippedData.Invoke(); } } else { onSetUnEquippableData.Invoke(); } if (textTitle != null) { textTitle.text = string.Format(titleFormat, item == null ? "Unknow" : item.title); } if (textDescription != null) { textDescription.text = string.Format(descriptionFormat, item == null ? "N/A" : item.description); } if (textLevel != null) { textLevel.text = string.Format(levelFormat, level.ToString("N0")); } if (imageIcon != null) { var iconSprite = item == null ? null : item.icon; imageIcon.gameObject.SetActive(iconSprite != null); imageIcon.sprite = iconSprite; } if (textItemType != null) { switch (item.itemType) { case ItemType.Junk: textItemType.text = string.Format(itemTypeFormat, junkItemType); break; case ItemType.Armor: textItemType.text = string.Format(itemTypeFormat, armorItem.ArmorType.title); break; case ItemType.Weapon: textItemType.text = string.Format(itemTypeFormat, weaponItem.WeaponType.title); break; case ItemType.Shield: textItemType.text = string.Format(itemTypeFormat, shieldItemType); break; case ItemType.Potion: textItemType.text = string.Format(itemTypeFormat, potionItemType); break; case ItemType.Ammo: textItemType.text = string.Format(itemTypeFormat, ammoItemType); break; } } if (textSellPrice != null) { textSellPrice.text = string.Format(sellPriceFormat, item == null ? "0" : item.sellPrice.ToString("N0")); } if (textStack != null) { var stackString = ""; if (item == null) { stackString = string.Format(stackFormat, "0", "0"); } else { stackString = string.Format(stackFormat, characterItem.amount.ToString("N0"), item.maxStack); } textStack.text = stackString; textStack.gameObject.SetActive(hideAmountWhenMaxIsOne && item.maxStack > 1); } if (textDurability != null) { var durabilityString = ""; if (item == null) { durabilityString = string.Format(durabilityFormat, "0", "0"); } else { durabilityString = string.Format(durabilityFormat, characterItem.durability.ToString("N0"), item.maxDurability); } textDurability.text = durabilityString; textDurability.gameObject.SetActive(equipmentItem != null && item.maxDurability > 0); } if (textWeight != null) { textWeight.text = string.Format(weightFormat, item == null ? "0" : item.weight.ToString("N2")); } if (uiRequirement != null) { if (equipmentItem == null || (equipmentItem.requirement.level == 0 && equipmentItem.requirement.character == null && equipmentItem.CacheRequireAttributeAmounts.Count == 0)) { uiRequirement.Hide(); } else { uiRequirement.Show(); uiRequirement.Data = equipmentItem; } } if (uiStats != null) { var stats = equipmentItem.GetIncreaseStats(level, characterItem.GetEquipmentBonusRate()); if (equipmentItem == null || stats.IsEmpty()) { uiStats.Hide(); } else { uiStats.Show(); uiStats.Data = stats; } } if (uiIncreaseAttributes != null) { var attributes = equipmentItem.GetIncreaseAttributes(level, characterItem.GetEquipmentBonusRate()); if (equipmentItem == null || attributes == null || attributes.Count == 0) { uiIncreaseAttributes.Hide(); } else { uiIncreaseAttributes.Show(); uiIncreaseAttributes.Data = attributes; } } if (uiIncreaseResistances != null) { var resistances = equipmentItem.GetIncreaseResistances(level, characterItem.GetEquipmentBonusRate()); if (equipmentItem == null || resistances == null || resistances.Count == 0) { uiIncreaseResistances.Hide(); } else { uiIncreaseResistances.Show(); uiIncreaseResistances.Data = resistances; } } if (uiIncreaseDamageAmounts != null) { var damageAmounts = equipmentItem.GetIncreaseDamages(level, characterItem.GetEquipmentBonusRate()); if (equipmentItem == null || damageAmounts == null || damageAmounts.Count == 0) { uiIncreaseDamageAmounts.Hide(); } else { uiIncreaseDamageAmounts.Show(); uiIncreaseDamageAmounts.Data = damageAmounts; } } if (uiDamageAmounts != null) { if (weaponItem == null) { uiDamageAmounts.Hide(); } else { uiDamageAmounts.Show(); var keyValuePair = weaponItem.GetDamageAmount(level, characterItem.GetEquipmentBonusRate(), null); uiDamageAmounts.Data = new DamageElementAmountTuple(keyValuePair.Key, keyValuePair.Value); } } if (uiNextLevelItem != null) { if (level + 1 > item.maxLevel) { uiNextLevelItem.Hide(); } else { uiNextLevelItem.Setup(new CharacterItemLevelTuple(characterItem, (short)(level + 1)), character, indexOfData, equipPosition); uiNextLevelItem.Show(); } } }