Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
    private void OnLoadComplete(AssetRequest request)
    {
        if (!string.IsNullOrEmpty(request.error))
        {
            request.Release();
            return;
        }

        this.sprite = request.asset as Sprite;
    }
Esempio n. 3
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     _request.Release();
     _request = null;
     Instance = null;
     GC.Collect();
     GC.SuppressFinalize(this);
 }
Esempio n. 4
0
    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);
    }
Esempio n. 5
0
    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);
        }
    }
Esempio n. 6
0
 public static void UnloadAsset(AssetRequest asset)
 {
     asset.Release();
 }
Esempio n. 7
0
 public void ClosePanel()
 {
     request.Release();
     //Destroy(go);
 }