This commit is contained in:
2025-10-21 20:09:31 +08:00
commit 2a79a885eb
21 changed files with 1309 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
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;
}
}
}