using UnityEngine; using UnityEngine.UI; using QFramework; using DG.Tweening; using System; namespace QFramework.Example { public class UILoadingData : UIPanelData { } public partial class UILoading : UIPanel { AsyncOperation ao; protected override void OnInit(IUIData uiData = null) { mData = uiData as UILoadingData ?? new UILoadingData(); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register(arg => { if (gameObject.activeSelf == false) { Show(); } }).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject); } public void SetAsyncOperation(AsyncOperation ao) { this.ao = ao; } protected override void OnOpen(IUIData uiData = null) { //Icon.GetComponent().DORestart(); Progress.text = ""; } private void Update() { if (ao != null) { Progress.text = ao.progress.ToString("P0"); } } protected override void OnShow() { } protected override void OnHide() { } protected override void OnClose() { } } }