mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09:00
Remove non-smoke key bindings on "Relax" mod instead
This commit is contained in:
parent
c89a55043e
commit
2d4f390372
@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
@ -37,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ReloadMappings()
|
protected override void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||||
{
|
{
|
||||||
KeyBindings = DefaultKeyBindings;
|
KeyBindings = DefaultKeyBindings;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -11,6 +10,7 @@ using osu.Framework.Input;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Input.StateChanges.Events;
|
using osu.Framework.Input.StateChanges.Events;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu
|
namespace osu.Game.Rulesets.Osu
|
||||||
@ -60,16 +60,30 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
private class OsuKeyBindingContainer : RulesetKeyBindingContainer
|
private class OsuKeyBindingContainer : RulesetKeyBindingContainer
|
||||||
{
|
{
|
||||||
public bool AllowUserPresses = true;
|
private bool allowUserPresses = true;
|
||||||
|
|
||||||
private static readonly OsuAction[] all_actions = (OsuAction[])Enum.GetValues(typeof(OsuAction));
|
public bool AllowUserPresses
|
||||||
|
{
|
||||||
protected override IEnumerable<OsuAction> BlockedActions => !AllowUserPresses ? all_actions.Where(a => a != OsuAction.Smoke) : Enumerable.Empty<OsuAction>();
|
get => allowUserPresses;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
allowUserPresses = value;
|
||||||
|
ReloadMappings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public OsuKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
public OsuKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
: base(ruleset, variant, unique)
|
: base(ruleset, variant, unique)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||||
|
{
|
||||||
|
base.ReloadMappings(realmKeyBindings);
|
||||||
|
|
||||||
|
if (!AllowUserPresses)
|
||||||
|
KeyBindings = KeyBindings.Where(b => b.GetAction<OsuAction>() == OsuAction.Smoke).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ namespace osu.Game.Input.Bindings
|
|||||||
{
|
{
|
||||||
// The first fire of this is a bit redundant as this is being called in base.LoadComplete,
|
// The first fire of this is a bit redundant as this is being called in base.LoadComplete,
|
||||||
// but this is safest in case the subscription is restored after a context recycle.
|
// but this is safest in case the subscription is restored after a context recycle.
|
||||||
reloadMappings(sender.AsQueryable());
|
ReloadMappings(sender.AsQueryable());
|
||||||
});
|
});
|
||||||
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ReloadMappings() => reloadMappings(queryRealmKeyBindings(realm.Realm));
|
protected sealed override void ReloadMappings() => ReloadMappings(queryRealmKeyBindings(realm.Realm));
|
||||||
|
|
||||||
private IQueryable<RealmKeyBinding> queryRealmKeyBindings(Realm realm)
|
private IQueryable<RealmKeyBinding> queryRealmKeyBindings(Realm realm)
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
.Where(b => b.RulesetName == rulesetName && b.Variant == variant);
|
.Where(b => b.RulesetName == rulesetName && b.Variant == variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
protected virtual void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||||
{
|
{
|
||||||
var defaults = DefaultKeyBindings.ToList();
|
var defaults = DefaultKeyBindings.ToList();
|
||||||
|
|
||||||
|
@ -230,9 +230,9 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ReloadMappings()
|
protected override void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||||
{
|
{
|
||||||
base.ReloadMappings();
|
base.ReloadMappings(realmKeyBindings);
|
||||||
|
|
||||||
KeyBindings = KeyBindings.Where(b => RealmKeyBindingStore.CheckValidForGameplay(b.KeyCombination)).ToList();
|
KeyBindings = KeyBindings.Where(b => RealmKeyBindingStore.CheckValidForGameplay(b.KeyCombination)).ToList();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user