2019-03-04 12:24:19 +08:00
|
|
|
// 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.
|
2018-11-10 16:26:21 +08:00
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-03-07 11:51:11 +08:00
|
|
|
using osu.Game.Tournament.Components;
|
2019-06-18 13:51:48 +08:00
|
|
|
using osu.Game.Tournament.Models;
|
2020-03-07 11:51:11 +08:00
|
|
|
using osuTK;
|
2018-11-10 16:26:21 +08:00
|
|
|
|
2018-11-15 20:28:42 +08:00
|
|
|
namespace osu.Game.Tournament.Screens.Gameplay.Components
|
2018-11-10 16:26:21 +08:00
|
|
|
{
|
|
|
|
public class MatchHeader : Container
|
|
|
|
{
|
2020-03-07 13:46:40 +08:00
|
|
|
private TeamScoreDisplay teamDisplay1;
|
|
|
|
private TeamScoreDisplay teamDisplay2;
|
2020-03-12 13:06:40 +08:00
|
|
|
private DrawableTournamentHeaderLogo logo;
|
|
|
|
|
|
|
|
private bool showScores = true;
|
2020-03-07 13:46:40 +08:00
|
|
|
|
|
|
|
public bool ShowScores
|
|
|
|
{
|
2020-03-12 13:06:40 +08:00
|
|
|
get => showScores;
|
2020-03-07 13:46:40 +08:00
|
|
|
set
|
|
|
|
{
|
2020-03-12 13:06:40 +08:00
|
|
|
if (value == showScores)
|
|
|
|
return;
|
|
|
|
|
|
|
|
showScores = value;
|
|
|
|
|
|
|
|
if (IsLoaded)
|
|
|
|
updateDisplay();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool showLogo = true;
|
|
|
|
|
|
|
|
public bool ShowLogo
|
|
|
|
{
|
|
|
|
get => showLogo;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value == showLogo)
|
|
|
|
return;
|
|
|
|
|
|
|
|
showLogo = value;
|
|
|
|
|
|
|
|
if (IsLoaded)
|
|
|
|
updateDisplay();
|
2020-03-07 13:46:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-10 16:26:21 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2019-05-18 20:37:46 +08:00
|
|
|
private void load()
|
2018-11-10 16:26:21 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-11-22 14:42:10 +08:00
|
|
|
Height = 95;
|
2018-11-10 16:26:21 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2020-03-07 11:51:11 +08:00
|
|
|
new FillFlowContainer
|
2018-11-10 16:26:21 +08:00
|
|
|
{
|
2020-03-07 11:51:11 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-03-12 13:06:40 +08:00
|
|
|
Padding = new MarginPadding(5),
|
2020-03-07 11:51:11 +08:00
|
|
|
Spacing = new Vector2(5),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2020-03-12 13:06:40 +08:00
|
|
|
logo = new DrawableTournamentHeaderLogo
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Alpha = showLogo ? 1 : 0
|
|
|
|
},
|
2020-03-12 12:29:09 +08:00
|
|
|
new DrawableTournamentHeaderText
|
2020-03-07 11:51:11 +08:00
|
|
|
{
|
2020-03-12 13:06:40 +08:00
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
2020-03-07 11:51:11 +08:00
|
|
|
},
|
2020-03-12 12:29:09 +08:00
|
|
|
new MatchRoundDisplay
|
2020-03-07 11:51:11 +08:00
|
|
|
{
|
2020-03-12 13:06:40 +08:00
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
2020-03-07 11:51:11 +08:00
|
|
|
Scale = new Vector2(0.4f)
|
|
|
|
},
|
|
|
|
}
|
2018-11-10 16:26:21 +08:00
|
|
|
},
|
2020-03-07 13:46:40 +08:00
|
|
|
teamDisplay1 = new TeamScoreDisplay(TeamColour.Red)
|
2018-11-10 16:26:21 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
},
|
2020-03-07 13:46:40 +08:00
|
|
|
teamDisplay2 = new TeamScoreDisplay(TeamColour.Blue)
|
2018-11-10 16:26:21 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
},
|
|
|
|
};
|
2020-03-07 13:46:40 +08:00
|
|
|
|
2020-03-12 13:06:40 +08:00
|
|
|
updateDisplay();
|
2020-03-06 15:07:54 +08:00
|
|
|
}
|
2018-11-10 16:26:21 +08:00
|
|
|
|
2020-03-12 13:06:40 +08:00
|
|
|
private void updateDisplay()
|
2020-03-06 15:07:54 +08:00
|
|
|
{
|
2020-03-12 13:06:40 +08:00
|
|
|
teamDisplay1.ShowScore = showScores;
|
|
|
|
teamDisplay2.ShowScore = showScores;
|
2018-11-10 16:26:21 +08:00
|
|
|
|
2020-03-12 13:06:40 +08:00
|
|
|
logo.Alpha = showLogo ? 1 : 0;
|
2018-11-10 16:26:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|