Esempio n. 1
0
        public IEnumerator InitResMgrAsync()
        {
#if UNITY_EDITOR
            if (AssetBundleSettings.SimulateAssetBundleInEditor)
            {
                ResKit.ResData = EditorRuntimeAssetDataCollector.BuildDataTable();
                yield return(null);
            }
            else
#endif
            {
                ResKit.ResData.Reset();

                var    outResult  = new List <string>();
                string pathPrefix = "";
#if UNITY_EDITOR || UNITY_IOS
                pathPrefix = "file://";
#endif
                // 未进行过热更
                if (ResKit.LoadResFromStreammingAssetsPath)
                {
                    string streamingPath = Application.streamingAssetsPath + "/AssetBundles/" +
                                           AssetBundleSettings.GetPlatformName() + "/" + ResKit.ResData.FileName;
                    outResult.Add(pathPrefix + streamingPath);
                }
                // 进行过热更
                else
                {
                    string persistenPath = Application.persistentDataPath + "/AssetBundles/" +
                                           AssetBundleSettings.GetPlatformName() + "/" + ResKit.ResData.FileName;
                    outResult.Add(pathPrefix + persistenPath);
                }

                foreach (var outRes in outResult)
                {
                    Debug.Log(outRes);
                    yield return(ResKit.ResData.LoadFromFileAsync(outRes));
                }

                yield return(null);
            }
        }
Esempio n. 2
0
 public static string GetPlatformName()
 {
     return(AssetBundleSettings.GetPlatformName());
 }