mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Merge branch 'master' into general-slider-improvements
This commit is contained in:
commit
50d0278cbd
@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Vector2 GetPlayfieldAspectAdjust() => new Vector2(1, 0.8f);
|
protected override Vector2 GetAspectAdjustedSize() => new Vector2(1, 0.8f);
|
||||||
|
|
||||||
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new ManiaFramedReplayInputHandler(replay, this);
|
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new ManiaFramedReplayInputHandler(replay, this);
|
||||||
|
|
||||||
|
@ -27,21 +27,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
||||||
|
|
||||||
public override Vector2 Size
|
public OsuPlayfield()
|
||||||
{
|
: base(BASE_SIZE.X)
|
||||||
get
|
|
||||||
{
|
|
||||||
if (Parent == null)
|
|
||||||
return Vector2.Zero;
|
|
||||||
|
|
||||||
var parentSize = Parent.DrawSize;
|
|
||||||
var aspectSize = parentSize.X * 0.75f < parentSize.Y ? new Vector2(parentSize.X, parentSize.X * 0.75f) : new Vector2(parentSize.Y * 4f / 3f, parentSize.Y);
|
|
||||||
|
|
||||||
return new Vector2(aspectSize.X / parentSize.X, aspectSize.Y / parentSize.Y) * base.Size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OsuPlayfield() : base(BASE_SIZE.X)
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
@ -50,7 +50,11 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuReplayInputHandler(replay);
|
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuReplayInputHandler(replay);
|
||||||
|
|
||||||
protected override Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f);
|
protected override Vector2 GetAspectAdjustedSize()
|
||||||
|
{
|
||||||
|
var aspectSize = DrawSize.X * 0.75f < DrawSize.Y ? new Vector2(DrawSize.X, DrawSize.X * 0.75f) : new Vector2(DrawSize.Y * 4f / 3f, DrawSize.Y);
|
||||||
|
return new Vector2(aspectSize.X / DrawSize.X, aspectSize.Y / DrawSize.Y) * 0.75f;
|
||||||
|
}
|
||||||
|
|
||||||
protected override CursorContainer CreateCursor() => new GameplayCursor();
|
protected override CursorContainer CreateCursor() => new GameplayCursor();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Vector2 GetPlayfieldAspectAdjust()
|
protected override Vector2 GetAspectAdjustedSize()
|
||||||
{
|
{
|
||||||
const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
||||||
const float default_aspect = 16f / 9f;
|
const float default_aspect = 16f / 9f;
|
||||||
|
@ -33,11 +33,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class RulesetContainer : Container
|
public abstract class RulesetContainer : Container
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Whether to apply adjustments to the child <see cref="Playfield"/> based on our own size.
|
|
||||||
/// </summary>
|
|
||||||
public bool AspectAdjust = true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The selected variant.
|
/// The selected variant.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -324,7 +319,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Playfield.Size = AspectAdjust ? GetPlayfieldAspectAdjust() : Vector2.One;
|
Playfield.Size = GetAspectAdjustedSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -335,10 +330,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
protected virtual BeatmapProcessor<TObject> CreateBeatmapProcessor() => new BeatmapProcessor<TObject>();
|
protected virtual BeatmapProcessor<TObject> CreateBeatmapProcessor() => new BeatmapProcessor<TObject>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// In some cases we want to apply changes to the relative size of our contained <see cref="Playfield"/> based on custom conditions.
|
/// Computes the final size of the <see cref="Playfield"/> in relative coordinate space after all
|
||||||
|
/// aspect and scale adjustments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>The aspect-adjusted size.</returns>
|
||||||
protected virtual Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f); //a sane default
|
protected virtual Vector2 GetAspectAdjustedSize() => new Vector2(0.75f); // A sane default
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a converter to convert Beatmap to a specific mode.
|
/// Creates a converter to convert Beatmap to a specific mode.
|
||||||
|
Loading…
Reference in New Issue
Block a user