1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Merge pull request #8301 from peppy/fix-header-text-scaling

Fix header-text scaling on intro/winner screens
This commit is contained in:
Dan Balasescu 2020-03-17 18:21:44 +09:00 committed by GitHub
commit 38dcf01caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 8 deletions

View File

@ -0,0 +1,40 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Tests.Components
{
public class TestSceneRoundDisplay : TournamentTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableTournamentHeaderText),
typeof(DrawableTournamentHeaderLogo),
};
public TestSceneRoundDisplay()
{
Children = new Drawable[]
{
new RoundDisplay(new TournamentMatch
{
Round =
{
Value = new TournamentRound
{
Name = { Value = "Test Round" }
}
}
})
{
Margin = new MarginPadding(20)
}
};
}
}
}

View File

@ -11,9 +11,13 @@ namespace osu.Game.Tournament.Components
{
public class DrawableTournamentHeaderText : CompositeDrawable
{
public DrawableTournamentHeaderText()
public DrawableTournamentHeaderText(bool center = true)
{
InternalChild = new TextSprite();
InternalChild = new TextSprite
{
Anchor = center ? Anchor.Centre : Anchor.TopLeft,
Origin = center ? Anchor.Centre : Anchor.TopLeft,
};
Height = 22;
RelativeSizeAxes = Axes.X;
@ -27,9 +31,6 @@ namespace osu.Game.Tournament.Components
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Texture = textures.Get("header-text");
}
}

View File

@ -12,19 +12,27 @@ namespace osu.Game.Tournament.Components
{
public RoundDisplay(TournamentMatch match)
{
AutoSizeAxes = Axes.Both;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DrawableTournamentHeaderText(),
new DrawableTournamentHeaderText(false)
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
},
new TournamentSpriteText
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.SemiBold)
},