コード例 #1
0
        protected override void Awake()
        {
            if (!this.CheckInstance())
            {
                return;
            }
            Debug.Log((object)"ーーーーーーーーーーーリソースマネージャー読み込みーーーーーーーーーーー");
            foreach (string str in CommonLib.GetAssetBundleNameListFromPath("scene/common/", false).OrderByDescending <string, string>((Func <string, string>)(bundle => bundle)).ToArray <string>())
            {
                string     withoutExtension        = System.IO.Path.GetFileNameWithoutExtension(str);
                string     manifestAssetBundleName = !(withoutExtension == "00") ? string.Format("add{0}", (object)withoutExtension) : "abdata";
                GameObject gameObject = (GameObject)null;
                foreach (GameObject allAsset in AssetBundleManager.LoadAllAsset(str, typeof(GameObject), manifestAssetBundleName).GetAllAssets <GameObject>())
                {
                    if (((Object)allAsset).get_name() == "resrcmanager")
                    {
                        gameObject = (GameObject)Object.Instantiate <GameObject>((M0)allAsset, ((Component)this).get_transform());
                        break;
                    }
                    this.AssetBundlePaths.Add(new ValueTuple <string, string>(str, manifestAssetBundleName));
                }
                if (Object.op_Inequality((Object)gameObject, (Object)null))
                {
                    break;
                }
            }
            DefinePack    definePack        = Singleton <Resources> .Instance.DefinePack;
            List <string> nameListFromPath1 = CommonLib.GetAssetBundleNameListFromPath(definePack.ABDirectories.ExpList, true);

            nameListFromPath1.Sort();
            foreach (string str in nameListFromPath1)
            {
                string file = str;
                foreach (ExcelData allAsset in AssetBundleManager.LoadAllAsset(file, typeof(ExcelData), (string)null).GetAllAssets <ExcelData>())
                {
                    int key = int.Parse(((Object)allAsset).get_name().Replace("c", string.Empty));
                    Dictionary <string, Game.Expression> dic;
                    if (!this.CharaExpTable.TryGetValue(key, out dic))
                    {
                        Dictionary <string, Game.Expression> dictionary = new Dictionary <string, Game.Expression>();
                        this.CharaExpTable[key] = dictionary;
                        dic = dictionary;
                    }
                    Game.LoadExpExcelData(dic, allAsset);
                    if (!this.AssetBundlePaths.Exists((Predicate <ValueTuple <string, string> >)(x => (string)x.Item1 == file)))
                    {
                        this.AssetBundlePaths.Add(new ValueTuple <string, string>(file, string.Empty));
                    }
                }
            }
            List <string> nameListFromPath2 = CommonLib.GetAssetBundleNameListFromPath(definePack.ABDirectories.LoadingSpriteList, false);

            nameListFromPath2.Sort();
            foreach (string str in nameListFromPath2)
            {
                string file = str;
                foreach (LoadingImageData allAsset in AssetBundleManager.LoadAllAsset(file, typeof(LoadingImageData), (string)null).GetAllAssets <LoadingImageData>())
                {
                    foreach (LoadingImageData.Param obj in allAsset.param)
                    {
                        this.LoadingSpriteABList[obj.ID] = new AssetBundleInfo(obj.Name, obj.Bundle, obj.Asset, obj.Manifest);
                    }
                    if (!this.AssetBundlePaths.Exists((Predicate <ValueTuple <string, string> >)(x => (string)x.Item1 == file)))
                    {
                        this.AssetBundlePaths.Add(new ValueTuple <string, string>(file, string.Empty));
                    }
                }
            }
            ObservableExtensions.Subscribe <long>((IObservable <M0>)Observable.TimerFrame(2, (FrameCountType)0), (System.Action <M0>)(_ =>
            {
                using (List <ValueTuple <string, string> > .Enumerator enumerator = this.AssetBundlePaths.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ValueTuple <string, string> current = enumerator.Current;
                        AssetBundleManager.UnloadAssetBundle((string)current.Item1, true, (string)current.Item2, false);
                    }
                }
            }));
            TextScenario.LoadReadInfo();
        }