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