using Common.Utility.CombatEvent; using Fort23.Core; using UnityEngine; namespace Fort23.Mono { [UIBinding(prefab = "ShowTextPanel")] public partial class ShowTextPanel : UIPanel { public static async CTask OpenShowTextPanel() { ShowTextPanel showTextPanel = await UIManager.Instance.LoadAndOpenPanel(null, UILayer.Top, isFocus: false); } private void Init() { } protected override void AddEvent() { EventManager.Instance.AddEventListener(CustomEventType.ShowText, ShowText); } protected async void ShowText(IEventData eventData) { ShowTextEventData showTextEventData = eventData as ShowTextEventData; Vector3 worldPos = showTextEventData.worldPos; string text = showTextEventData.text; Color Color = showTextEventData.Color; TextWidget widget = await UIManager.Instance.CreateGComponentForObject(textWidget, null, transform, isInstance: true); Vector2 pos = UIManager.Instance.WorldToUIWorld(worldPos); widget.transform.position = pos; widget.ShowWidget(text, Color); } protected override void DelEvent() { EventManager.Instance.RemoveEventListener(CustomEventType.ShowText, ShowText); } public override void AddButtonEvent() { } } }