Exemplo n.º 1
0
        public static ManifestRequest Initialize()
        {
            var instance = FindObjectOfType <Assets>();

            if (instance == null)
            {
                instance = new GameObject("Assets").AddComponent <Assets>();
                DontDestroyOnLoad(instance.gameObject);
            }

            if (string.IsNullOrEmpty(basePath))
            {
                basePath = Application.streamingAssetsPath + Path.DirectorySeparatorChar;
            }

            if (string.IsNullOrEmpty(updatePath))
            {
                updatePath = Application.persistentDataPath + Path.DirectorySeparatorChar;
            }

            Clear();

            Log(string.Format(
                    "Initialize with: runtimeMode={0}\nbasePath:{1}\nupdatePath={2}",
                    runtimeMode, basePath, updatePath));

            var request = new ManifestRequest {
                name = ManifestAsset
            };

            AddAssetRequest(request);
            return(request);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns></returns>
        public static ManifestRequest Initialize()
        {
            var instance = FindObjectOfType <Assets> ();

            if (instance == null)
            {
                instance = new GameObject("Assets").AddComponent <Assets> ();
                DontDestroyOnLoad(instance.gameObject);
            }


            if (string.IsNullOrEmpty(basePath))
            {
                basePath = Application.streamingAssetsPath;
            }

            dataPath = Path.Combine(basePath, AssetBundles) + Path.DirectorySeparatorChar;
            if (string.IsNullOrEmpty(updatePath))
            {
                updatePath = Path.Combine(Application.persistentDataPath, AssetBundles) + Path.DirectorySeparatorChar;
            }

            RemoveUnusedAssets();

            _searchPaths.Clear();
            _activeVariants.Clear();
            _assetToBundles.Clear();
            _bundleToDependencies.Clear();

            Log(string.Format(
                    "Initialize with: runtimeMode={0}\nbasePath:{1}\nupdatePath={2}\ndataPath={3}",
                    runtimeMode, basePath, updatePath, dataPath));

            var request = new ManifestRequest {
                url = ManifestAsset
            };

            AddAssetRequest(request);
            return(request);
        }
Exemplo n.º 3
0
        public static ManifestRequest Initialize()
        {
            var instance = FindObjectOfType <Assets>();

            if (instance == null)
            {
                instance = new GameObject("Assets").AddComponent <Assets>();
                DontDestroyOnLoad(instance.gameObject);
                Application.lowMemory += RemoveUnusedAssets;
            }

            if (string.IsNullOrEmpty(basePath))
            {
                basePath = Application.streamingAssetsPath + Path.DirectorySeparatorChar;
            }

            if (string.IsNullOrEmpty(updatePath))
            {
                updatePath = Application.persistentDataPath + Path.DirectorySeparatorChar;
            }

            Log(string.Format(
                    "Initialize with: Development={0}\nbasePath:{1}\nupdatePath={2}",
                    Development, basePath, updatePath));

            if (Development)
            {
                if (EditorSearcher != null)
                {
                    _searchPaths.AddRange(EditorSearcher());
                }
            }

            var request = new ManifestRequest {
                url = ManifestAsset
            };

            AddAssetRequest(request);
            return(request);
        }