Esempio n. 1
0
            private bool LoadDependencyAsset(string assetName, int priority, LoadResourceTaskBase mainTask, object userData)
            {
                if (mainTask == null)
                {
                    throw new GameFrameworkException("Main task is invalid.");
                }

                ResourceInfo?resourceInfo = null;

                string[] dependencyAssetNames = null;
                if (!CheckAsset(assetName, out resourceInfo, out dependencyAssetNames))
                {
                    return(false);
                }

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

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

                foreach (string dependencyAssetName in dependencyAssetNames)
                {
                    if (!LoadDependencyAsset(dependencyAssetName, priority, dependencyTask, userData))
                    {
                        return(false);
                    }
                }

                m_TaskPool.AddTask(dependencyTask);
                return(true);
            }
            private bool LoadDependencyAsset(string assetName, int priority, LoadResourceTaskBase mainTask, object userData)
            {
                if (mainTask == null)
                {
                    throw new GameFrameworkException("Main task is invalid.");
                }

                ResourceInfo?resourceInfo = null;

                string[] dependencyAssetNames = null;

                if (!CheckAsset(assetName, out resourceInfo, out dependencyAssetNames))
                {
                    GameFrameworkLog.Debug("Can not load asset '{0}'.", assetName);
                    return(false);
                }

                LoadDependencyAssetTask dependencyTask = new LoadDependencyAssetTask(assetName, priority, resourceInfo.Value, dependencyAssetNames, mainTask, userData);

                foreach (string dependencyAssetName in dependencyAssetNames)
                {
                    if (!LoadDependencyAsset(dependencyAssetName, priority, dependencyTask, userData))
                    {
                        GameFrameworkLog.Debug("Can not load dependency asset '{0}' when load dependency asset '{1}'.", dependencyAssetName, assetName);
                        return(false);
                    }
                }

                m_TaskPool.AddTask(dependencyTask);
                return(true);
            }
 private bool LoadDependencyAsset(string assetName, LoadResourceTaskBase mainTask, userdata)
 {
     m_TaskPool.AddTask(dependencyTask);
     return(true);
 }