1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 14:02:54 +08:00
osu-lazer/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

117 lines
3.3 KiB
C#
Raw Normal View History

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
2022-06-17 15:37:17 +08:00
#nullable disable
2018-11-10 16:26:21 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Tournament.Components;
2019-06-18 13:51:48 +08:00
using osu.Game.Tournament.Models;
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;
private DrawableTournamentHeaderLogo logo;
private bool showScores = true;
2020-03-07 13:46:40 +08:00
public bool ShowScores
{
get => showScores;
2020-03-07 13:46:40 +08:00
set
{
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;
Height = 95;
2018-11-10 16:26:21 +08:00
Children = new Drawable[]
{
new FillFlowContainer
2018-11-10 16:26:21 +08:00
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Padding = new MarginPadding(20),
Spacing = new Vector2(5),
Children = new Drawable[]
{
logo = new DrawableTournamentHeaderLogo
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Alpha = showLogo ? 1 : 0
},
2020-03-12 12:29:09 +08:00
new DrawableTournamentHeaderText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
2020-03-12 12:29:09 +08:00
new MatchRoundDisplay
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
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
protected override void LoadComplete()
{
base.LoadComplete();
updateDisplay();
}
2018-11-10 16:26:21 +08:00
private void updateDisplay()
{
teamDisplay1.ShowScore = showScores;
teamDisplay2.ShowScore = showScores;
2018-11-10 16:26:21 +08:00
logo.Alpha = showLogo ? 1 : 0;
2018-11-10 16:26:21 +08:00
}
}
}