1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:53:15 +08:00

Add documentation and regions to RulesetInputManager

This commit is contained in:
Dean Herbert 2017-08-24 15:48:40 +09:00
parent a7a7e0323f
commit f0635af40d

View File

@ -23,6 +23,8 @@ namespace osu.Game.Rulesets.UI
{ {
} }
#region Action mapping (for replays)
private List<T> lastPressedActions = new List<T>(); private List<T> lastPressedActions = new List<T>();
protected override void HandleNewState(InputState state) protected override void HandleNewState(InputState state)
@ -47,8 +49,9 @@ namespace osu.Game.Rulesets.UI
lastPressedActions = newActions; lastPressedActions = newActions;
} }
private ManualClock clock; #endregion
private IFrameBasedClock parentClock;
#region IHasReplayHandler
private ReplayInputHandler replayInputHandler; private ReplayInputHandler replayInputHandler;
public ReplayInputHandler ReplayInputHandler public ReplayInputHandler ReplayInputHandler
@ -69,13 +72,12 @@ namespace osu.Game.Rulesets.UI
} }
} }
private Bindable<bool> mouseDisabled; #endregion
[BackgroundDependencyLoader] #region Clock control
private void load(OsuConfigManager config)
{ private ManualClock clock;
mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons); private IFrameBasedClock parentClock;
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
@ -152,6 +154,18 @@ namespace osu.Game.Rulesets.UI
base.Update(); base.Update();
} }
#endregion
#region Setting application (disables etc.)
private Bindable<bool> mouseDisabled;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
}
protected override void TransformState(InputState state) protected override void TransformState(InputState state)
{ {
base.TransformState(state); base.TransformState(state);
@ -171,6 +185,10 @@ namespace osu.Game.Rulesets.UI
} }
} }
#endregion
#region Key Counter Attachment
public void Attach(KeyCounterCollection keyCounter) public void Attach(KeyCounterCollection keyCounter)
{ {
var receptor = new ActionReceptor(keyCounter); var receptor = new ActionReceptor(keyCounter);
@ -191,13 +209,22 @@ namespace osu.Game.Rulesets.UI
public bool OnReleased(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnReleased(action)); public bool OnReleased(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnReleased(action));
} }
#endregion
} }
/// <summary>
/// Expose the <see cref="ReplayInputHandler"/> in a capable <see cref="InputManager"/>.
/// </summary>
public interface IHasReplayHandler public interface IHasReplayHandler
{ {
ReplayInputHandler ReplayInputHandler { get; set; } ReplayInputHandler ReplayInputHandler { get; set; }
} }
/// <summary>
/// Supports attaching a <see cref="KeyCounterCollection"/>.
/// Keys will be populated automatically and a receptor will be injected inside.
/// </summary>
public interface ICanAttachKeyCounter public interface ICanAttachKeyCounter
{ {
void Attach(KeyCounterCollection keyCounter); void Attach(KeyCounterCollection keyCounter);