public void OpenAsync(string AssestPath, IUIData UIData, Action <IBaseUI> finishCallback = null, bool bMonoBehaviour = false) { IBaseUI ui = CheckCache(AssestPath, UIData); if (ui != null) { if (finishCallback != null) { finishCallback.Invoke(ui); } return; } IAssurerLoader loader = VLoader.EasyGet(); CreateUIAsync(AssestPath, (UI) => { if (UI == null && finishCallback != null) { finishCallback.Invoke(null); return; } Push(UI, UIData); UI.Init(AssestPath, UIData, loader, bMonoBehaviour); UI.Show(); if (finishCallback != null) { finishCallback.Invoke(UI); } }, ref loader); }
/// <summary> /// 通用打开方法 /// </summary> /// <param name="AssestPath">资产路径</param> /// <param name="UIData">UI数据</param> /// <param name="bMonoBehaviour">UI是否开启生命周期</param> public IBaseUI Open(string AssestPath, IUIData UIData, bool bMonoBehaviour = false) { IBaseUI UI = CheckCache(AssestPath, UIData); if (UI != null) { return(UI); } IAssurerLoader loader = VLoader.EasyGet(); UI = CreateUISync(AssestPath, ref loader); if (UI == null) { return(UI); } Push(UI, UIData); UI.Init(AssestPath, UIData, loader, bMonoBehaviour); UI.Show(); return(UI); }
public static void RecycleSelf(this VLoader loader) { EasyPool <VLoader> .Instance.Recycle(loader); }