diff options
| author | chai <215380520@qq.com> | 2024-05-19 16:05:01 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-19 16:05:01 +0800 |
| commit | c5f145786f4c6d2fe4bea831dfc16e52228920a5 (patch) | |
| tree | a6ead7ea8266c767d58ed0f816dcd7a1dd75bd65 /GameCode/PerkSelectionTooltipHelper.cs | |
| parent | 48b64e573a1709dc923cb9162b55be0246b3ff63 (diff) | |
* move
Diffstat (limited to 'GameCode/PerkSelectionTooltipHelper.cs')
| -rw-r--r-- | GameCode/PerkSelectionTooltipHelper.cs | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/GameCode/PerkSelectionTooltipHelper.cs b/GameCode/PerkSelectionTooltipHelper.cs deleted file mode 100644 index 9ea47af..0000000 --- a/GameCode/PerkSelectionTooltipHelper.cs +++ /dev/null @@ -1,115 +0,0 @@ -using I2.Loc; -using MPUIKIT; -using TMPro; -using UnityEngine; -using UnityEngine.UI; - -public class PerkSelectionTooltipHelper : MonoBehaviour -{ - public UIFrame targetFrame; - - public TextMeshProUGUI selectionTitle; - - public TextMeshProUGUI selectionDescription; - - public Image selectionIcon; - - public MPImageBasic background; - - public UIParentResizer sizer; - - public bool disableOnNullSelect; - - public GameObject tooltipParent; - - private TFUIEquippable currentElement; - - public void OnSelection() - { - if (targetFrame.CurrentSelection == null) - { - return; - } - TFUIEquippable tFUIEquippable = targetFrame.CurrentSelection as TFUIEquippable; - if (tFUIEquippable == null) - { - if (disableOnNullSelect) - { - tooltipParent.SetActive(value: false); - } - return; - } - if ((bool)tooltipParent) - { - tooltipParent.SetActive(value: true); - } - currentElement = tFUIEquippable; - UpdateTooltip(); - } - - public void OnFocus() - { - if (targetFrame.CurrentFocus == null) - { - OnSelection(); - return; - } - if ((bool)tooltipParent) - { - tooltipParent.SetActive(value: true); - } - TFUIEquippable tFUIEquippable = targetFrame.CurrentFocus as TFUIEquippable; - if (tFUIEquippable == null) - { - if (disableOnNullSelect) - { - tooltipParent.SetActive(value: false); - } - } - else - { - currentElement = tFUIEquippable; - UpdateTooltip(); - } - } - - public void UpdateTooltip() - { - if (currentElement == null) - { - return; - } - string text = ""; - string text2 = ""; - Equippable data = currentElement.Data; - if (currentElement.Locked) - { - text = LocalizationManager.GetTranslation("Menu/Locked"); - text2 = LocalizationManager.GetTranslation("Menu/Locked Choice Description"); - if (data is EquippableWeapon) - { - text2 = LocalizationManager.GetTranslation("Menu/Locked Weapon Description"); - } - else if (data is EquippablePerk) - { - text2 = LocalizationManager.GetTranslation("Menu/Locked Perk Description"); - } - else if (data is EquippableMutation) - { - text2 = LocalizationManager.GetTranslation("Menu/Locked Mutator Description"); - } - selectionIcon.sprite = currentElement.IconImg.sprite; - } - else - { - text = LocalizationManager.GetTranslation(data.LOCIDENTIFIER_NAME); - text2 = LocalizationManager.GetTranslation(data.LOCIDENTIFIER_DESCRIPTION); - selectionIcon.sprite = data.icon; - } - selectionTitle.text = text; - selectionDescription.text = text2; - background.color = currentElement.GetBackgroundColor; - selectionIcon.color = currentElement.GetIconColor; - sizer.Trigger(); - } -} |
