1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Add ability to select side

This commit is contained in:
Andrei Zavatski 2019-08-19 22:04:27 +03:00
parent 1bff103d32
commit f1c3a60660
3 changed files with 54 additions and 24 deletions

View File

@ -79,7 +79,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.ShowInterface, true); Set(OsuSetting.ShowInterface, true);
Set(OsuSetting.ShowHealthDisplayWhenCantFail, true); Set(OsuSetting.ShowHealthDisplayWhenCantFail, true);
Set(OsuSetting.KeyOverlay, false); Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitError); Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
Set(OsuSetting.FloatingComments, false); Set(OsuSetting.FloatingComments, false);

View File

@ -10,7 +10,13 @@ namespace osu.Game.Configuration
[Description("None")] [Description("None")]
None, None,
[Description("Hit Error")] [Description("Hit Error (left)")]
HitError HitErrorLeft,
[Description("Hit Error (right)")]
HitErrorRight,
[Description("Hit Error (both)")]
HitErrorBoth,
} }
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Bindables;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Screens.Play.HitErrorDisplay namespace osu.Game.Screens.Play.HitErrorDisplay
{ {
@ -18,29 +19,18 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
private const int margin = 10; private const int margin = 10;
private readonly Bindable<ScoreMeterType> type = new Bindable<ScoreMeterType>(); private readonly Bindable<ScoreMeterType> type = new Bindable<ScoreMeterType>();
private readonly HitWindows hitWindows;
private readonly ScoreProcessor processor;
private readonly float overallDifficulty;
public HitErrorDisplayOverlay(ScoreProcessor processor, WorkingBeatmap workingBeatmap) public HitErrorDisplayOverlay(ScoreProcessor processor, WorkingBeatmap workingBeatmap)
{ {
float overallDifficulty = workingBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty; this.processor = processor;
overallDifficulty = workingBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty;
hitWindows = processor.CreateHitWindows();
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Children = new[]
{
new DefaultHitErrorDisplay(overallDifficulty, processor.CreateHitWindows())
{
Margin = new MarginPadding { Left = margin },
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new DefaultHitErrorDisplay(overallDifficulty, processor.CreateHitWindows(), true)
{
Margin = new MarginPadding { Right = margin },
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
};
Children.ForEach(t => processor.NewJudgement += t.OnNewJudgement);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -57,16 +47,50 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
private void onTypeChanged(ValueChangedEvent<ScoreMeterType> type) private void onTypeChanged(ValueChangedEvent<ScoreMeterType> type)
{ {
clear();
switch (type.NewValue) switch (type.NewValue)
{ {
case ScoreMeterType.None: case ScoreMeterType.None:
InternalChildren.ForEach(t => t.FadeOut(fade_duration, Easing.OutQuint));
break; break;
default: case ScoreMeterType.HitErrorBoth:
InternalChildren.ForEach(t => t.FadeIn(fade_duration, Easing.OutQuint)); createNew();
createNew(true);
break;
case ScoreMeterType.HitErrorLeft:
createNew();
break;
case ScoreMeterType.HitErrorRight:
createNew(true);
break; break;
} }
} }
private void clear()
{
Children.ForEach(t =>
{
processor.NewJudgement -= t.OnNewJudgement;
t.FadeOut(fade_duration, Easing.OutQuint).Expire();
});
}
private void createNew(bool reversed = false)
{
var display = new DefaultHitErrorDisplay(overallDifficulty, hitWindows, reversed)
{
Margin = new MarginPadding(margin),
Anchor = reversed ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = reversed ? Anchor.CentreRight : Anchor.CentreLeft,
Alpha = 0,
};
processor.NewJudgement += display.OnNewJudgement;
Add(display);
display.FadeInFromZero(fade_duration, Easing.OutQuint);
}
} }
} }