protected override void Init(string path)
    {
        base.Init(path);
        if (string.IsNullOrEmpty(path))
        {
            CDebug.LogError("XStaticAssetLoader 空资源路径!");
        }

        _assetFileLoader = CAssetFileLoader.Load(path, (_isOk, _obj) =>
        {
            if (IsReadyDisposed)
            {
                OnFinish(null);
                return;
            }

            TheAsset = Object.Instantiate(_obj);
            OnFinish(TheAsset);

            if (Application.isEditor)
            {
                if (TheAsset != null)
                {
                    CResourceLoadObjectDebugger.Create("StaticAsset", path, TheAsset);
                }
            }
        });
    }
Exemple #2
0
    protected override void Init(string url)
    {
        base.Init(url);

        Path            = url;
        AssetFileBridge = CAssetFileLoader.Load(Path, OnAssetLoaded);
    }
Exemple #3
0
    protected override void Init(string url)
    {
        base.Init(url);

        _assetFileBridge = CAssetFileLoader.Load(url, (isOk, asset) =>
        {
            if (IsReadyDisposed)  // 中途释放
            {
                OnFinish(null);
                return;
            }
            if (!isOk)
            {
                OnFinish(null);
                CDebug.LogError("[InstanceAssetLoader]Error on assetfilebridge loaded... {0}", url);
                return;
            }

            try
            {
                InstanceAsset = (GameObject)GameObject.Instantiate(asset as UnityEngine.GameObject);
            }
            catch (Exception e)
            {
                CDebug.LogException(e);
            }

            if (Application.isEditor)
            {
                CResourceLoadObjectDebugger.Create("AssetCopy", url, InstanceAsset);
            }

            OnFinish(InstanceAsset);
        });
    }
Exemple #4
0
 protected override void Init(string url)
 {
     base.Init(url);
     _assetFileBridge = CAssetFileLoader.Load(url, (isOk, asset) =>
     {
         OnFinish(asset);
     });
 }
    protected override void Init(string url)
    {
        base.Init(url);

        AssetFileBridge = CAssetFileLoader.Load(url, (bool isOk, UnityEngine.Object obj) =>
        {
            OnFinish(obj);
        });
    }
Exemple #6
0
    protected override void Init(string url)
    {
        base.Init(url);

        _bridge = CAssetFileLoader.Load(Url, (_isOk, _obj) =>
        {
            OnFinish(_obj);
        });
    }
Exemple #7
0
 //仅仅是预加载,回调仅告知是否加载成功
 public static CAssetFileLoader Preload(string path, System.Action <bool> callback = null)
 {
     return(CAssetFileLoader.Load(path, (isOk, asset) =>
     {
         if (callback != null)
         {
             callback(isOk);
         }
     }));
 }
Exemple #8
0
    //仅仅是预加载,回调仅告知是否加载成功
    public static IEnumerator CoPreload(string path, System.Action <bool> callback = null)
    {
        var w = CAssetFileLoader.Load(path, null);

        while (!w.IsFinished)
        {
            yield return(null);
        }

        if (callback != null)
        {
            callback(!w.IsError);  // isOk?
        }
    }