Exemplo n.º 1
0
        public void Register(KeyBindingContainer container, IEnumerable <RulesetInfo> rulesets)
        {
            realm.Run(r =>
            {
                using (var transaction = r.BeginWrite())
                {
                    // intentionally flattened to a list rather than querying against the IQueryable, as nullable fields being queried against aren't indexed.
                    // this is much faster as a result.
                    var existingBindings = r.All <RealmKeyBinding>().ToList();

                    insertDefaults(r, existingBindings, container.DefaultKeyBindings);

                    foreach (var ruleset in rulesets)
                    {
                        var instance = ruleset.CreateInstance();
                        foreach (int variant in instance.AvailableVariants)
                        {
                            insertDefaults(r, existingBindings, instance.GetDefaultKeyBindings(variant), ruleset.ShortName, variant);
                        }
                    }

                    transaction.Commit();
                }
            });
        }
Exemplo n.º 2
0
        public override void HandleInputStateChange(InputStateChangeEvent inputStateChange)
        {
            if (inputStateChange is ReplayInputHandler.ReplayStateChangeEvent <KaraokeSaitenAction> {
                Input : ReplayInputHandler.ReplayState <KaraokeSaitenAction> replayState
            } replayStateChanged)
            {
                // Deal with replay event
                // Release event should be trigger first
                if (replayStateChanged.ReleasedActions.Any() && !replayState.PressedActions.Any())
                {
                    foreach (var action in replayStateChanged.ReleasedActions)
                    {
                        KeyBindingContainer.TriggerReleased(action);
                    }
                }

                // If any key pressed, the continuous send press event
                if (replayState.PressedActions.Any())
                {
                    foreach (var action in replayState.PressedActions)
                    {
                        KeyBindingContainer.TriggerPressed(action);
                    }
                }
            }
Exemplo n.º 3
0
 protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
 {
     InternalChild = KeyBindingContainer =
         CreateKeyBindingContainer(ruleset, variant, unique)
         .WithChild(content = new Container {
         RelativeSizeAxes = Axes.Both
     });
 }
Exemplo n.º 4
0
        public void Register(KeyBindingContainer container, IEnumerable <RulesetInfo> rulesets)
        {
            using (var usage = realmFactory.GetForWrite())
            {
                // intentionally flattened to a list rather than querying against the IQueryable, as nullable fields being queried against aren't indexed.
                // this is much faster as a result.
                var existingBindings = usage.Realm.All <RealmKeyBinding>().ToList();

                insertDefaults(usage, existingBindings, container.DefaultKeyBindings);

                foreach (var ruleset in rulesets)
                {
                    var instance = ruleset.CreateInstance();
                    foreach (var variant in instance.AvailableVariants)
                    {
                        insertDefaults(usage, existingBindings, instance.GetDefaultKeyBindings(variant), ruleset.ID, variant);
                    }
                }

                usage.Commit();
            }
        }
Exemplo n.º 5
0
 public void GameClick()
 {
     KeyBindingContainer.TriggerPressed(OsuAction.LeftButton);
     KeyBindingContainer.TriggerReleased(OsuAction.LeftButton);
 }
Exemplo n.º 6
0
 protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
 {
     InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique);
 }
Exemplo n.º 7
0
 public void TriggerReleased(HishigataAction action) => KeyBindingContainer.TriggerReleased(action);
Exemplo n.º 8
0
 protected override void LoadComplete()
 {
     keyBindingContainer = maniaInputManager?.KeyBindingContainer;
 }
Exemplo n.º 9
0
 public void Register(KeyBindingContainer manager) => insertDefaults(manager.DefaultKeyBindings);
Exemplo n.º 10
0
        public override void HandleInputStateChange(InputStateChangeEvent inputStateChange)
        {
            if (inputStateChange is ReplayInputHandler.ReplayStateChangeEvent <KaraokeSaitenAction> replayStateChanged &&
                replayStateChanged.Input is ReplayInputHandler.ReplayState <KaraokeSaitenAction> replayState)
            {
                // Deal with replay event
                // Release event should be trigger first
                if (replayStateChanged.ReleasedActions.Any() && !replayState.PressedActions.Any())
                {
                    foreach (var action in replayStateChanged.ReleasedActions)
                    {
                        KeyBindingContainer.TriggerReleased(action);
                    }
                }

                // If any key pressed, the continuous send press event
                if (replayState.PressedActions.Any())
                {
                    foreach (var action in replayState.PressedActions)
                    {
                        KeyBindingContainer.TriggerPressed(action);
                    }
                }
            }
            else if (inputStateChange is MicrophoneSoundChangeEvent microphoneSoundChange)
            {
                // Deal with realtime microphone event
                var inputState = microphoneSoundChange.State as IMicrophoneInputState;
                var lastState  = microphoneSoundChange.LastState;
                var state      = inputState?.Microphone;

                if (state == null)
                {
                    throw new ArgumentNullException($"{nameof(state)} cannot be null.");
                }

                // Convert beatmap's pitch to scale setting.
                var scale = beatmap.PitchToScale(state.HasSound ? state.Pitch : lastState.Pitch);

                // TODO : adjust scale by
                scale += 5;

                var action = new KaraokeSaitenAction
                {
                    Scale = scale
                };

                if (lastState.HasSound && !state.HasSound)
                {
                    KeyBindingContainer.TriggerReleased(action);
                }
                else
                {
                    KeyBindingContainer.TriggerPressed(action);
                }
            }
            else
            {
                // Basically should not goes to here
                base.HandleInputStateChange(inputStateChange);
            }
        }
Exemplo n.º 11
0
 protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
 {
     InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique);
     gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
 }
Exemplo n.º 12
0
 public DefaultBindingsSubsection(KeyBindingContainer manager)
     : base(null)
 {
     Defaults = manager.DefaultKeyBindings;
 }
Exemplo n.º 13
0
 public GlobalKeyBindingsSection(KeyBindingContainer manager)
 {
     Add(new DefaultBindingsSubsection(manager));
 }