73 lines
2.6 KiB
C#
Raw Normal View History

2025-09-24 09:50:39 +08:00
using System;
2025-09-19 17:28:05 +08:00
using UnityEngine;
2025-09-24 09:50:39 +08:00
using UnityEngine.Events;
2025-09-19 17:28:05 +08:00
using UnityEngine.UI;
using ZXKFramework;
2025-09-22 17:41:04 +08:00
namespace YiLiao.XinFeiTingZhen
2025-09-19 17:28:05 +08:00
{
public class ArrowPanel : UIBase
{
public override string GroupName => "ArrowPanel";
public override string Name => "ArrowPanel";
2025-09-24 09:50:39 +08:00
GameObject tip;
GameObject bg;
Text txt;
Button btn;
2025-09-19 17:28:05 +08:00
Coroutine coroutine;
Coroutine coroutine2;
public override void Init(IUIManager uictrl)
{
base.Init(uictrl);
2025-09-24 09:50:39 +08:00
txt = transform.FindFirst<Text>(<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
tip = transform.FindFirst("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ");
bg = transform.FindFirst("<22><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>");
btn = transform.FindFirst<Button>(<><D6B8><EFBFBD><EFBFBD>ť");
2025-09-19 17:28:05 +08:00
}
2025-09-24 09:50:39 +08:00
public void ShowTip(string str,Vector2 v, bool mask, int delayShowTime, int duration, UnityAction action)
2025-09-19 17:28:05 +08:00
{
2025-09-24 09:50:39 +08:00
coroutine = Game.Instance.IEnumeratorManager.Run(delayShowTime, () => {
bg.SetActive(mask);
2025-09-19 17:28:05 +08:00
SetActive(true);
2025-09-24 09:50:39 +08:00
tip.SetActive(true);
tip.GetComponent<RectTransform>().anchoredPosition = v;
txt.text = str;
btn.onClick.RemoveAllListeners();
btn.onClick.AddListener(() => {
SetActive(false);
action?.Invoke();
2025-09-19 17:28:05 +08:00
});
2025-09-24 09:50:39 +08:00
coroutine2 = Game.Instance.IEnumeratorManager.Run(duration, () => {
SetActive(false);
action?.Invoke();
2025-09-19 17:28:05 +08:00
});
});
}
2025-09-24 09:50:39 +08:00
public void ShowTip(string str, Transform v, bool mask, int delayShowTime, int duration, UnityAction action)
2025-09-19 17:28:05 +08:00
{
2025-09-24 09:50:39 +08:00
coroutine = Game.Instance.IEnumeratorManager.Run(delayShowTime, () => {
bg.SetActive(mask);
2025-09-19 17:28:05 +08:00
SetActive(true);
2025-09-24 09:50:39 +08:00
tip.SetActive(true);
tip.transform.position = Camera.main.WorldToScreenPoint(v.position);
txt.text = str;
btn.onClick.RemoveAllListeners();
btn.onClick.AddListener(() => {
SetActive(false);
action?.Invoke();
});
coroutine2 = Game.Instance.IEnumeratorManager.Run(duration, () => {
SetActive(false);
action?.Invoke();
2025-09-19 17:28:05 +08:00
});
});
}
public override void Hide()
{
base.Hide();
Game.Instance.IEnumeratorManager.Stop(coroutine);
Game.Instance.IEnumeratorManager.Stop(coroutine2);
}
}
}