61 lines
1.5 KiB
C#
Raw Normal View History

2024-12-14 18:27:59 +08:00
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
2024-12-14 18:27:59 +08:00
namespace QFramework.Example
{
public class UIDeviceTipData : UIPanelData
{
2025-03-27 13:14:48 +08:00
public string txt;
2024-12-14 18:27:59 +08:00
}
public partial class UIDeviceTip : UIPanel
{
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIDeviceTipData ?? new UIDeviceTipData();
// please add init code here
2025-01-09 09:43:15 +08:00
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
2024-12-14 18:27:59 +08:00
}
protected override void OnOpen(IUIData uiData = null)
{
2025-03-27 13:14:48 +08:00
if (uiData != null)
{
mData = uiData as UIDeviceTipData ?? new UIDeviceTipData();
Label.text = Regex.Replace(mData.txt, @"\\n", "\n");
}
2024-12-14 18:27:59 +08:00
}
2025-03-20 15:33:31 +08:00
#if !VR
public void Update()
2024-12-14 18:27:59 +08:00
{
if (Point.gameObject.activeSelf)
{
Point.anchoredPosition = Utility.GetScreenPosByObj(transform as RectTransform);
}
}
2025-03-20 15:33:31 +08:00
#endif
2024-12-14 18:27:59 +08:00
2025-03-27 13:14:48 +08:00
//public void Active(bool active)
//{
// Point.gameObject.SetActive(active);
//}
2024-12-14 18:27:59 +08:00
protected override void OnShow()
{
2025-03-27 13:14:48 +08:00
//Active(true);
2024-12-14 18:27:59 +08:00
}
protected override void OnHide()
{
2025-03-27 13:14:48 +08:00
//Active(false);
2024-12-14 18:27:59 +08:00
}
protected override void OnClose()
{
}
}
}