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

Update match score display

This commit is contained in:
Dean Herbert 2020-03-07 16:22:52 +09:00
parent 3807c449bd
commit 9bd837da41
4 changed files with 37 additions and 25 deletions

View File

@ -21,6 +21,7 @@ namespace osu.Game.Tournament.Tests.Screens
typeof(TeamScoreDisplay),
typeof(TeamDisplay),
typeof(MatchHeader),
typeof(MatchScoreDisplay),
};
[BackgroundDependencyLoader]

View File

@ -11,16 +11,12 @@ using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay.Components
{
public class MatchScoreDisplay : CompositeDrawable
{
private readonly Color4 red = new Color4(186, 0, 18, 255);
private readonly Color4 blue = new Color4(17, 136, 170, 255);
private const float bar_height = 20;
private const float bar_height = 18;
private readonly BindableInt score1 = new BindableInt();
private readonly BindableInt score2 = new BindableInt();
@ -28,45 +24,63 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private readonly MatchScoreCounter score1Text;
private readonly MatchScoreCounter score2Text;
private readonly Circle score1Bar;
private readonly Circle score2Bar;
private readonly Drawable score1Bar;
private readonly Drawable score2Bar;
public MatchScoreDisplay()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
InternalChildren = new[]
{
score1Bar = new Circle
new Box
{
Name = "top bar red (static)",
RelativeSizeAxes = Axes.X,
Height = bar_height / 4,
Width = 0.5f,
Colour = TournamentGame.COLOUR_RED,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight
},
new Box
{
Name = "top bar blue (static)",
RelativeSizeAxes = Axes.X,
Height = bar_height / 4,
Width = 0.5f,
Colour = TournamentGame.COLOUR_BLUE,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft
},
score1Bar = new Box
{
Name = "top bar red",
RelativeSizeAxes = Axes.X,
Height = bar_height,
Width = 0,
Colour = red,
Colour = TournamentGame.COLOUR_RED,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight
},
score1Text = new MatchScoreCounter
{
Colour = red,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
},
score2Bar = new Circle
score2Bar = new Box
{
Name = "top bar blue",
RelativeSizeAxes = Axes.X,
Height = bar_height,
Width = 0,
Colour = blue,
Colour = TournamentGame.COLOUR_BLUE,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft
},
score2Text = new MatchScoreCounter
{
Colour = blue,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
},
@ -103,10 +117,9 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint);
}
protected override void Update()
protected override void UpdateAfterChildren()
{
base.Update();
base.UpdateAfterChildren();
score1Text.X = -Math.Max(5 + score1Text.DrawWidth / 2, score1Bar.DrawWidth);
score2Text.X = Math.Max(5 + score2Text.DrawWidth / 2, score2Bar.DrawWidth);
}
@ -115,7 +128,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{
public MatchScoreCounter()
{
Margin = new MarginPadding { Top = bar_height + 5, Horizontal = 10 };
Margin = new MarginPadding { Top = bar_height, Horizontal = 10 };
Winning = false;
}
@ -123,8 +136,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
public bool Winning
{
set => DisplayedCountSpriteText.Font = value
? OsuFont.Torus.With(weight: FontWeight.Regular, size: 60)
: OsuFont.Torus.With(weight: FontWeight.Light, size: 40);
? OsuFont.Torus.With(weight: FontWeight.Bold, size: 50)
: OsuFont.Torus.With(weight: FontWeight.Regular, size: 40);
}
}
}

View File

@ -50,7 +50,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
public class LightSquare : Star
{
private Box box;
private readonly Box box;
public LightSquare()
{

View File

@ -15,7 +15,6 @@ using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Gameplay.Components;
using osu.Game.Tournament.Screens.MapPool;
using osu.Game.Tournament.Screens.TeamWin;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay
@ -72,10 +71,9 @@ namespace osu.Game.Tournament.Screens.Gameplay
},
scoreDisplay = new MatchScoreDisplay
{
Y = -60,
Scale = new Vector2(0.8f),
Y = -147,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
},
new ControlPanel
{