1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +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.ShowHealthDisplayWhenCantFail, true);
Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitError);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
Set(OsuSetting.FloatingComments, false);

View File

@ -10,7 +10,13 @@ namespace osu.Game.Configuration
[Description("None")]
None,
[Description("Hit Error")]
HitError
[Description("Hit Error (left)")]
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.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Screens.Play.HitErrorDisplay
{
@ -18,29 +19,18 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
private const int margin = 10;
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)
{
float overallDifficulty = workingBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty;
this.processor = processor;
overallDifficulty = workingBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty;
hitWindows = processor.CreateHitWindows();
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]
@ -57,16 +47,50 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
private void onTypeChanged(ValueChangedEvent<ScoreMeterType> type)
{
clear();
switch (type.NewValue)
{
case ScoreMeterType.None:
InternalChildren.ForEach(t => t.FadeOut(fade_duration, Easing.OutQuint));
break;
default:
InternalChildren.ForEach(t => t.FadeIn(fade_duration, Easing.OutQuint));
case ScoreMeterType.HitErrorBoth:
createNew();
createNew(true);
break;
case ScoreMeterType.HitErrorLeft:
createNew();
break;
case ScoreMeterType.HitErrorRight:
createNew(true);
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);
}
}
}