using Duckov.UI; using Duckov.Utilities; using ItemStatsSystem; using TMPro; using UnityEngine; using UnityEngine.UI; namespace DisplayItemValue { public class ModBehaviour : Duckov.Modding.ModBehaviour { TextMeshProUGUI _text = null; TextMeshProUGUI Text { get { if (_text == null) { _text = Instantiate(GameplayDataSettings.UIStyle.TemplateTextUGUI); } return _text; } } void Awake() { Debug.Log("DisplayItemValue Loaded!!!"); } void OnDestroy() { if (_text != null) Destroy(_text); } void OnEnable() { ItemHoveringUI.onSetupItem += OnSetupItemHoveringUI; } void OnDisable() { ItemHoveringUI.onSetupItem -= OnSetupItemHoveringUI; } private void OnSetupItemHoveringUI(ItemHoveringUI uiInstance, Item item) { if (item == null) { Text.gameObject.SetActive(false); return; } Text.gameObject.SetActive(true); Text.transform.SetParent(uiInstance.LayoutParent); Text.transform.localScale = Vector3.one; Text.text = $"${item.GetTotalRawValue() / 2}"; Text.fontSize = 20f; } } }