mirror of
https://github.com/ppy/osu
synced 2024-12-26 00:32:52 +00:00
refactor: rename Trigger
class to InputTrigger
This commit is contained in:
parent
aa2e0028ab
commit
157bba7830
@ -579,7 +579,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
private void checkNotPressed(OsuAction action) => AddAssert($"Not pressing {action}", () => !osuInputManager.PressedActions.Contains(action));
|
||||
private void checkPressed(OsuAction action) => AddAssert($"Is pressing {action}", () => osuInputManager.PressedActions.Contains(action));
|
||||
|
||||
public partial class TestActionKeyCounter : KeyCounter.Trigger, IKeyBindingHandler<OsuAction>
|
||||
public partial class TestActionKeyCounter : KeyCounter.InputTrigger, IKeyBindingHandler<OsuAction>
|
||||
{
|
||||
public OsuAction Action { get; }
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
kc.Add(kc.CreateKeyCounter(new KeyCounterKeyboard(key)));
|
||||
});
|
||||
|
||||
Key testKey = ((KeyCounterKeyboard)kc.Children.First().CounterTrigger).Key;
|
||||
Key testKey = ((KeyCounterKeyboard)kc.Children.First().Trigger).Key;
|
||||
|
||||
void addPressKeyStep()
|
||||
{
|
||||
|
@ -176,14 +176,14 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<T> e) => Target.Children.Where(c => c.CounterTrigger is KeyCounterAction<T>)
|
||||
.Select(c => (KeyCounterAction<T>)c.CounterTrigger)
|
||||
public bool OnPressed(KeyBindingPressEvent<T> e) => Target.Children.Where(c => c.Trigger is KeyCounterAction<T>)
|
||||
.Select(c => (KeyCounterAction<T>)c.Trigger)
|
||||
.Any(c => c.OnPressed(e.Action, Clock.Rate >= 0));
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<T> e)
|
||||
{
|
||||
foreach (var c
|
||||
in Target.Children.Where(c => c.CounterTrigger is KeyCounterAction<T>).Select(c => (KeyCounterAction<T>)c.CounterTrigger))
|
||||
in Target.Children.Where(c => c.Trigger is KeyCounterAction<T>).Select(c => (KeyCounterAction<T>)c.Trigger))
|
||||
c.OnReleased(e.Action, Clock.Rate >= 0);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Play
|
||||
public Color4 KeyUpTextColor { get; set; } = Color4.White;
|
||||
public double FadeTime { get; set; }
|
||||
|
||||
public DefaultKeyCounter(Trigger trigger)
|
||||
public DefaultKeyCounter(InputTrigger trigger)
|
||||
: base(trigger)
|
||||
{
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public abstract partial class KeyCounter : Container
|
||||
{
|
||||
public readonly Trigger CounterTrigger;
|
||||
public readonly InputTrigger Trigger;
|
||||
|
||||
protected Bindable<bool> IsCountingBindable = new BindableBool(true);
|
||||
|
||||
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
|
||||
private set => PressesCount.Value = value;
|
||||
}
|
||||
|
||||
protected KeyCounter(Trigger trigger)
|
||||
protected KeyCounter(InputTrigger trigger)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -43,10 +43,10 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
CounterTrigger = trigger,
|
||||
Trigger = trigger,
|
||||
};
|
||||
|
||||
CounterTrigger.Target = this;
|
||||
Trigger.Target = this;
|
||||
Name = trigger.Name;
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@ namespace osu.Game.Screens.Play
|
||||
CountPresses--;
|
||||
}
|
||||
|
||||
protected override bool Handle(UIEvent e) => CounterTrigger.TriggerEvent(e);
|
||||
protected override bool Handle(UIEvent e) => Trigger.TriggerEvent(e);
|
||||
|
||||
public abstract partial class Trigger : Component
|
||||
public abstract partial class InputTrigger : Component
|
||||
{
|
||||
private KeyCounter? target;
|
||||
|
||||
@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play
|
||||
set => target = value;
|
||||
}
|
||||
|
||||
protected Trigger(string name)
|
||||
protected InputTrigger(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public partial class KeyCounterAction<T> : KeyCounter.Trigger
|
||||
public partial class KeyCounterAction<T> : KeyCounter.InputTrigger
|
||||
where T : struct
|
||||
{
|
||||
public T Action { get; }
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens.Play
|
||||
this.receptor = receptor;
|
||||
}
|
||||
|
||||
public virtual KeyCounter CreateKeyCounter(KeyCounter.Trigger trigger) => new DefaultKeyCounter(trigger);
|
||||
public virtual KeyCounter CreateKeyCounter(KeyCounter.InputTrigger trigger) => new DefaultKeyCounter(trigger);
|
||||
|
||||
public partial class Receptor : Drawable
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public partial class KeyCounterKeyboard : KeyCounter.Trigger
|
||||
public partial class KeyCounterKeyboard : KeyCounter.InputTrigger
|
||||
{
|
||||
public Key Key { get; }
|
||||
|
||||
|
@ -9,7 +9,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public partial class KeyCounterMouse : KeyCounter.Trigger
|
||||
public partial class KeyCounterMouse : KeyCounter.InputTrigger
|
||||
{
|
||||
public MouseButton Button { get; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user