예제 #1
0
        public override void Initialize()
        {
            // F5: Reload and restart the current screen.
            Engine.Commands.FunctionKeyActions[4] = () => {
                // CTRL + F5: Quick-restart the entire game.
                if (MInput.Keyboard.Check(Keys.LeftControl) ||
                    MInput.Keyboard.Check(Keys.RightControl))
                {
                    // block restarting while the game is starting up. this might lead to crashes
                    if (!(Engine.Scene is GameLoader))
                    {
                        Everest.QuickFullRestart();
                    }

                    return;
                }

                Level level = Engine.Scene as Level;
                if (level == null)
                {
                    return;
                }

                AssetReloadHelper.Do(Dialog.Clean("ASSETRELOADHELPER_RELOADINGMAP"), () => {
                    AreaData.Areas[level.Session.Area.ID].Mode[(int)level.Session.Area.Mode].MapData.Reload();
                });
                AssetReloadHelper.ReloadLevel();
            };

            // F6: Open map editor for current level.
            Engine.Commands.FunctionKeyActions[5] = () => {
                Level level = Engine.Scene as Level;
                if (level == null)
                {
                    return;
                }
                Engine.Scene         = new MapEditor(level.Session.Area);
                Engine.Commands.Open = false;
            };

            // Set up the touch input regions.
            TouchRegion touchTitleScreen = new TouchRegion {
                Position  = new Vector2(1920f, 1080f) * 0.5f,
                Size      = new Vector2(1920f, 1080f),
                Condition = _ =>
                            ((Engine.Scene as Overworld)?.IsCurrent <OuiTitleScreen>() ?? false) ||
                            (Engine.Scene is GameLoader)
                ,
                Button = Input.MenuConfirm
            };
        }
예제 #2
0
        public override void Initialize()
        {
            // F5: Reload and restart the current screen.
            Engine.Commands.FunctionKeyActions[4] = () => {
                // CTRL + F5: Quick-restart the entire game.
                if (MInput.Keyboard.Check(Keys.LeftControl) ||
                    MInput.Keyboard.Check(Keys.RightControl))
                {
                    // block restarting while the game is starting up. this might lead to crashes
                    if (!(Engine.Scene is GameLoader))
                    {
                        Everest.QuickFullRestart();
                    }

                    return;
                }

                if (!(Engine.Scene is Level level))
                {
                    return;
                }

                AssetReloadHelper.Do(Dialog.Clean("ASSETRELOADHELPER_RELOADINGMAP"), () => {
                    AreaData.Areas[level.Session.Area.ID].Mode[(int)level.Session.Area.Mode].MapData.Reload();
                });
                AssetReloadHelper.ReloadLevel();
            };

            // F6: Open map editor for current level.
            Engine.Commands.FunctionKeyActions[5] = () => {
                if (!(Engine.Scene is Level level))
                {
                    return;
                }
                Engine.Scene         = new MapEditor(level.Session.Area);
                Engine.Commands.Open = false;
            };
        }