static AssetManager() { Array values = Enum.GetValues(typeof(AssetManagerUtil.ModuleBundle)); foreach (Object obj in values) { AssetManagerUtil.ModuleBundle moduleBundle = (AssetManagerUtil.ModuleBundle)((Int32)obj); if (moduleBundle == AssetManagerUtil.ModuleBundle.FieldMaps) { Array values2 = Enum.GetValues(typeof(AssetManagerUtil.FieldMapBundleId)); foreach (Object obj2 in values2) { AssetManagerUtil.FieldMapBundleId bundleId = (AssetManagerUtil.FieldMapBundleId)((Int32)obj2); AssetManager._AddAssetBundleEntry(AssetManagerUtil.GetFieldMapBundleName(bundleId), 0); } } else if (moduleBundle == AssetManagerUtil.ModuleBundle.Sounds) { Array values3 = Enum.GetValues(typeof(AssetManagerUtil.SoundBundleId)); foreach (Object obj3 in values3) { AssetManagerUtil.SoundBundleId bundleId2 = (AssetManagerUtil.SoundBundleId)((Int32)obj3); AssetManager._AddAssetBundleEntry(AssetManagerUtil.GetSoundBundleName(bundleId2), 0); } } else { AssetManager._AddAssetBundleEntry(AssetManagerUtil.GetModuleBundleName(moduleBundle), 0); } } AssetManager._LoadAnimationFolderMapping(); }
public static AssetManagerRequest LoadAsync <T>(String name) where T : UnityEngine.Object { if (AssetManagerUtil.IsEmbededAssets(name)) { ResourceRequest resourceRequest = Resources.LoadAsync <T>(name); if (resourceRequest != null) { return(new AssetManagerRequest(resourceRequest, (AssetBundleRequest)null)); } } String text = AssetManagerUtil.GetResourcesBasePath() + name; text += AssetManagerUtil.GetAssetExtension <T>(name); Boolean flag = name.IndexOf("atlas_a") != -1; if (AssetManagerForObb.obbAssetBundle != (UnityEngine.Object)null) { AssetBundleRequest assetBundleRequest = AssetManagerForObb.obbAssetBundle.LoadAssetAsync(text); if (assetBundleRequest != null && assetBundleRequest.asset != (UnityEngine.Object)null) { return(new AssetManagerRequest((ResourceRequest)null, assetBundleRequest)); } } ResourceRequest resourceRequest2 = Resources.LoadAsync <T>(name); if (resourceRequest2 != null) { return(new AssetManagerRequest(resourceRequest2, (AssetBundleRequest)null)); } global::Debug.LogError("Cannot find " + name + " in bundles!!!"); return((AssetManagerRequest)null); }
public override void Load(SoundProfile profile, ISoundLoader.ResultCallback callback, SoundDatabase soundDatabase) { String text = AssetManagerUtil.GetStreamingAssetsPath() + "/Sounds/" + profile.ResourceID; SoundLib.Log("Load: " + text); FileInfo fileInfo = new FileInfo(text); Byte[] array = null; if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.IPhonePlayer) { array = File.ReadAllBytes(text); } else if (Application.platform == RuntimePlatform.Android) { } if (array != null) { IntPtr intPtr = Marshal.AllocHGlobal((Int32)fileInfo.Length); Marshal.Copy(array, 0, intPtr, (Int32)fileInfo.Length); Int32 bankID = ISdLibAPIProxy.Instance.SdSoundSystem_AddData(intPtr); profile.AkbBin = intPtr; profile.BankID = bankID; } else { SoundLib.Log("akbBytes is null"); } callback(profile, soundDatabase); }
public static T Load <T>(String name, Boolean suppressError = false) where T : UnityEngine.Object { T t = Resources.Load <T>(name); if (t != (UnityEngine.Object)null) { return(t); } String text = AssetManagerUtil.GetResourcesBasePath() + name; text += AssetManagerUtil.GetAssetExtension <T>(name); Boolean flag = name.IndexOf("atlas_a") != -1; if (AssetManagerForObb.obbAssetBundle != (UnityEngine.Object)null) { T t2 = AssetManagerForObb.obbAssetBundle.LoadAsset <T>(text); if (t2 != (UnityEngine.Object)null) { return(t2); } } if (Application.platform != RuntimePlatform.Android && flag) { return((T)((Object)null)); } if (!suppressError) { global::Debug.LogWarning("Cannot find " + name + " in bundles!!!"); } return((T)((Object)null)); }
private static void CreateSoundBundleEntries() { foreach (AssetManagerUtil.SoundBundleId id in Enum.GetValues(typeof(AssetManagerUtil.SoundBundleId))) { String name = AssetManagerUtil.GetSoundBundleName(id); AddAssetBundleEntry(name, 0); } }
public static AssetManagerRequest LoadAsync <T>(String name) where T : UnityEngine.Object { //if (!name.EndsWith(".mes")) //{ // Log.Message(typeof(T).Name + ": " + name); // Log.Message(Environment.StackTrace); //} if (AssetManagerForObb.IsUseOBB) { return(AssetManagerForObb.LoadAsync <T>(name)); } if (!UseBundles || AssetManagerUtil.IsEmbededAssets(name)) { ResourceRequest resReq = Resources.LoadAsync <T>(name); if (resReq != null) { return(new AssetManagerRequest(resReq, null)); } } String belongingBundleFilename = AssetManagerUtil.GetBelongingBundleFilename(name); Boolean flag1 = AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, name); if (!String.IsNullOrEmpty(belongingBundleFilename) && DictAssetBundleRefs.ContainsKey(belongingBundleFilename)) { AssetBundleRef assetBundleRef = DictAssetBundleRefs[belongingBundleFilename]; if (assetBundleRef.assetBundle != null) { String name1 = AssetManagerUtil.GetResourcesBasePath() + name + AssetManagerUtil.GetAssetExtension <T>(name); //Boolean flag2 = name.IndexOf("atlas_a", StringComparison.Ordinal) != -1; AssetBundleRequest assReq = assetBundleRef.assetBundle.LoadAssetAsync(name1); if (assReq != null) { return(new AssetManagerRequest(null, assReq)); } if (!flag1 && ForceUseBundles) { //if (Application.platform != RuntimePlatform.Android && flag2) // return null; return(null); } } } ResourceRequest resReq1 = Resources.LoadAsync <T>(name); if (resReq1 != null) { return(new AssetManagerRequest(resReq1, null)); } return(null); }
private void Open() { Int64 num = 0L; Int64 num2 = 0L; RuntimePlatform platform = Application.platform; String text; switch (platform) { case RuntimePlatform.WindowsEditor: text = AssetManagerUtil.GetStreamingAssetsPath() + "/ma/" + this.MovieFile; break; case RuntimePlatform.IPhonePlayer: text = AssetManagerUtil.GetStreamingAssetsPath() + "/ma/" + this.MovieFile; break; case RuntimePlatform.PS3: case RuntimePlatform.XBOX360: IL_2A: if (platform != RuntimePlatform.WindowsPlayer) { throw new Exception("[Movie.MovieMaterial.GLPlugin] Platform: " + Application.platform + " Not supported."); } text = AssetManagerUtil.GetStreamingAssetsPath() + "/ma/" + this.MovieFile; break; case RuntimePlatform.Android: text = Application.dataPath; if (!AssetStream.GetZipFileOffsetLength(Application.dataPath, "ma/" + this.MovieFile, out num, out num2)) { throw new Exception("[Movie.MovieMaterial.GLPlugin] Error opening movie via AssetStream"); } break; default: goto IL_2A; } this.isFMV = this.MovieFile.StartsWith("FMV"); if (this.m_nativeContext != IntPtr.Zero && MovieMaterial.OpenStream(this.m_nativeContext, text, (Int32)num, (Int32)num2, false, this.scanDuration, 16)) { this.Width = MovieMaterial.GetPicWidth(this.m_nativeContext); this.Height = MovieMaterial.GetPicHeight(this.m_nativeContext); this.m_picX = MovieMaterial.GetPicX(this.m_nativeContext); this.m_picY = MovieMaterial.GetPicY(this.m_nativeContext); this.m_yStride = MovieMaterial.GetYStride(this.m_nativeContext); this.m_yHeight = MovieMaterial.GetYHeight(this.m_nativeContext); this.m_uvStride = MovieMaterial.GetUVStride(this.m_nativeContext); this.m_uvHeight = MovieMaterial.GetUVHeight(this.m_nativeContext); this.currentFPS = this.FPS; this.currentDuration = MovieMaterial.GetDuration(this.m_nativeContext); this.CalculateUVScaleOffset(); return; } throw new FileLoadException("Error opening movie during stream opening at path: " + text); }
private static void LoadMetaDataFromStreamingAssets() { Int32 num = 0; List <SoundMetaDataProfile> list = new List <SoundMetaDataProfile>(); List <SoundMetaDataProfile> list2 = new List <SoundMetaDataProfile>(); String item = AssetManagerUtil.GetStreamingAssetsPath() + "/Sounds"; Queue <String> queue = new Queue <String>(); queue.Enqueue(item); while (queue.Count > 0) { String text = queue.Peek(); String[] directories = Directory.GetDirectories(text); String[] array = directories; for (Int32 i = 0; i < (Int32)array.Length; i++) { String item2 = array[i]; queue.Enqueue(item2); } String[] files = Directory.GetFiles(text); String[] array2 = files; for (Int32 j = 0; j < (Int32)array2.Length; j++) { String text2 = array2[j]; String[] array3 = text2.Split(new Char[] { '.' }); String a = array3[(Int32)array3.Length - 1]; if (!String.Equals(a, "meta")) { String[] array4 = text.Split(new Char[] { '/' }); String[] array5 = array4[(Int32)array4.Length - 1].Split(new Char[] { '\\' }); String text3 = array5[(Int32)array5.Length - 1]; String fileName = Path.GetFileName(text2); if (String.Equals(text3, "BGM_") || String.Equals(text3, "Movie_") || String.Equals(text3, "song_") || String.Equals(text3, "OldBGM")) { list2.Add(new SoundMetaDataProfile(text3 + "/" + fileName, num++, "Music")); } else { list.Add(new SoundMetaDataProfile(text3 + "/" + fileName, num++, "SoundEffect")); } } } queue.Dequeue(); } SoundMetaData.SoundEffectMetaData = SoundMetaData.ComposeMetaDataJsonString(list); SoundMetaData.MusicMetaData = SoundMetaData.ComposeMetaDataJsonString(list2); }
public static String CreateModuleBundleFilename(AssetManagerUtil.AvailablePlatform buildTarget, Boolean isCompressed, AssetManagerUtil.ModuleBundle moduleBundle) { return(String.Format("{0}{1}{2}{3}", new Object[] { AssetManagerUtil.GetPlatformPrefix(buildTarget), AssetManagerUtil.GetCompressionPrefix(isCompressed), AssetManagerUtil.GetModuleBundleName(moduleBundle), AssetManagerUtil.GetBundleExtension() })); }
public static T Load <T>(String name, Boolean suppressError = false) where T : UnityEngine.Object { //if (!name.EndsWith(".mes")) //{ // Log.Message(typeof(T).Name + ": " + name); // Log.Message(Environment.StackTrace); //} if (AssetManagerForObb.IsUseOBB) { return(AssetManagerForObb.Load <T>(name, suppressError)); } if (!UseBundles || AssetManagerUtil.IsEmbededAssets(name)) { return(Resources.Load <T>(name)); } String belongingBundleFilename = AssetManagerUtil.GetBelongingBundleFilename(name); Boolean flag1 = AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, name); if (!String.IsNullOrEmpty(belongingBundleFilename) && DictAssetBundleRefs.ContainsKey(belongingBundleFilename)) { AssetBundleRef assetBundleRef = DictAssetBundleRefs[belongingBundleFilename]; if (assetBundleRef.assetBundle != null) { String name1 = AssetManagerUtil.GetResourcesBasePath() + name + AssetManagerUtil.GetAssetExtension <T>(name); Boolean flag2 = name.IndexOf("atlas_a", StringComparison.Ordinal) != -1; T obj = assetBundleRef.assetBundle.LoadAsset <T>(name1); if (obj != null) { return(obj); } if (Application.platform != RuntimePlatform.Android && flag2) { return(null); } if (!flag1 && ForceUseBundles) { return(null); } } } if (ForceUseBundles) { return(null); } T obj1 = Resources.Load <T>(name); return(obj1); }
private void OnGUI() { DebugGuiSkin.ApplySkin(); this.screenRect = DebugGuiSkin.GetFullscreenRect(); GUILayout.BeginVertical("box", new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button("back", new GUILayoutOption[0])) { global::Debug.Log("back"); SceneDirector.Replace("MainMenu", SceneTransition.FadeOutToBlack_FadeIn, true); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, new GUILayoutOption[] { GUILayout.Width(this.screenRect.width) }); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.Label(this.SystemInfoString[0, 0] + " : " + SystemInfo.deviceModel, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[1, 0] + " : " + SystemInfo.deviceName, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[2, 0] + " : " + SystemInfo.deviceType, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[4, 0] + " : " + SystemInfo.graphicsDeviceID, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[5, 0] + " : " + SystemInfo.graphicsDeviceName, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[6, 0] + " : " + SystemInfo.graphicsDeviceVendor, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[7, 0] + " : " + SystemInfo.graphicsDeviceVendorID, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[8, 0] + " : " + SystemInfo.graphicsDeviceVersion, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[9, 0] + " : " + SystemInfo.graphicsMemorySize, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[11, 0] + " : " + SystemInfo.graphicsShaderLevel, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[12, 0] + " : " + SystemInfo.npotSupport, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[13, 0] + " : " + SystemInfo.operatingSystem, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[14, 0] + " : " + SystemInfo.processorCount, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[15, 0] + " : " + SystemInfo.processorType, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[16, 0] + " : " + SystemInfo.supportedRenderTargetCount, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[17, 0] + " : " + SystemInfo.supports3DTextures, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[18, 0] + " : " + SystemInfo.supportsAccelerometer, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[19, 0] + " : " + SystemInfo.supportsComputeShaders, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[20, 0] + " : " + SystemInfo.supportsGyroscope, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[21, 0] + " : " + SystemInfo.supportsImageEffects, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[22, 0] + " : " + SystemInfo.supportsInstancing, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[23, 0] + " : " + SystemInfo.supportsLocationService, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[24, 0] + " : " + SystemInfo.supportsRenderTextures, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[25, 0] + " : " + SystemInfo.supportsRenderToCubemap, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[26, 0] + " : " + SystemInfo.supportsShadows, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[28, 0] + " : " + SystemInfo.supportsStencil, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[29, 0] + " : " + SystemInfo.supportsVibration, new GUILayoutOption[0]); GUILayout.Label(this.SystemInfoString[30, 0] + " : " + SystemInfo.systemMemorySize, new GUILayoutOption[0]); GUILayout.Label("------------------------", new GUILayoutOption[0]); GUILayout.Label(this.ApplicationInfoString[0, 0] + " : " + Application.dataPath, new GUILayoutOption[0]); GUILayout.Label(this.ApplicationInfoString[1, 0] + " : " + AssetManagerUtil.GetPersistentDataPath(), new GUILayoutOption[0]); GUILayout.Label(this.ApplicationInfoString[2, 0] + " : " + AssetManagerUtil.GetStreamingAssetsPath(), new GUILayoutOption[0]); GUILayout.Label(this.ApplicationInfoString[3, 0] + " : " + Application.temporaryCachePath, new GUILayoutOption[0]); GUILayout.EndScrollView(); GUILayout.EndVertical(); }
public IEnumerator DownloadAssetBundle(AssetManager.AssetBundleRef abRef, Int32 curItem, Int32 numItem) { while (!Caching.ready) { yield return(null); } this._AddLogOutput("Downloading : " + abRef.url); String fullUrl = String.Concat(new String[] { this._baseUrl, AssetManagerUtil.GetPlatformPrefix(Application.platform), AssetManagerUtil.GetCompressionPrefix(this._isCompressedBundles), abRef.url, AssetManagerUtil.GetBundleExtension() }); this._AddLogOutput(" At : " + fullUrl); ExpansionVerifier.printLog("BundleScene : Downloading " + abRef.url + " AT " + fullUrl); if (!this._isCompressedBundles && fullUrl.IndexOf("http://") == -1) { this._AddLogOutput("Loading Uncompressed Bundle."); AssetBundle ab = AssetBundle.CreateFromFile(fullUrl); abRef.assetBundle = ab; yield break; } using (WWW www = WWW.LoadFromCacheOrDownload(fullUrl, BundleScene.BundleVersionInt)) { this._AddLogOutput("Loading Compressed Bundle."); while (!www.isDone) { this._SetStatusText(String.Concat(new Object[] { "Loading Progress : [", Mathf.FloorToInt(www.progress * 100f), "%] ", curItem, "/", numItem, " | Will auto change scene when finished." })); yield return(new WaitForSeconds(0.01f)); } if (www.error != null) { this._AddLogOutput("Error : " + www.error); ExpansionVerifier.printLog("BundleScene : www.error = " + www.error); throw new Exception("WWW download:" + www.error); } abRef.assetBundle = www.assetBundle; } yield break; }
public static String GetFullURLForLocalBundles(Boolean isCompressedBundles, String bundleName) { String text = String.Concat(new String[] { BundleSceneIOS.GetBasedURLForLocalBundles(), AssetManagerUtil.GetPlatformPrefix(Application.platform), AssetManagerUtil.GetCompressionPrefix(isCompressedBundles), bundleName, AssetManagerUtil.GetBundleExtension() }); global::Debug.Log("GetFullURLForLocalBundles = " + text); return(text); }
private static void LoadFont() { String path = "EmbeddedAsset/FA/" + AssetManagerUtil.GetPlatformPrefix(Application.platform) + "_fa.mpc"; if (fontBundle == null) { TextAsset textAsset = Resources.Load <TextAsset>(path); Byte[] binary = ByteEncryption.Decryption(textAsset.bytes); fontBundle = AssetBundle.CreateFromMemoryImmediate(binary); } defaultFont = LoadFont(fontBundle.LoadAsset <Font>("TBUDGoStd-Bold")); fontBundle.Unload(false); Object.DestroyImmediate(fontBundle); fontBundle = null; }
public static AssetManagerRequest LoadAsync <T>(String name) where T : UnityEngine.Object { if (AssetManagerForObb.IsUseOBB) { return(AssetManagerForObb.LoadAsync <T>(name)); } if (!AssetManager.UseBundles || AssetManagerUtil.IsEmbededAssets(name)) { ResourceRequest resourceRequest = Resources.LoadAsync <T>(name); if (resourceRequest != null) { return(new AssetManagerRequest(resourceRequest, (AssetBundleRequest)null)); } } String belongingBundleFilename = AssetManagerUtil.GetBelongingBundleFilename(name); Boolean flag = AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, name); if (!String.IsNullOrEmpty(belongingBundleFilename) && AssetManager.DictAssetBundleRefs.ContainsKey(belongingBundleFilename)) { AssetManager.AssetBundleRef assetBundleRef = AssetManager.DictAssetBundleRefs[belongingBundleFilename]; if (assetBundleRef.assetBundle != (UnityEngine.Object)null) { String text = AssetManagerUtil.GetResourcesBasePath() + name; text += AssetManagerUtil.GetAssetExtension <T>(name); Boolean flag2 = name.IndexOf("atlas_a") != -1; AssetBundleRequest assetBundleRequest = assetBundleRef.assetBundle.LoadAssetAsync(text); if (assetBundleRequest != null) { return(new AssetManagerRequest((ResourceRequest)null, assetBundleRequest)); } if (!flag && AssetManager.ForceUseBundles) { if (Application.platform != RuntimePlatform.Android && flag2) { return((AssetManagerRequest)null); } return((AssetManagerRequest)null); } } } ResourceRequest resourceRequest2 = Resources.LoadAsync <T>(name); if (resourceRequest2 != null) { return(new AssetManagerRequest(resourceRequest2, (AssetBundleRequest)null)); } return((AssetManagerRequest)null); }
public static T Load <T>(String name, Boolean suppressError = false) where T : UnityEngine.Object { if (AssetManagerForObb.IsUseOBB) { return(AssetManagerForObb.Load <T>(name, suppressError)); } if (!AssetManager.UseBundles || AssetManagerUtil.IsEmbededAssets(name)) { return(Resources.Load <T>(name)); } String belongingBundleFilename = AssetManagerUtil.GetBelongingBundleFilename(name); Boolean flag = AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, name); if (!String.IsNullOrEmpty(belongingBundleFilename) && AssetManager.DictAssetBundleRefs.ContainsKey(belongingBundleFilename)) { AssetManager.AssetBundleRef assetBundleRef = AssetManager.DictAssetBundleRefs[belongingBundleFilename]; if (assetBundleRef.assetBundle != (UnityEngine.Object)null) { String text = AssetManagerUtil.GetResourcesBasePath() + name; text += AssetManagerUtil.GetAssetExtension <T>(name); Boolean flag2 = name.IndexOf("atlas_a") != -1; T t = assetBundleRef.assetBundle.LoadAsset <T>(text); if (t != (UnityEngine.Object)null) { return(t); } if (Application.platform != RuntimePlatform.Android && flag2) { return((T)((Object)null)); } if (!flag && AssetManager.ForceUseBundles) { return((T)((Object)null)); } } } if (AssetManager.ForceUseBundles) { return((T)((Object)null)); } T t2 = Resources.Load <T>(name); if (t2 != (UnityEngine.Object)null) { return(t2); } return((T)((Object)null)); }
public static String GetAssetExtension <T>(String name) where T : UnityEngine.Object { String result = String.Empty; if (typeof(T) == typeof(TextAsset)) { result = ".bytes"; } else if (typeof(T) == typeof(Texture2D) || typeof(T) == typeof(Texture)) { if (name.IndexOf("atlas_a") != -1) { result = ".jpg"; } else { result = ".png"; } } else if (typeof(T) == typeof(RenderTexture)) { result = ".renderTexture"; } else if (typeof(T) == typeof(Material)) { result = ".mat"; } else if (typeof(T) == typeof(AnimationClip)) { result = ".anim"; } else if (typeof(T) == typeof(GameObject)) { if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.BattleMaps, name) || AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.Models, name)) { result = ".fbx"; } else { result = ".prefab"; } } return(result); }
public static Int32 GetSoundCategoryBundleId(String soundName) { Int32 soundCategoryId = AssetManagerUtil.GetSoundCategoryId(soundName); if (soundCategoryId == 1) { return(1); } if (soundCategoryId == 2) { return(2); } if (soundCategoryId == 3) { return(3); } global::Debug.LogWarning("AssetManagerUtil::GetSoundCategoryBundleId::Unknown sound name " + soundName); return(-1); }
public static Int32 GetFieldMapBundleId(String fieldMapName) { Int32 fieldMapAreaId = AssetManagerUtil.GetFieldMapAreaId(fieldMapName); if (fieldMapAreaId >= 44) { return(9); } if (fieldMapAreaId >= 39) { return(8); } if (fieldMapAreaId >= 32) { return(7); } if (fieldMapAreaId >= 27) { return(6); } if (fieldMapAreaId >= 19) { return(5); } if (fieldMapAreaId >= 13) { return(4); } if (fieldMapAreaId >= 10) { return(3); } if (fieldMapAreaId >= 3) { return(2); } if (fieldMapAreaId >= 0) { return(1); } global::Debug.LogWarning("AssetManagerUtil::GetFieldMapBundleId::Unknown field map name " + fieldMapName); return(1); }
public static String GetBasedURLForLocalBundles() { String text = String.Empty; if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { text = "file://" + AssetManagerUtil.GetStreamingAssetsPath() + "/"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { text = "file://" + AssetManagerUtil.GetStreamingAssetsPath() + "/"; } else if (Application.platform == RuntimePlatform.Android) { text = "jar:file://" + AssetManagerUtil.GetStreamingAssetsPath() + "/"; } global::Debug.Log("GetBasedURLForLocalBundles = " + text); return(text); }
private void _UsingAssetBundlesFromLocal() { this._AddLogOutput("Downloading from Local StreamingAssets."); AssetManager.UseBundles = true; if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { this._baseUrl = "file://" + AssetManagerUtil.GetStreamingAssetsPath() + "/"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { this._baseUrl = "file://" + AssetManagerUtil.GetStreamingAssetsPath() + "/"; } else if (Application.platform == RuntimePlatform.Android) { this._baseUrl = AssetManagerUtil.GetStreamingAssetsPath() + "/"; } this._isDownloading = true; this._isCompressedBundles = true; base.StartCoroutine(this.DownloadAssetBundles()); }
public static String GetBelongingBundleFilename(String assetName) { String result = String.Empty; if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.FieldMaps, assetName)) { Int32 fieldMapBundleId = AssetManagerUtil.GetFieldMapBundleId(assetName); result = AssetManagerUtil.GetFieldMapBundleName((AssetManagerUtil.FieldMapBundleId)fieldMapBundleId); } else if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.BattleMaps, assetName)) { result = AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.BattleMaps); } else if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.WorldMaps, assetName)) { result = AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.WorldMaps); } else if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.Models, assetName)) { result = AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.Models); } else if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.Animations, assetName)) { result = AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.Animations); } else if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.Sounds, assetName)) { Int32 soundCategoryBundleId = AssetManagerUtil.GetSoundCategoryBundleId(assetName); if (soundCategoryBundleId != -1) { result = AssetManagerUtil.GetSoundBundleName((AssetManagerUtil.SoundBundleId)soundCategoryBundleId); } } else if (AssetManagerUtil.CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle.CommonAssets, assetName)) { result = AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.CommonAssets); } return(result); }
public static Boolean Are3CompressedBundlesCached() { String fullURLForLocalBundles = BundleSceneIOS.GetFullURLForLocalBundles(true, AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.BattleMaps)); Boolean flag = Caching.IsVersionCached(fullURLForLocalBundles, BundleScene.BundleVersionInt); fullURLForLocalBundles = BundleSceneIOS.GetFullURLForLocalBundles(true, AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.WorldMaps)); Boolean flag2 = Caching.IsVersionCached(fullURLForLocalBundles, BundleScene.BundleVersionInt); fullURLForLocalBundles = BundleSceneIOS.GetFullURLForLocalBundles(true, AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.Models)); Boolean flag3 = Caching.IsVersionCached(fullURLForLocalBundles, BundleScene.BundleVersionInt); global::Debug.Log(String.Concat(new Object[] { "Are3CompressedBundlesCached: isBundle2Cached = ", flag, ", isBundle3Cached = ", flag2, ", isBundle4Cached = ", flag3 })); return(flag && flag2 && flag3); }
private void _UsingUncompressedAssetBundlesFromLocal() { this._AddLogOutput("Downloading from Local Uncompressed StreamingAssets."); ExpansionVerifier.printLog("BundleScene : Downloading from Local Uncompressed StreamingAssets."); AssetManager.UseBundles = true; if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { this._baseUrl = AssetManagerUtil.GetStreamingAssetsPath() + "/"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { this._baseUrl = AssetManagerUtil.GetStreamingAssetsPath() + "/"; } else if (Application.platform == RuntimePlatform.Android) { this._baseUrl = AssetManagerUtil.GetStreamingAssetsPath() + "/"; } this._isDownloading = true; this._isCompressedBundles = false; ExpansionVerifier.printLog("BundleScene : _baseUrl = " + this._baseUrl); base.StartCoroutine(this.DownloadAssetBundles()); }
static AssetManager() { DictAssetBundleRefs = new Dictionary <String, AssetBundleRef>(); foreach (AssetManagerUtil.ModuleBundle moduleBundle in Enum.GetValues(typeof(AssetManagerUtil.ModuleBundle))) { switch (moduleBundle) { case AssetManagerUtil.ModuleBundle.FieldMaps: CreateFieldMapsBundleEntries(); break; case AssetManagerUtil.ModuleBundle.Sounds: CreateSoundBundleEntries(); break; default: AddAssetBundleEntry(AssetManagerUtil.GetModuleBundleName(moduleBundle), 0); break; } } LoadAnimationFolderMapping(); }
public static Boolean CheckModuleBundleFromName(AssetManagerUtil.ModuleBundle moduleBundle, String name) { String moduleStartPath = AssetManagerUtil.GetModuleStartPath(moduleBundle); return(String.Compare(name, 0, moduleStartPath, 0, moduleStartPath.Length, StringComparison.OrdinalIgnoreCase) == 0); }
public static String CreateObbBundleFilename(AssetManagerUtil.AvailablePlatform buildTarget) { return(String.Format("{0}{1}{2}", AssetManagerUtil.GetPlatformPrefix(buildTarget), "OBB", AssetManagerUtil.GetBundleExtension())); }
public static String GetSoundBundleName(AssetManagerUtil.SoundBundleId bundleId) { return(String.Format("{0}{1}", AssetManagerUtil.GetModuleBundleName(AssetManagerUtil.ModuleBundle.Sounds), (Int32)bundleId)); }
public IEnumerator DownloadAssetBundle(AssetManager.AssetBundleRef abRef, Int32 curItem, Int32 numItem) { while (!Caching.ready) { yield return(null); } this._AddLogOutput("Downloading : " + abRef.url); String fullUrl = String.Concat(new String[] { this._baseUrl, AssetManagerUtil.GetPlatformPrefix(Application.platform), AssetManagerUtil.GetCompressionPrefix(this._isCompressedBundles), abRef.url, AssetManagerUtil.GetBundleExtension() }); this._AddLogOutput(" At : " + fullUrl); String prefix = AssetManagerUtil.GetPlatformPrefix(Application.platform); Boolean isCompressedBundles = this._isCompressedBundles; Boolean specialCaseOccured = fullUrl.Contains(prefix + "0data2.bin") || fullUrl.Contains(prefix + "0data3.bin") || fullUrl.Contains(prefix + "0data4.bin"); if (specialCaseOccured) { isCompressedBundles = true; String baseUrl = String.Empty; baseUrl = BundleSceneIOS.GetBasedURLForLocalBundles(); fullUrl = String.Concat(new String[] { baseUrl, AssetManagerUtil.GetPlatformPrefix(Application.platform), AssetManagerUtil.GetCompressionPrefix(isCompressedBundles), abRef.url, AssetManagerUtil.GetBundleExtension() }); } if (!isCompressedBundles && fullUrl.IndexOf("http://") == -1) { this._AddLogOutput("Loading Uncompressed Bundle."); AssetBundle ab = AssetBundle.CreateFromFile(fullUrl); abRef.assetBundle = ab; yield break; } Boolean isVersionCached = false; if (specialCaseOccured && Caching.IsVersionCached(fullUrl, BundleScene.BundleVersionInt)) { this.LoadingUI.SetSceneActive(false); isVersionCached = true; } using (WWW www = WWW.LoadFromCacheOrDownload(fullUrl, BundleScene.BundleVersionInt)) { this._AddLogOutput("Loading Compressed Bundle."); while (!www.isDone) { if (!isVersionCached) { this.LoadingUI.SetSceneActive(true); this.LoadingUI.SetStatusText(ExpansionVerifier.State.DecompressOBB, ExpansionVerifier.ErrorCode.None); } Single total = ((Single)this.currentProgressIndex + www.progress) * 100f; Single totalProgress = total / 4f; this.LoadingUI.SetProgress(Mathf.FloorToInt(totalProgress), true); global::Debug.Log("totalProgress + " + totalProgress); yield return(new WaitForSeconds(0.01f)); } this.currentProgressIndex++; if (www.error != null) { this._AddLogOutput("Error : " + www.error); throw new Exception("WWW download:" + www.error); } abRef.assetBundle = www.assetBundle; } yield break; }