mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 16:12:57 +08: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
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
@ -11,6 +10,7 @@ using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.StateChanges.Events;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu
|
||||
@ -60,16 +60,30 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
private class OsuKeyBindingContainer : RulesetKeyBindingContainer
|
||||
{
|
||||
public bool AllowUserPresses = true;
|
||||
private bool allowUserPresses = true;
|
||||
|
||||
private static readonly OsuAction[] all_actions = (OsuAction[])Enum.GetValues(typeof(OsuAction));
|
||||
|
||||
protected override IEnumerable<OsuAction> BlockedActions => !AllowUserPresses ? all_actions.Where(a => a != OsuAction.Smoke) : Enumerable.Empty<OsuAction>();
|
||||
public bool AllowUserPresses
|
||||
{
|
||||
get => allowUserPresses;
|
||||
set
|
||||
{
|
||||
allowUserPresses = value;
|
||||
ReloadMappings();
|
||||
}
|
||||
}
|
||||
|
||||
public OsuKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode 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,
|
||||
// but this is safest in case the subscription is restored after a context recycle.
|
||||
reloadMappings(sender.AsQueryable());
|
||||
ReloadMappings(sender.AsQueryable());
|
||||
});
|
||||
|
||||
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)
|
||||
{
|
||||
@ -70,7 +70,7 @@ namespace osu.Game.Input.Bindings
|
||||
.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();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user