mirror of https://github.com/ppy/osu
Fix resolution scaling
This commit is contained in:
parent
8f995a30af
commit
755bc7c050
|
@ -3,11 +3,14 @@
|
|||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mania.Skinning;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
|
@ -18,7 +21,7 @@ public partial class ManiaModHidden : ManiaModWithPlayfieldCover
|
|||
/// </summary>
|
||||
private const float reference_playfield_height = 768;
|
||||
|
||||
private const float min_coverage = 160 / reference_playfield_height;
|
||||
private const float min_coverage = 160f / reference_playfield_height;
|
||||
private const float max_coverage = 400f / reference_playfield_height;
|
||||
private const float coverage_increase_per_combo = 0.5f / reference_playfield_height;
|
||||
|
||||
|
@ -49,17 +52,38 @@ public override void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
|||
|
||||
private partial class LegacyPlayfieldCover : PlayfieldCoveringWrapper
|
||||
{
|
||||
[Resolved]
|
||||
private ISkinSource skin { get; set; } = null!;
|
||||
|
||||
private IBindable<float>? hitPosition;
|
||||
|
||||
public LegacyPlayfieldCover(Drawable content)
|
||||
: base(content)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
skin.SourceChanged += onSkinChanged;
|
||||
onSkinChanged();
|
||||
}
|
||||
|
||||
private void onSkinChanged()
|
||||
{
|
||||
hitPosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.HitPosition);
|
||||
}
|
||||
|
||||
protected override float GetHeight(float coverage)
|
||||
{
|
||||
if (DrawHeight == 0)
|
||||
// In osu!stable, the cover is applied in absolute (x768) coordinates from the hit position.
|
||||
float availablePlayfieldHeight = Math.Abs(reference_playfield_height - (hitPosition?.Value ?? Stage.HIT_TARGET_POSITION));
|
||||
|
||||
if (availablePlayfieldHeight == 0)
|
||||
return base.GetHeight(coverage);
|
||||
|
||||
return base.GetHeight(coverage) * reference_playfield_height / DrawHeight;
|
||||
return base.GetHeight(coverage) * reference_playfield_height / availablePlayfieldHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue