12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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<ShowTextPanel>(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>(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()
- {
- }
- }
- }
|