mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 04:32:57 +08:00
Fix legacy coverage metrics
This commit is contained in:
parent
af20eacc82
commit
8f995a30af
@ -6,20 +6,21 @@ using System.Linq;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
public class ManiaModHidden : ManiaModWithPlayfieldCover
|
||||
public partial class ManiaModHidden : ManiaModWithPlayfieldCover
|
||||
{
|
||||
/// <summary>
|
||||
/// osu!stable is referenced to 768px.
|
||||
/// </summary>
|
||||
private const float playfield_height = 768;
|
||||
private const float reference_playfield_height = 768;
|
||||
|
||||
private const float min_coverage = 160f / playfield_height;
|
||||
private const float max_coverage = 400f / playfield_height;
|
||||
private const float coverage_increase_per_combo = 0.5f / playfield_height;
|
||||
private const float min_coverage = 160 / reference_playfield_height;
|
||||
private const float max_coverage = 400f / reference_playfield_height;
|
||||
private const float coverage_increase_per_combo = 0.5f / reference_playfield_height;
|
||||
|
||||
public override LocalisableString Description => @"Keys fade out before you hit them!";
|
||||
public override double ScoreMultiplier => 1;
|
||||
@ -43,5 +44,23 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
combo.BindTo(scoreProcessor.Combo);
|
||||
combo.BindValueChanged(c => Coverage.Value = Math.Min(max_coverage, min_coverage + c.NewValue * coverage_increase_per_combo), true);
|
||||
}
|
||||
|
||||
protected override PlayfieldCoveringWrapper CreateCover(Drawable content) => new LegacyPlayfieldCover(content);
|
||||
|
||||
private partial class LegacyPlayfieldCover : PlayfieldCoveringWrapper
|
||||
{
|
||||
public LegacyPlayfieldCover(Drawable content)
|
||||
: base(content)
|
||||
{
|
||||
}
|
||||
|
||||
protected override float GetHeight(float coverage)
|
||||
{
|
||||
if (DrawHeight == 0)
|
||||
return base.GetHeight(coverage);
|
||||
|
||||
return base.GetHeight(coverage) * reference_playfield_height / DrawHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
Container hocParent = (Container)hoc.Parent!;
|
||||
|
||||
hocParent.Remove(hoc, false);
|
||||
hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c =>
|
||||
hocParent.Add(CreateCover(hoc).With(c =>
|
||||
{
|
||||
c.RelativeSizeAxes = Axes.Both;
|
||||
c.Direction = ExpandDirection;
|
||||
@ -47,6 +47,8 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual PlayfieldCoveringWrapper CreateCover(Drawable content) => new PlayfieldCoveringWrapper(content);
|
||||
|
||||
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||
{
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
private readonly IBindable<ScrollingDirection> scrollDirection = new Bindable<ScrollingDirection>();
|
||||
|
||||
private float currentCoverage;
|
||||
|
||||
public PlayfieldCoveringWrapper(Drawable content)
|
||||
{
|
||||
InternalChild = new BufferedContainer
|
||||
@ -112,15 +114,19 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
base.Update();
|
||||
|
||||
updateHeight((float)Interpolation.DampContinuously(filled.Height, Coverage.Value, 25, Math.Abs(Time.Elapsed)));
|
||||
updateHeight((float)Interpolation.DampContinuously(currentCoverage, Coverage.Value, 25, Math.Abs(Time.Elapsed)));
|
||||
}
|
||||
|
||||
private void updateHeight(float height)
|
||||
private void updateHeight(float coverage)
|
||||
{
|
||||
filled.Height = height;
|
||||
gradient.Y = -height;
|
||||
filled.Height = GetHeight(coverage);
|
||||
gradient.Y = -GetHeight(coverage);
|
||||
|
||||
currentCoverage = coverage;
|
||||
}
|
||||
|
||||
protected virtual float GetHeight(float coverage) => coverage;
|
||||
|
||||
private void onScrollDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
|
||||
=> cover.Rotation = direction.NewValue == ScrollingDirection.Up ? 0 : 180f;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user