1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 11:27:24 +08:00
osu-lazer/osu.Game/Screens/Play/StandardHUDOverlay.cs
2017-05-16 12:50:30 +09:00

99 lines
3.3 KiB
C#

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play.HUD;
using OpenTK;
namespace osu.Game.Screens.Play
{
public class StandardHUDOverlay : HUDOverlay
{
protected override RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight,
Position = new Vector2(0, 35),
TextSize = 20,
Margin = new MarginPadding { Right = 140 },
};
protected override RollingCounter<int> CreateComboCounter() => new SimpleComboCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft,
Position = new Vector2(0, 35),
Margin = new MarginPadding { Left = 140 },
TextSize = 20,
};
protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
{
Size = new Vector2(1, 5),
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20 }
};
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
{
IsCounting = true,
FadeTime = 50,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(10),
Y = - TwoLayerButton.SIZE_RETRACTED.Y,
};
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 40,
Position = new Vector2(0, 30),
};
protected override SongProgress CreateProgress() => new SongProgress
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
};
protected override ModDisplay CreateModsContainer() => new ModDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = 20, Right = 10 },
};
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
ComboCounter.AccentColour = colours.BlueLighter;
AccuracyCounter.AccentColour = colours.BlueLighter;
ScoreCounter.AccentColour = colours.BlueLighter;
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
{
shd.AccentColour = colours.BlueLighter;
shd.GlowColour = colours.BlueDarker;
}
}
public override void BindProcessor(ScoreProcessor processor)
{
base.BindProcessor(processor);
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
processor.NewJudgement += shd.Flash;
}
}
}