Example #1
0
        public ILoadState CreateLoadTask(string[] assetPaths, OnLoadTaskComplete onTaskComplete, int priority, ELoaderType loaderType)
        {
            ILoadTask task = GetTask();

            task.AddTaskCallBack(onTaskComplete);
            int loaderCount = assetPaths == null ? 0 : assetPaths.Length;

            //set loader count first, then the task could check if completed...
            task.SetLoaderCount(loaderCount);

            if (assetPaths != null)
            {
                for (int i = 0; i < assetPaths.Length; i++)
                {
                    ILoader loader = GetLoader(assetPaths[i], priority, loaderType);
                    loader.AddTask(task);
                }
            }

            ILoadState state = GetState();

            state.SetTask(task);
            return(state);
        }