Exemple #1
0
        private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
        {
            if (args.Repeat)
            {
                return(false);
            }

            switch (args.Key)
            {
            case Key.F8:
                chat.ToggleVisibility();
                return(true);

            case Key.PageUp:
            case Key.PageDown:
                var rate = ((Clock as ThrottledFrameClock).Source as StopwatchClock).Rate * (args.Key == Key.PageUp ? 1.1f : 0.9f);
                ((Clock as ThrottledFrameClock).Source as StopwatchClock).Rate = rate;
                Logger.Log($@"Adjusting game clock to {rate}", LoggingTarget.Debug);
                return(true);
            }

            if (state.Keyboard.ControlPressed)
            {
                switch (args.Key)
                {
                case Key.O:
                    options.ToggleVisibility();
                    return(true);
                }
            }

            return(base.OnKeyDown(state, args));
        }
Exemple #2
0
        private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
        {
            if (args.Repeat || intro == null)
            {
                return(false);
            }

            switch (args.Key)
            {
            case Key.F8:
                chat.ToggleVisibility();
                return(true);

            case Key.F9:
                social.ToggleVisibility();
                return(true);

            case Key.PageUp:
            case Key.PageDown:
                var swClock = (Clock as ThrottledFrameClock)?.Source as StopwatchClock;
                if (swClock == null)
                {
                    return(false);
                }

                swClock.Rate *= args.Key == Key.PageUp ? 1.1f : 0.9f;
                Logger.Log($@"Adjusting game clock to {swClock.Rate}", LoggingTarget.Debug);
                return(true);
            }

            if (state.Keyboard.ControlPressed)
            {
                switch (args.Key)
                {
                case Key.T:
                    Toolbar.ToggleVisibility();
                    return(true);

                case Key.O:
                    settings.ToggleVisibility();
                    return(true);

                case Key.D:
                    if (state.Keyboard.ShiftPressed || state.Keyboard.AltPressed)
                    {
                        return(false);
                    }

                    direct.ToggleVisibility();
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        public bool OnPressed(GlobalAction action)
        {
            if (intro == null)
            {
                return(false);
            }

            switch (action)
            {
            case GlobalAction.ToggleChat:
                chat.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleSocial:
                social.ToggleVisibility();
                return(true);

            case GlobalAction.ResetInputSettings:
                var sensitivity = frameworkConfig.GetBindable <double>(FrameworkSetting.CursorSensitivity);

                sensitivity.Disabled = false;
                sensitivity.Value    = 1;
                sensitivity.Disabled = true;

                frameworkConfig.Set(FrameworkSetting.IgnoredInputHandlers, string.Empty);
                frameworkConfig.GetBindable <ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault();
                return(true);

            case GlobalAction.ToggleToolbar:
                Toolbar.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleSettings:
                settings.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleDirect:
                direct.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleGameplayMouseButtons:
                LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get <bool>(OsuSetting.MouseDisableButtons));
                return(true);
            }

            return(false);
        }
Exemple #4
0
        public bool OnPressed(GlobalAction action)
        {
            if (intro == null)
            {
                return(false);
            }

            switch (action)
            {
            case GlobalAction.ToggleChat:
                chat.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleSocial:
                social.ToggleVisibility();
                return(true);

            case GlobalAction.ResetInputSettings:
                var sensitivity = frameworkConfig.GetBindable <double>(FrameworkSetting.CursorSensitivity);

                sensitivity.Disabled = false;
                sensitivity.Value    = 1;
                sensitivity.Disabled = true;

                frameworkConfig.Set(FrameworkSetting.ActiveInputHandlers, string.Empty);
                return(true);

            case GlobalAction.ToggleToolbar:
                Toolbar.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleSettings:
                settings.ToggleVisibility();
                return(true);

            case GlobalAction.ToggleDirect:
                direct.ToggleVisibility();
                return(true);
            }

            return(false);
        }
Exemple #5
0
        private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
        {
            switch (args.Key)
            {
            case Key.F8:
                chat.ToggleVisibility();
                return(true);
            }

            if (state.Keyboard.ControlPressed)
            {
                switch (args.Key)
                {
                case Key.O:
                    Options.ToggleVisibility();
                    return(true);
                }
            }

            return(base.OnKeyDown(state, args));
        }
Exemple #6
0
        private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
        {
            if (args.Repeat || intro == null)
            {
                return(false);
            }

            switch (args.Key)
            {
            case Key.F8:
                chat.ToggleVisibility();
                return(true);

            case Key.F9:
                social.ToggleVisibility();
                return(true);

            case Key.PageUp:
            case Key.PageDown:
                var swClock = (Clock as ThrottledFrameClock)?.Source as StopwatchClock;
                if (swClock == null)
                {
                    return(false);
                }

                swClock.Rate *= args.Key == Key.PageUp ? 1.1f : 0.9f;
                Logger.Log($@"Adjusting game clock to {swClock.Rate}", LoggingTarget.Debug);
                return(true);
            }

            if (state.Keyboard.ControlPressed)
            {
                switch (args.Key)
                {
                case Key.R:
                    if (state.Keyboard.AltPressed)
                    {
                        var sensitivity = frameworkConfig.GetBindable <double>(FrameworkSetting.CursorSensitivity);

                        sensitivity.Disabled = false;
                        sensitivity.Value    = 1;
                        sensitivity.Disabled = true;

                        frameworkConfig.Set(FrameworkSetting.ActiveInputHandlers, string.Empty);
                        return(true);
                    }
                    break;

                case Key.T:
                    Toolbar.ToggleVisibility();
                    return(true);

                case Key.O:
                    settings.ToggleVisibility();
                    return(true);

                case Key.D:
                    if (state.Keyboard.ShiftPressed || state.Keyboard.AltPressed)
                    {
                        return(false);
                    }

                    direct.ToggleVisibility();
                    return(true);
                }
            }

            return(false);
        }