mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Add AspectAdjust to HitRenderer to allow playfield to consume ful HitRenderer size when needed.
This commit is contained in:
@ -16,6 +16,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Game.Modes.Replays;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
@ -167,6 +168,11 @@ namespace osu.Game.Modes.UI
|
||||
{
|
||||
public event Action<TJudgement> OnJudgement;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to apply adjustments to the child <see cref="Playfield{TObject,TJudgement}"/> based on our own size.
|
||||
/// </summary>
|
||||
public bool AspectAdjust = true;
|
||||
|
||||
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
@ -219,6 +225,19 @@ namespace osu.Game.Modes.UI
|
||||
Playfield.PostProcess();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
Playfield.Size = AspectAdjust ? GetPlayfieldAspectAdjust() : Vector2.One;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In some cases we want to apply changes to the relative size of our contained <see cref="Playfield{TObject, TJudgement}"/> based on custom conditions.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f); //a sane default
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object's Judgement is updated.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user