From 7d000eb31b39c737a798057b15139f37a633530b Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Tue, 12 May 2026 11:30:53 +0800 Subject: 增加区域提示 UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs (limited to 'Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs') 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 + { + private const String TriggerPlay = "Play"; + + public TMP_Text areaName; + private Animator _animator; + + [InitializeOnLoadMethod] + public static void RegisterListener () + => UIEventListener.JoinListener(); + + public void OnReceive(AreaHintMessage evt) + { + areaName.text = evt.AreaName; + _animator.Play(TriggerPlay); + } + + private void Start() + { + _animator = GetComponent(); + } + } + + public struct AreaHintMessage + { + public readonly string AreaName; + + public AreaHintMessage(string areaName) + { + AreaName = areaName; + } + } +} -- cgit