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