Exemplo n.º 1
0
        public void OpenModeMenu(SystemMenuUI.MenuMode mode)
        {
            switch (mode + 1)
            {
            case SystemMenuUI.MenuMode.Status:
                this._homeMenu.UsageRestriction();
                this._homeMenu.IsActiveControl = true;
                break;

            case SystemMenuUI.MenuMode.Inventory:
                this._statusUI.IsActiveControl = true;
                break;

            case SystemMenuUI.MenuMode.Map:
                this._inventoryUI.IsActiveControl = true;
                break;

            case SystemMenuUI.MenuMode.Craft:
                this.Visible = false;
                Singleton <MapUIContainer> .Instance.MinimapUI.OpenAllMap(-1);

                Singleton <MapUIContainer> .Instance.MinimapUI.FromHomeMenu = true;
                int prevMapVisibleMode = Singleton <MapUIContainer> .Instance.MinimapUI.VisibleMode;
                Singleton <MapUIContainer> .Instance.MinimapUI.VisibleMode        = 1;
                Singleton <MapUIContainer> .Instance.MinimapUI.AllMapClosedAction = (Action)(() =>
                {
                    this.Visible = true;
                    this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                    Singleton <MapUIContainer> .Instance.MinimapUI.AllMapClosedAction = (Action)null;
                    bool miniMap = Manager.Config.GameData.MiniMap;
                    if (prevMapVisibleMode != 0 || !miniMap)
                    {
                        return;
                    }
                    Singleton <MapUIContainer> .Instance.MinimapUI.OpenMiniMap();
                });
                Singleton <MapUIContainer> .Instance.MinimapUI.WarpProc = (MiniMapControler.OnWarp)(x =>
                {
                    string prevStateName = Singleton <Manager.Map> .Instance.Player.PlayerController.PrevStateName;
                    Singleton <MapUIContainer> .Instance.MinimapUI.AllMapClosedAction = (Action)(() => {});
                    Singleton <Manager.Map> .Instance.WarpToBasePoint(x, (Action)(() =>
                    {
                        this.IsActiveControl = false;
                        if (prevStateName == "Onbu")
                        {
                            Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("Onbu");
                        }
                        else
                        {
                            Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("Normal");
                        }
                        Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("Idle");
                        GC.Collect();
                        bool miniMap = Manager.Config.GameData.MiniMap;
                        if (prevMapVisibleMode != 0 || !miniMap)
                        {
                            return;
                        }
                        Singleton <MapUIContainer> .Instance.MinimapUI.OpenMiniMap();
                    }), (Action)(() =>
                    {
                        if (prevStateName == "Onbu")
                        {
                            Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("Onbu");
                        }
                        else
                        {
                            Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("Normal");
                        }
                        Singleton <Input> .Instance.ReserveState(Input.ValidType.Action);
                        Singleton <Input> .Instance.SetupState();
                        Singleton <Manager.Map> .Instance.Player.SetScheduledInteractionState(true);
                        Singleton <Manager.Map> .Instance.Player.ReleaseInteraction();
                    }));
                    Singleton <MapUIContainer> .Instance.MinimapUI.WarpProc = (MiniMapControler.OnWarp)null;
                });
                break;

            case SystemMenuUI.MenuMode.Camera:
                this.Visible = false;
                MapUIContainer.SetActiveCraftUI(true);
                MapUIContainer.CraftUI.Observer = this;
                MapUIContainer.CraftUI.OnClose  = (Action)(() =>
                {
                    this.Visible = true;
                    this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                    MapUIContainer.CraftUI.OnClose = (Action)null;
                });
                break;

            case SystemMenuUI.MenuMode.Call:
                Singleton <Manager.Map> .Instance.Player.PlayerController.ChangeState("Photo");

                Action onClose1 = this.OnClose;
                if (onClose1 == null)
                {
                    break;
                }
                onClose1();
                break;

            case SystemMenuUI.MenuMode.Help:
                Singleton <Manager.Map> .Instance.Player.CallProc();

                Action onClose2 = this.OnClose;
                if (onClose2 == null)
                {
                    break;
                }
                onClose2();
                break;

            case SystemMenuUI.MenuMode.Log:
                this.Visible = false;
                MapUIContainer.TutorialUI.ClosedEvent = (Action)(() =>
                {
                    this.Visible = true;
                    MapUIContainer.SetVisibleHUDExceptStoryUI(true);
                    this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                });
                MapUIContainer.SetVisibleHUDExceptStoryUI(false);
                MapUIContainer.TutorialUI.SetCondition(-1, true);
                MapUIContainer.SetActiveTutorialUI(true);
                break;

            case SystemMenuUI.MenuMode.Save:
                this.Visible = false;
                MapUIContainer.GameLogUI.IsActiveControl = true;
                MapUIContainer.GameLogUI.OnClosed        = (Action)(() =>
                {
                    this.Visible = true;
                    this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                    MapUIContainer.GameLogUI.OnClosed = (Action)null;
                });
                break;

            case SystemMenuUI.MenuMode.InventoryEnter:
                this.Visible = false;
                if (this._charasEntry == null || this._charasEntry.Length != Manager.Config.GraphicData.CharasEntry.Length)
                {
                    this._charasEntry = new bool[Manager.Config.GraphicData.CharasEntry.Length];
                }
                for (int index = 0; index < this._charasEntry.Length; ++index)
                {
                    this._charasEntry[index] = Manager.Config.GraphicData.CharasEntry[index];
                }
                ConfigWindow.UnLoadAction = (Action)(() =>
                {
                    if (!MapScene.EqualsSequence(this._charasEntry, Manager.Config.GraphicData.CharasEntry))
                    {
                        bool interactable = this._canvasGroup.get_interactable();
                        this._canvasGroup.set_interactable(true);
                        Singleton <Manager.Map> .Instance.ApplyConfig((Action)null, (Action)(() =>
                        {
                            this._canvasGroup.set_interactable(interactable);
                            this.Visible = true;
                            this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                        }));
                    }
                    else
                    {
                        this.Visible = true;
                        this.OpenModeMenu(SystemMenuUI.MenuMode.Home);
                    }
                });
                ConfigWindow.TitleChangeAction = (Action)(() =>
                {
                    ConfigWindow.UnLoadAction = (Action)null;
                    Singleton <Game> .Instance.Config.timeScaleChange = 1f;
                    Singleton <Game> .Instance.Dialog.TimeScale = 1f;
                });
                Singleton <Game> .Instance.LoadConfig();

                break;

            case SystemMenuUI.MenuMode.Craft | SystemMenuUI.MenuMode.Save:
                this._inventoryEnterUI.IsActiveControl = true;
                break;
            }
        }