Beispiel #1
0
        LoadReturnArgs LoadCommonAsset(ref CommonLoadArgs args, AssetBundleTaskType type = AssetBundleTaskType.Sync | AssetBundleTaskType.LoadAsset)
        {
            if (_assetBundleFeature != null)
            {
                AssetBundleContext context = _assetBundleFeature.StartRead();

                AssetBundleInfo info;
                GameAssetBundle gameAssetBundle;
                if (CanLoad(ref context, args.AssetPath, out info, out gameAssetBundle))
                {
                    AssetBundleTask task = new AssetBundleTask();
                    //
                    task.AssetInfo    = info;
                    task.TaskLoadType = type;
                    task.TaskId       = ++_taskid;
                    task.TaskResType  = TaskResType.Common;
                    task.Priority     = args.Priority;
                    task.CreateTime   = Time.realtimeSinceStartup;

                    //
                    Debug.LogFormat("Task ---- {0} Created", task);

                    context.AddTask(ref task);
                    _assetBundleFeature.EndRead(ref context);

                    LoadReturnArgs returnArgs = new LoadReturnArgs(this._assetBundleFeature, task.TaskId);
                    return(returnArgs);
                }
            }

            return(default(LoadReturnArgs));
        }
Beispiel #2
0
        LoadReturnArgs LoadAssetScene(ref SceneLoadArgs args, AssetBundleTaskType type = AssetBundleTaskType.LoadAsset | AssetBundleTaskType.Sync)
        {
            if (_assetBundleFeature != null)
            {
                AssetBundleContext context = _assetBundleFeature.StartRead();

                AssetBundleInfo info;
                GameAssetBundle gameAssetBundle;
                if (CanLoad(ref context, args.AssetPath, out info, out gameAssetBundle))
                {
                    AssetBundleTask task = new AssetBundleTask();
                    task.AssetInfo     = info;
                    task.TaskLoadType  = type;
                    task.TaskId        = ++_taskid;
                    task.TaskResType   = TaskResType.Scene;
                    task.Priority      = args.Priority;
                    task.CreateTime    = Time.realtimeSinceStartup;
                    task.LoadSceneMode = args.SceneMode;

                    context.AddTask(ref task);
                    _assetBundleFeature.EndRead(ref context);

                    LoadReturnArgs returnArgs = new LoadReturnArgs(this._assetBundleFeature, task.TaskId);
                    return(returnArgs);
                }
            }
            return(default(LoadReturnArgs));
        }