1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:53:22 +08:00
osu-lazer/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs

81 lines
2.5 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-04 20:15:02 +08:00
using osu.Framework.Allocation;
2019-03-02 12:40:43 +08:00
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2018-11-04 20:15:02 +08:00
using osu.Framework.Platform;
using osu.Game.Tournament.Components;
2019-06-18 13:51:48 +08:00
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Screens.TeamIntro
{
public class TeamIntroScreen : TournamentScreen, IProvideVideo
{
2018-11-07 00:20:32 +08:00
private Container mainContainer;
2018-11-04 20:15:02 +08:00
2019-06-18 13:57:05 +08:00
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
2018-11-04 20:15:02 +08:00
[BackgroundDependencyLoader]
private void load(Storage storage)
{
RelativeSizeAxes = Axes.Both;
2018-11-07 00:20:32 +08:00
InternalChildren = new Drawable[]
2018-11-06 19:13:04 +08:00
{
new TourneyVideo("teamintro")
2018-11-07 00:20:32 +08:00
{
RelativeSizeAxes = Axes.Both,
Loop = true,
},
mainContainer = new Container
{
RelativeSizeAxes = Axes.Both,
}
2018-11-06 19:13:04 +08:00
};
2018-11-08 15:55:55 +08:00
currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(LadderInfo.CurrentMatch);
2018-11-06 19:13:04 +08:00
}
2019-06-18 13:57:05 +08:00
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
2018-11-06 19:13:04 +08:00
{
2019-06-18 13:57:05 +08:00
if (match.NewValue == null)
2018-11-07 00:20:32 +08:00
{
mainContainer.Clear();
2018-11-06 19:13:04 +08:00
return;
2018-11-07 00:20:32 +08:00
}
2018-11-06 19:13:04 +08:00
const float y_flag_offset = 292;
const float y_offset = 460;
2018-11-07 00:20:32 +08:00
mainContainer.Children = new Drawable[]
{
new RoundDisplay(match.NewValue)
{
Position = new Vector2(100, 100)
},
new DrawableTeamFlag(match.NewValue.Team1.Value)
{
Position = new Vector2(165, y_flag_offset),
},
new DrawableTeamWithPlayers(match.NewValue.Team1.Value, TeamColour.Red)
{
Position = new Vector2(165, y_offset),
},
new DrawableTeamFlag(match.NewValue.Team2.Value)
{
Position = new Vector2(740, y_flag_offset),
},
new DrawableTeamWithPlayers(match.NewValue.Team2.Value, TeamColour.Blue)
{
Position = new Vector2(740, y_offset),
},
};
}
}
}