diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-12 11:30:53 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-12 11:30:53 +0800 |
| commit | 7d000eb31b39c737a798057b15139f37a633530b (patch) | |
| tree | 4d0b5c4254ace847c65830e6b49b6206ed27ee17 /Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs | |
| parent | 08c53d1525c9a766ac86b31bf31f502d09a28b5f (diff) | |
增加区域提示 UI
Diffstat (limited to 'Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs')
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs new file mode 100644 index 0000000..ab03647 --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs @@ -0,0 +1,41 @@ +using System; +using TMPro; +using UnityEditor; +using UnityEngine; + +namespace SoulCoreGameLoop.UI +{ + [RequireComponent(typeof(Animator))] + public class AreaHint : MonoBehaviour, IUIEventSender<AreaHintMessage> + { + private const String TriggerPlay = "Play"; + + public TMP_Text areaName; + private Animator _animator; + + [InitializeOnLoadMethod] + public static void RegisterListener () + => UIEventListener.JoinListener<AreaHintMessage>(); + + public void OnReceive(AreaHintMessage evt) + { + areaName.text = evt.AreaName; + _animator.Play(TriggerPlay); + } + + private void Start() + { + _animator = GetComponent<Animator>(); + } + } + + public struct AreaHintMessage + { + public readonly string AreaName; + + public AreaHintMessage(string areaName) + { + AreaName = areaName; + } + } +} |
