2023-02-13 09:33:09 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2023-04-25 20:22:55 +08:00
|
|
|
using System.Linq;
|
2023-02-13 09:33:09 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
2023-03-07 15:28:54 +08:00
|
|
|
namespace osu.Game.Screens.Play.HUD
|
2023-02-13 09:33:09 +08:00
|
|
|
{
|
|
|
|
public partial class DefaultKeyCounterDisplay : KeyCounterDisplay
|
|
|
|
{
|
|
|
|
private const double key_fade_time = 80;
|
|
|
|
|
2023-04-25 20:22:55 +08:00
|
|
|
protected override FillFlowContainer<KeyCounter> KeyFlow { get; }
|
2023-02-13 09:33:09 +08:00
|
|
|
|
|
|
|
public DefaultKeyCounterDisplay()
|
|
|
|
{
|
2024-08-06 14:52:03 +08:00
|
|
|
Child = KeyFlow = new FillFlowContainer<KeyCounter>
|
2023-03-15 17:02:12 +08:00
|
|
|
{
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
};
|
2023-02-13 09:33:09 +08:00
|
|
|
}
|
|
|
|
|
2023-04-25 20:22:55 +08:00
|
|
|
protected override KeyCounter CreateCounter(InputTrigger trigger) => new DefaultKeyCounter(trigger)
|
|
|
|
{
|
|
|
|
FadeTime = key_fade_time,
|
|
|
|
KeyDownTextColor = KeyDownTextColor,
|
|
|
|
KeyUpTextColor = KeyUpTextColor,
|
|
|
|
};
|
2023-02-13 09:33:09 +08:00
|
|
|
|
|
|
|
private Color4 keyDownTextColor = Color4.DarkGray;
|
|
|
|
|
|
|
|
public Color4 KeyDownTextColor
|
|
|
|
{
|
|
|
|
get => keyDownTextColor;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != keyDownTextColor)
|
|
|
|
{
|
|
|
|
keyDownTextColor = value;
|
2023-04-25 20:22:55 +08:00
|
|
|
foreach (var child in KeyFlow.Cast<DefaultKeyCounter>())
|
2023-03-09 05:10:34 +08:00
|
|
|
child.KeyDownTextColor = value;
|
2023-02-13 09:33:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Color4 keyUpTextColor = Color4.White;
|
|
|
|
|
|
|
|
public Color4 KeyUpTextColor
|
|
|
|
{
|
|
|
|
get => keyUpTextColor;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != keyUpTextColor)
|
|
|
|
{
|
|
|
|
keyUpTextColor = value;
|
2023-04-25 20:22:55 +08:00
|
|
|
foreach (var child in KeyFlow.Cast<DefaultKeyCounter>())
|
2023-03-09 05:10:34 +08:00
|
|
|
child.KeyUpTextColor = value;
|
2023-02-13 09:33:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|