private bool LoadDependencyAsset(string assetName, AssetCategory assetCategory, int priority, LoadResourceTaskBase mainTask, object userData)
        {
            if (mainTask == null)
            {
                throw new Exception("Main task is invalid.");
            }

            ResourceInfo resourceInfo = null;
            Dictionary <string, AssetCategory> dependencyAssetNames = null;

            if (!CheckAsset(assetName, assetCategory, out resourceInfo, out dependencyAssetNames))
            {
                return(false);
            }

            if (resourceInfo.IsLoadFromBinary)
            {
                return(false);
            }

            LoadDependencyAssetTask dependencyTask = LoadDependencyAssetTask.Create(assetName, assetCategory, priority, resourceInfo, dependencyAssetNames, mainTask, userData);

            foreach (var item in dependencyAssetNames)
            {
                if (!LoadDependencyAsset(item.Key, item.Value, priority, dependencyTask, userData))
                {
                    return(false);
                }
            }

            m_TaskPool.AddTask(dependencyTask);
            if (!resourceInfo.Ready)
            {
                m_ResourceComponent.UpdateResource(resourceInfo.ResourceName);
            }

            return(true);
        }
Example #2
0
 public override void Clear()
 {
     base.Clear();
     m_MainTask = null;
 }
Example #3
0
 public LoadDependencyAssetTask()
 {
     m_MainTask = null;
 }
Example #4
0
        public static LoadDependencyAssetTask Create(string assetName, AssetCategory assetCategory, int priority, ResourceInfo resourceInfo, Dictionary <string, AssetCategory> dependencyAssetNames, LoadResourceTaskBase mainTask, object userData)
        {
            LoadDependencyAssetTask loadDependencyAssetTask = ReferencePool.Acquire <LoadDependencyAssetTask>();

            loadDependencyAssetTask.Initialize(assetName, assetCategory, null, priority, resourceInfo, dependencyAssetNames, userData);
            loadDependencyAssetTask.m_MainTask = mainTask;
            loadDependencyAssetTask.m_MainTask.TotalDependencyAssetCount++;
            return(loadDependencyAssetTask);
        }