public string GetPath(int id, EResourceType type) { string url = ""; switch (type) { case EResourceType.Effect: { Tab_Effect data = TableManager.GetEffectByID(id, 0); if (data == null) { LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id); return(url); } url = data.Path.Substring(data.Path.LastIndexOf('/') + 1); url = BundleManager.GetBundleLoadUrl(BundleManager.PathEffectPrefab, url + ".data"); return(url); } case EResourceType.CharacterModel: { Tab_CharModel model = TableManager.GetCharModelByID(id, 0); if (model == null) { LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id); return(url); } url = BundleManager.GetBundleLoadUrl(BundleManager.PathModelPrefab, model.ResPath + ".data"); return(url); } } LogModule.ErrorLog("GetPath failed invalid type {0} id {1} !", type, id); return("ffff"); }
/// <summary> /// ɾ³ý×ʱ¼äδʹÓõÄÌõÄ¿ /// </summary> private void RemoveLastUnUsedClip() { float fSmallestTime = 99999999.0f; int smallestId = -1; foreach (SoundClip clip in m_SoundClipMap.Values) { if (fSmallestTime > clip.m_LastActiveTime) { smallestId = clip.m_uID; fSmallestTime = clip.m_LastActiveTime; } } LogModule.DebugLog("RemoveLastUnUsedClip( " + smallestId.ToString() + " )"); //ÒÔºó×¢Ê͵ô m_SoundClipMap.Remove(smallestId); #if UNITY_WP8 Tab_Sounds soundsTab = TableManager.GetSoundsByID(smallestId, 0); if (null != soundsTab) { BundleManager.ReleaseUnreferencedSoundBundle(BundleManager.GetBundleLoadUrl("", soundsTab.FullPathName + ".data")); } #endif }
static IEnumerator ClearUIBundleAsyc(string bundleName) { yield return(new WaitForEndOfFrame()); BundleManager.ReleaseUnreferencedUIBundle(BundleManager.GetBundleLoadUrl(BundleManager.PathUIPrefab, bundleName + ".data")); Resources.UnloadUnusedAssets(); GC.Collect(); }
static void ClearUIBundle(List <string> unloadBundleList) { for (int i = 0; i < unloadBundleList.Count; ++i) { BundleManager.ReleaseUnreferencedUIBundle(BundleManager.GetBundleLoadUrl(BundleManager.PathUIPrefab, unloadBundleList[i] + ".data")); } Resources.UnloadUnusedAssets(); GC.Collect(); }
//add by sunyu 2014-07-31 //force Remove clip from pool, special for bgmusic public void ForceRemoveClipByID(short uid) { if (uid != -1) { int nNeeddelId = -1; foreach (SoundClip clip in m_SoundClipMap.Values) //dictionary µÄ foreachÈ¥²»µô { if (clip.m_uID == uid) { nNeeddelId = clip.m_uID; break; } } m_SoundClipMap.Remove(nNeeddelId); #if UNITY_WP8 Tab_Sounds soundsTab = TableManager.GetSoundsByID(nNeeddelId, 0); if (null != soundsTab) { BundleManager.ReleaseUnreferencedSoundBundle(BundleManager.GetBundleLoadUrl("", soundsTab.FullPathName + ".data")); } #endif } }