public void RegisterCache(string path, AssetDataCacheMng.CACHE_TYPE type = AssetDataCacheMng.CACHE_TYPE.NORMAL, bool immediate = false) { if (!this.cacheInfoTable.ContainsKey(path)) { AssetDataCacheMng.CacheInfo cacheInfo = new AssetDataCacheMng.CacheInfo(); cacheInfo.type = type; if (immediate) { cacheInfo.obj = AssetDataMng.Instance().LoadObject(path, null, true); cacheInfo.state = 2; } else if (AssetDataCacheMng.load_async_ct < this.LOAD_ASYNC_MAX) { AssetDataCacheMng.load_async_ct++; cacheInfo.state = 1; AssetDataMng.Instance().LoadObjectASync(path, new Action <UnityEngine.Object>(cacheInfo.cachedCB)); } else { cacheInfo.state = 0; AssetDataCacheMng.load_async_not_op_ct++; } this.cacheInfoTable.Add(path, cacheInfo); } }
public void DeleteCacheType(AssetDataCacheMng.CACHE_TYPE type) { List <string> list = new List <string>(); foreach (string text in this.cacheInfoTable.Keys) { if (this.cacheInfoTable[text].type == type) { list.Add(text); } } for (int i = 0; i < list.Count; i++) { foreach (string text2 in this.cacheInfoTable.Keys) { if (text2 == list[i]) { if (this.cacheInfoTable[text2].state != 2) { global::Debug.LogError("===================================####### AssetDataCacheMng:DeleteCache " + text2 + " -> 読み込み中のキャッシュを消そうとしてます、禁止事項"); } else { this.cacheInfoTable.Remove(text2); } break; } } } }
public bool IsCacheAllReadyType(AssetDataCacheMng.CACHE_TYPE type) { foreach (string key in this.cacheInfoTable.Keys) { if (this.cacheInfoTable[key].type == type && this.cacheInfoTable[key].state != 2) { return(false); } } return(true); }
public void AddCache(string path, AssetDataCacheMng.CACHE_TYPE type, UnityEngine.Object resource) { if (!this.cacheInfoTable.ContainsKey(path)) { AssetDataCacheMng.CacheInfo value = new AssetDataCacheMng.CacheInfo { type = type, obj = resource, state = 2 }; this.cacheInfoTable.Add(path, value); } }
public void DeleteCache(string path, AssetDataCacheMng.CACHE_TYPE type = AssetDataCacheMng.CACHE_TYPE.NORMAL) { foreach (string text in this.cacheInfoTable.Keys) { if (text == path && this.cacheInfoTable[text].type == type) { if (this.cacheInfoTable[text].state == 2) { this.cacheInfoTable.Remove(text); break; } global::Debug.LogError("===================================####### AssetDataCacheMng:DeleteCache " + path + " -> 読み込み中のキャッシュを消そうとしてます、禁止事項"); } } }
public void RegisterCacheType(List <string> pathL, AssetDataCacheMng.CACHE_TYPE type, bool immediate = false) { foreach (string key in this.cacheInfoTable.Keys) { if (this.cacheInfoTable[key].type == type) { this.cacheInfoTable[key].flg = false; } } for (int i = 0; i < pathL.Count; i++) { if (this.cacheInfoTable.ContainsKey(pathL[i])) { if (this.cacheInfoTable[pathL[i]].type != type) { global::Debug.LogError("===================================####### AssetDataCacheMng:RegisterCache " + pathL[i] + " -> 論理的 不整合(type違い)"); } else { this.cacheInfoTable[pathL[i]].flg = true; } } else { AssetDataCacheMng.CacheInfo cacheInfo = new AssetDataCacheMng.CacheInfo(); cacheInfo.type = type; if (immediate) { cacheInfo.obj = AssetDataMng.Instance().LoadObject(pathL[i], null, true); cacheInfo.state = 2; } else if (AssetDataCacheMng.load_async_ct < this.LOAD_ASYNC_MAX) { AssetDataCacheMng.load_async_ct++; cacheInfo.state = 1; AssetDataMng.Instance().LoadObjectASync(pathL[i], new Action <UnityEngine.Object>(cacheInfo.cachedCB)); } else { cacheInfo.state = 0; AssetDataCacheMng.load_async_not_op_ct++; } cacheInfo.flg = true; this.cacheInfoTable.Add(pathL[i], cacheInfo); } } List <string> list = new List <string>(); foreach (string text in this.cacheInfoTable.Keys) { if (this.cacheInfoTable[text].type == type && !this.cacheInfoTable[text].flg) { list.Add(text); } } for (int i = 0; i < list.Count; i++) { foreach (string text2 in this.cacheInfoTable.Keys) { if (text2 == list[i]) { if (this.cacheInfoTable[text2].state != 2) { global::Debug.LogError("===================================####### AssetDataCacheMng:RegisterCache " + text2 + " -> 読み込み中のキャッシュを消そうとしてます、禁止事項"); } else { this.cacheInfoTable.Remove(text2); } break; } } } }