1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 00:47:24 +08:00
osu-lazer/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.8 KiB
C#
Raw Normal View History

// 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.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.States;
using osu.Game.Overlays;
namespace osu.Game.Screens.Utility.SampleComponents
{
public abstract class LatencySampleComponent : CompositeDrawable
{
protected readonly BindableDouble SampleBPM = new BindableDouble();
protected readonly BindableDouble SampleApproachRate = new BindableDouble();
protected readonly BindableFloat SampleVisualSpacing = new BindableFloat();
protected readonly BindableBool IsActive = new BindableBool();
private InputManager inputManager = null!;
[Resolved]
private LatencyArea latencyArea { get; set; } = null!;
[Resolved]
protected OverlayColourProvider OverlayColourProvider { get; private set; } = null!;
[BackgroundDependencyLoader]
private void load(LatencyCertifierScreen latencyCertifierScreen)
{
SampleBPM.BindTo(latencyCertifierScreen.SampleBPM);
SampleApproachRate.BindTo(latencyCertifierScreen.SampleApproachRate);
SampleVisualSpacing.BindTo(latencyCertifierScreen.SampleVisualSpacing);
}
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
IsActive.BindTo(latencyArea.IsActiveArea);
}
protected sealed override void Update()
{
base.Update();
UpdateAtLimitedRate(inputManager.CurrentState);
}
protected abstract void UpdateAtLimitedRate(InputState inputState);
}
}