private void OnLoadCompleted(AssetRequest request) { m_assetRequest = request; if (!string.IsNullOrEmpty(request.error)) { request.Release(); GameLog.LogError("加载界面失败:" + panelName); return; } m_loadState = LoadState.LOADED; // 实例化 m_parent = UIModule.GetParent(viewType); gameObject = GameObject.Instantiate(request.asset as GameObject, m_parent); gameObject.SetActive(true); gameObject.name = request.asset.name; transform = gameObject.transform; UI = HierarchyUtil.GetHierarchyItems(gameObject); OnLoaded(); AddAllListener(); if (m_loadedCallback != null) { m_loadedCallback(this); } }
private void OnLoadComplete(AssetRequest request) { if (!string.IsNullOrEmpty(request.error)) { request.Release(); return; } this.sprite = request.asset as Sprite; }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } _request.Release(); _request = null; Instance = null; GC.Collect(); GC.SuppressFinalize(this); }
private void OnCompleted(AssetRequest request) { if (!string.IsNullOrEmpty(request.error)) { request.Release(); return; } var go = Instantiate(temp.gameObject, temp.transform.parent); go.SetActive(true); go.name = request.asset.name; var image = go.GetComponent <Image> (); image.sprite = request.asset as Sprite; _gos.Add(go); }
private void OnLoadCompleted(AssetRequest assetRequest) { m_assetRequest = assetRequest; if (!string.IsNullOrEmpty(assetRequest.error)) { assetRequest.Release(); GameLog.LogError("加载场景失败:" + panelName); return; } LoadState = LoadState.LOADED; if (m_loadedCallback != null) { m_loadedCallback.Invoke(assetRequest); } }
public static void UnloadAsset(AssetRequest asset) { asset.Release(); }
public void ClosePanel() { request.Release(); //Destroy(go); }