mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 13:47:33 +08:00
Merge pull request #4536 from peppy/key-counter-display
Rename KeyCounterCollection -> KeyCounterDisplay
This commit is contained in:
commit
aaeb598649
@ -20,13 +20,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
typeof(KeyCounterKeyboard),
|
typeof(KeyCounterKeyboard),
|
||||||
typeof(KeyCounterMouse),
|
typeof(KeyCounterMouse),
|
||||||
typeof(KeyCounterCollection)
|
typeof(KeyCounterDisplay)
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestCaseKeyCounter()
|
public TestCaseKeyCounter()
|
||||||
{
|
{
|
||||||
KeyCounterKeyboard rewindTestKeyCounterKeyboard;
|
KeyCounterKeyboard rewindTestKeyCounterKeyboard;
|
||||||
KeyCounterCollection kc = new KeyCounterCollection
|
KeyCounterDisplay kc = new KeyCounterDisplay
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -211,7 +211,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <returns>The DrawableHitObject.</returns>
|
/// <returns>The DrawableHitObject.</returns>
|
||||||
public abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
public abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
||||||
|
|
||||||
public void Attach(KeyCounterCollection keyCounter) =>
|
public void Attach(KeyCounterDisplay keyCounter) =>
|
||||||
(KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter);
|
(KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -34,11 +34,15 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
protected readonly KeyBindingContainer<T> KeyBindingContainer;
|
protected readonly KeyBindingContainer<T> KeyBindingContainer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => KeyBindingContainer;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
private readonly Container content;
|
||||||
|
|
||||||
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
{
|
{
|
||||||
InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique);
|
InternalChild = KeyBindingContainer =
|
||||||
|
CreateKeyBindingContainer(ruleset, variant, unique)
|
||||||
|
.WithChild(content = new Container { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
@ -115,18 +119,19 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
#region Key Counter Attachment
|
#region Key Counter Attachment
|
||||||
|
|
||||||
public void Attach(KeyCounterCollection keyCounter)
|
public void Attach(KeyCounterDisplay keyCounter)
|
||||||
{
|
{
|
||||||
var receptor = new ActionReceptor(keyCounter);
|
var receptor = new ActionReceptor(keyCounter);
|
||||||
Add(receptor);
|
|
||||||
keyCounter.SetReceptor(receptor);
|
|
||||||
|
|
||||||
|
KeyBindingContainer.Add(receptor);
|
||||||
|
|
||||||
|
keyCounter.SetReceptor(receptor);
|
||||||
keyCounter.AddRange(KeyBindingContainer.DefaultKeyBindings.Select(b => b.GetAction<T>()).Distinct().Select(b => new KeyCounterAction<T>(b)));
|
keyCounter.AddRange(KeyBindingContainer.DefaultKeyBindings.Select(b => b.GetAction<T>()).Distinct().Select(b => new KeyCounterAction<T>(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActionReceptor : KeyCounterCollection.Receptor, IKeyBindingHandler<T>
|
public class ActionReceptor : KeyCounterDisplay.Receptor, IKeyBindingHandler<T>
|
||||||
{
|
{
|
||||||
public ActionReceptor(KeyCounterCollection target)
|
public ActionReceptor(KeyCounterDisplay target)
|
||||||
: base(target)
|
: base(target)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -159,12 +164,12 @@ namespace osu.Game.Rulesets.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Supports attaching a <see cref="KeyCounterCollection"/>.
|
/// Supports attaching a <see cref="KeyCounterDisplay"/>.
|
||||||
/// Keys will be populated automatically and a receptor will be injected inside.
|
/// Keys will be populated automatically and a receptor will be injected inside.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICanAttachKeyCounter
|
public interface ICanAttachKeyCounter
|
||||||
{
|
{
|
||||||
void Attach(KeyCounterCollection keyCounter);
|
void Attach(KeyCounterDisplay keyCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RulesetInputManagerInputState<T> : InputState
|
public class RulesetInputManagerInputState<T> : InputState
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
private const int duration = 100;
|
private const int duration = 100;
|
||||||
|
|
||||||
public readonly KeyCounterCollection KeyCounter;
|
public readonly KeyCounterDisplay KeyCounter;
|
||||||
public readonly RollingCounter<int> ComboCounter;
|
public readonly RollingCounter<int> ComboCounter;
|
||||||
public readonly ScoreCounter ScoreCounter;
|
public readonly ScoreCounter ScoreCounter;
|
||||||
public readonly RollingCounter<double> AccuracyCounter;
|
public readonly RollingCounter<double> AccuracyCounter;
|
||||||
@ -201,7 +201,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Margin = new MarginPadding { Top = 20 }
|
Margin = new MarginPadding { Top = 20 }
|
||||||
};
|
};
|
||||||
|
|
||||||
protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
protected virtual KeyCounterDisplay CreateKeyCounter() => new KeyCounterDisplay
|
||||||
{
|
{
|
||||||
FadeTime = 50,
|
FadeTime = 50,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
|
@ -14,14 +14,14 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterCollection : FillFlowContainer<KeyCounter>
|
public class KeyCounterDisplay : FillFlowContainer<KeyCounter>
|
||||||
{
|
{
|
||||||
private const int duration = 100;
|
private const int duration = 100;
|
||||||
|
|
||||||
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
|
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
|
||||||
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
||||||
|
|
||||||
public KeyCounterCollection()
|
public KeyCounterDisplay()
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal;
|
Direction = FillDirection.Horizontal;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -138,9 +138,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public class Receptor : Drawable
|
public class Receptor : Drawable
|
||||||
{
|
{
|
||||||
protected readonly KeyCounterCollection Target;
|
protected readonly KeyCounterDisplay Target;
|
||||||
|
|
||||||
public Receptor(KeyCounterCollection target)
|
public Receptor(KeyCounterDisplay target)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Depth = float.MinValue;
|
Depth = float.MinValue;
|
Loading…
Reference in New Issue
Block a user