Ejemplo n.º 1
0
        protected IEnumerable <ITranslationDumper> GetUILocalizers(DefinePack definePack, string topLevelName)
        {
            //Logger.LogWarning($"GetUILocalizers({topLevelName})");
            var finished = new HashSet <string>();
            var props    = definePack.ABDirectories.GetType().GetProperties()
                           .Where(p => p.PropertyType == typeof(string) && p.Name == "PopupInfoList");

            foreach (var prop in props)
            {
                foreach (var redirectTable in GetRedirectTables((string)prop.GetValue(definePack.ABDirectories)))
                {
                    //Logger.LogWarning($"RedirectTable: name={redirectTable.name}, assetbundle={redirectTable.assetbundle}, asset={redirectTable.asset}, manifest={redirectTable.manifest}");
                    foreach (var assetTable in GetAssetTables(redirectTable))
                    {
                        //Logger.LogWarning($"AssetTable: name={assetTable.name}, assetbundle={assetTable.assetbundle}, asset={assetTable.asset}, manifest={assetTable.manifest}");
                        var objects          = GetAssetTableObjects(assetTable);
                        var assetNameForPath = Path.GetFileNameWithoutExtension(assetTable.asset);
                        foreach (var gameObject in objects)
                        {
                            var handled    = new HashSet <object>();
                            var outputName = $"UI/{topLevelName}/{assetNameForPath}/{gameObject.name}";
                            if (finished.Contains(outputName))
                            {
                                continue;
                            }
                            finished.Add(outputName);
                            var textList = EnumerateTexts(gameObject, handled).Select(t => t.Value).ToArray();
                            var before   = textList.Select(t => t.text).ToArray();

                            var binder = gameObject.Get <UIBinder>();
                            if (binder)
                            {
                                var binderLoad = Traverse.Create(binder).Method("Load");
                                if (binderLoad.MethodExists())
                                {
                                    binderLoad.GetValue();
                                }
                            }

                            Dictionary <string, string> Localizer()
                            {
                                var results = new Dictionary <string, string>();
                                var after   = textList.Select(t => t.text).ToArray();

                                for (var i = 1; i < before.Length; i++)
                                {
                                    AddLocalizationToResults(results, before[i], after[i]);
                                }

                                return(results);
                            }

                            yield return(new StringTranslationDumper(outputName, Localizer));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Start()
        {
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
            Debug.Log((object)"ーーーーーーーーーーホームメニューUI生成(Start)ーーーーーーーーーー");
            DefinePack definePack   = Singleton <Resources> .Instance.DefinePack;
            string     manifestName = "abdata";
            GameObject gameObject1  = CommonLib.LoadAsset <GameObject>(definePack.ABPaths.MapScenePrefab, "HomeMenu", false, manifestName);

            if (Object.op_Inequality((Object)gameObject1, (Object)null))
            {
                this._homeMenu          = (HomeMenu)((GameObject)Object.Instantiate <GameObject>((M0)gameObject1, (Transform)this._uiRoot, false)).GetComponent <HomeMenu>();
                this._homeMenu.Observer = this;
                this._homeMenu.OnClose  = (Action)(() =>
                {
                    this._homeMenu.IsActiveControl = false;
                    this.IsActiveControl = false;
                });
            }
            Debug.Log((object)"ーーーーーーーーーーホームメニューUI生成(End)ーーーーーーーーーー");
            Debug.Log((object)"ーーーーーーーーーーポーチUI生成(Start)ーーーーーーーーーー");
            GameObject gameObject2 = CommonLib.LoadAsset <GameObject>(definePack.ABPaths.MapScenePrefab, "InventoryUI", false, manifestName);

            if (Object.op_Inequality((Object)gameObject2, (Object)null))
            {
                this._inventoryUI          = (InventoryUIController)((GameObject)Object.Instantiate <GameObject>((M0)gameObject2, (Transform)this._uiRoot, false)).GetComponent <InventoryUIController>();
                this._inventoryUI.capacity = (Func <int>)(() => Singleton <Manager.Map> .Instance.Player.PlayerData.InventorySlotMax);
                this._inventoryUI.itemList = (Func <List <StuffItem> >)(() => Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList);
                this._inventoryUI.Observer = this;
            }
            Debug.Log((object)"ーーーーーーーーーーポーチUI生成(End)ーーーーーーーーーー");
            Debug.Log((object)"ーーーーーーーーーーポーチ(Enter)UI生成(Start)ーーーーーーーーーー");
            GameObject gameObject3 = CommonLib.LoadAsset <GameObject>(definePack.ABPaths.MapScenePrefab, "InventoryEnterUI", false, manifestName);

            if (Object.op_Inequality((Object)gameObject3, (Object)null))
            {
                this._inventoryEnterUI          = (InventoryUIController)((GameObject)Object.Instantiate <GameObject>((M0)gameObject3, (Transform)this._uiRoot, false)).GetComponent <InventoryUIController>();
                this._inventoryEnterUI.capacity = (Func <int>)(() => Singleton <Manager.Map> .Instance.Player.PlayerData.InventorySlotMax);
                this._inventoryEnterUI.itemList = (Func <List <StuffItem> >)(() => Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList);
                this._inventoryEnterUI.Observer = this;
            }
            Debug.Log((object)"ーーーーーーーーーーポーチ(Enter)UI生成(End)ーーーーーーーーーー");
            Debug.Log((object)"ーーーーーーーーーーステータスUI生成(Start)ーーーーーーーーーー");
            GameObject gameObject4 = CommonLib.LoadAsset <GameObject>(definePack.ABPaths.MapScenePrefabAdd05, "StatusUI", false, definePack.ABManifests.Add05);

            if (Object.op_Inequality((Object)gameObject4, (Object)null))
            {
                this._statusUI          = (StatusUI)((GameObject)Object.Instantiate <GameObject>((M0)gameObject4, (Transform)this._uiRoot, false)).GetComponent <StatusUI>();
                this._statusUI.Observer = this;
                this._statusUI.OnClose  = (Action)(() =>
                {
                    Singleton <Resources> .Instance.SoundPack.Play(SoundPack.SystemSE.Cancel);
                    this._statusUI.OpenID = 0;
                    this._statusUI.IsActiveControl = false;
                    this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                });
            }
            Debug.Log((object)"ーーーーーーーーーーステータスUI生成(End)ーーーーーーーーーー");
            // ISSUE: method pointer
            ((UnityEvent)this._notifyingUI.PouchOpen.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__A)));
            // ISSUE: method pointer
            ((UnityEvent)this._notifyingUI.NotGet.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__B)));
            if (!Object.op_Implicit((Object)this._closeButton))
            {
                return;
            }
            // ISSUE: method pointer
            ((UnityEvent)this._closeButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__C)));
            this._closeButtonCanvasGroup = (CanvasGroup)((Component)this._closeButton).GetComponent <CanvasGroup>();
        }
Ejemplo n.º 3
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();
        }