1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-26 11:33:21 +08:00
osu-lazer/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs
Dean Herbert 73e924479f Find video by recursive check rather than marker interface
Seems a lot more reliable, and allows falling back to the "main" video
in cases which didn't support this previously.

A next step may be to allow every screen to support a video based on its
screen name, rather than specifying the local `TourneyVideo` every time.
2022-07-11 20:42:05 +09:00

78 lines
2.3 KiB
C#

// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Screens.TeamIntro
{
public class TeamIntroScreen : TournamentMatchScreen
{
private Container mainContainer;
[BackgroundDependencyLoader]
private void load()
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new TourneyVideo("teamintro")
{
RelativeSizeAxes = Axes.Both,
Loop = true,
},
mainContainer = new Container
{
RelativeSizeAxes = Axes.Both,
}
};
}
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
{
base.CurrentMatchChanged(match);
mainContainer.Clear();
if (match.NewValue == null)
return;
const float y_flag_offset = 292;
const float y_offset = 460;
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),
},
};
}
}
}