using UnityEngine; using UnityEngine.UI; using QFramework; using System.Security.Cryptography; using System.Text.RegularExpressions; namespace QFramework.Example { public class UIDeviceTipData : UIPanelData { public string txt; } public partial class UIDeviceTip : UIPanel { protected override void OnInit(IUIData uiData = null) { mData = uiData as UIDeviceTipData ?? new UIDeviceTipData(); // please add init code here TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } protected override void OnOpen(IUIData uiData = null) { if (uiData != null) { mData = uiData as UIDeviceTipData ?? new UIDeviceTipData(); Label.text = Regex.Replace(mData.txt, @"\\n", "\n"); } } #if !VR public void Update() { if (Point.gameObject.activeSelf) { Point.anchoredPosition = Utility.GetScreenPosByObj(transform as RectTransform); } } #endif public void Active(bool active) { Point.gameObject.SetActive(active); } protected override void OnShow() { Active(true); } protected override void OnHide() { Active(false); } protected override void OnClose() { } } }