예제 #1
0
        public bool LoadListInfoAll()
        {
            ChaListDefine.CategoryNo[]     values   = (ChaListDefine.CategoryNo[])Enum.GetValues(typeof(ChaListDefine.CategoryNo));
            Dictionary <int, ListInfoBase> dictData = (Dictionary <int, ListInfoBase>)null;
            List <string> nameListFromPath          = CommonLib.GetAssetBundleNameListFromPath("list/characustom/", false);

            for (int index = 0; index < nameListFromPath.Count; ++index)
            {
                AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAllAsset(nameListFromPath[index], typeof(TextAsset), (string)null);
                if (loadAssetOperation == null)
                {
                    Debug.LogWarning((object)("読み込みエラー\r\nassetBundleName:" + nameListFromPath[index]));
                }
                else if (loadAssetOperation.IsEmpty())
                {
                    AssetBundleManager.UnloadAssetBundle(nameListFromPath[index], true, (string)null, false);
                }
                else
                {
                    TextAsset[] allAssets = loadAssetOperation.GetAllAssets <TextAsset>();
                    if (allAssets == null || allAssets.Length == 0)
                    {
                        AssetBundleManager.UnloadAssetBundle(nameListFromPath[index], true, (string)null, false);
                    }
                    else
                    {
                        foreach (ChaListDefine.CategoryNo categoryNo in values)
                        {
                            if (!this.dictListInfo.TryGetValue((int)categoryNo, out dictData))
                            {
                                Debug.LogWarning((object)"リストを読むための準備ができてない");
                            }
                            else
                            {
                                foreach (TextAsset ta in allAssets)
                                {
                                    if (!(YS_Assist.GetRemoveStringRight(((Object)ta).get_name(), "_", false) != categoryNo.ToString() + "_"))
                                    {
                                        this.LoadListInfo(dictData, ta);
                                    }
                                }
                            }
                        }
                        AssetBundleManager.UnloadAssetBundle(nameListFromPath[index], true, (string)null, false);
                    }
                }
            }
            this.EntryClothesIsInit();
            this.LoadItemID();
            OutputLog.Log(nameof(LoadListInfoAll), false, "UnloadUnusedAssets");
            Resources.UnloadUnusedAssets();
            GC.Collect();
            return(true);
        }
예제 #2
0
 public virtual T[] GetAllAssets <T>() where T : class
 {
     if (request == null)
     {
         request = LoadAllBundle <T>();
     }
     if (request == null)
     {
         return(null);
     }
     return(request.GetAllAssets <T>());
 }