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-11-11 01:39:04 +00:00
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2018-11-11 01:39:04 +00:00
|
|
|
using osu.Framework.Allocation;
|
2019-03-02 04:40:43 +00:00
|
|
|
using osu.Framework.Bindables;
|
2018-11-11 01:39:04 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
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-11-11 01:39:04 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Screens.TeamWin
|
|
|
|
{
|
2022-07-11 11:42:04 +00:00
|
|
|
public class TeamWinScreen : TournamentMatchScreen
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
|
|
|
private Container mainContainer;
|
|
|
|
|
|
|
|
private readonly Bindable<bool> currentCompleted = new Bindable<bool>();
|
|
|
|
|
2019-06-17 12:07:30 +00:00
|
|
|
private TourneyVideo blueWinVideo;
|
|
|
|
private TourneyVideo redWinVideo;
|
2018-11-11 01:39:04 +00:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-01-15 00:06:39 +00:00
|
|
|
private void load()
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2020-03-06 09:38:29 +00:00
|
|
|
blueWinVideo = new TourneyVideo("teamwin-blue")
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
|
|
|
Alpha = 1,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Loop = true,
|
|
|
|
},
|
2020-03-06 09:38:29 +00:00
|
|
|
redWinVideo = new TourneyVideo("teamwin-red")
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
|
|
|
Alpha = 0,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Loop = true,
|
|
|
|
},
|
|
|
|
mainContainer = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
currentCompleted.BindValueChanged(_ => update());
|
|
|
|
}
|
|
|
|
|
2021-07-16 15:14:48 +00:00
|
|
|
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
2021-07-16 15:14:48 +00:00
|
|
|
base.CurrentMatchChanged(match);
|
|
|
|
|
2018-11-11 01:39:04 +00:00
|
|
|
currentCompleted.UnbindBindings();
|
|
|
|
|
2021-07-16 15:14:48 +00:00
|
|
|
if (match.NewValue == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
currentCompleted.BindTo(match.NewValue.Completed);
|
2018-11-11 01:39:04 +00:00
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2020-03-08 05:23:13 +00:00
|
|
|
private bool firstDisplay = true;
|
|
|
|
|
2022-07-13 08:57:45 +00:00
|
|
|
private void update() => Scheduler.AddOnce(() =>
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
2021-07-16 15:14:48 +00:00
|
|
|
var match = CurrentMatch.Value;
|
2018-11-11 01:39:04 +00:00
|
|
|
|
2019-06-18 05:57:05 +00:00
|
|
|
if (match.Winner == null)
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
|
|
|
mainContainer.Clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-06 07:08:05 +00:00
|
|
|
redWinVideo.Alpha = match.WinnerColour == TeamColour.Red ? 1 : 0;
|
|
|
|
blueWinVideo.Alpha = match.WinnerColour == TeamColour.Blue ? 1 : 0;
|
2018-11-11 01:39:04 +00:00
|
|
|
|
2020-03-08 05:23:13 +00:00
|
|
|
if (firstDisplay)
|
|
|
|
{
|
|
|
|
if (match.WinnerColour == TeamColour.Red)
|
|
|
|
redWinVideo.Reset();
|
|
|
|
else
|
|
|
|
blueWinVideo.Reset();
|
|
|
|
firstDisplay = false;
|
|
|
|
}
|
|
|
|
|
2018-11-11 01:39:04 +00:00
|
|
|
mainContainer.Children = new Drawable[]
|
|
|
|
{
|
2020-03-06 07:08:05 +00:00
|
|
|
new DrawableTeamFlag(match.Winner)
|
2020-03-03 10:14:44 +00:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2020-03-06 07:08:05 +00:00
|
|
|
Position = new Vector2(-300, 10),
|
2020-10-23 12:11:29 +00:00
|
|
|
Scale = new Vector2(2f)
|
2020-03-03 10:14:44 +00:00
|
|
|
},
|
2020-03-06 07:08:05 +00:00
|
|
|
new FillFlowContainer
|
2020-03-03 10:14:44 +00:00
|
|
|
{
|
2020-03-06 07:08:05 +00:00
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-03-03 10:14:44 +00:00
|
|
|
Anchor = Anchor.Centre,
|
2020-03-06 07:08:05 +00:00
|
|
|
Origin = Anchor.Centre,
|
|
|
|
X = 260,
|
|
|
|
Children = new Drawable[]
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
2020-03-06 07:08:05 +00:00
|
|
|
new RoundDisplay(match)
|
2018-11-11 01:39:04 +00:00
|
|
|
{
|
2020-03-06 07:08:05 +00:00
|
|
|
Margin = new MarginPadding { Bottom = 30 },
|
|
|
|
},
|
|
|
|
new TournamentSpriteText
|
2020-03-03 10:14:44 +00:00
|
|
|
{
|
2020-03-06 07:08:05 +00:00
|
|
|
Text = "WINNER",
|
|
|
|
Font = OsuFont.Torus.With(size: 100, weight: FontWeight.Bold),
|
|
|
|
Margin = new MarginPadding { Bottom = 50 },
|
|
|
|
},
|
|
|
|
new DrawableTeamWithPlayers(match.Winner, match.WinnerColour)
|
2020-03-03 10:14:44 +00:00
|
|
|
}
|
2020-03-06 07:08:05 +00:00
|
|
|
},
|
|
|
|
};
|
2020-03-08 05:23:13 +00:00
|
|
|
mainContainer.FadeOut();
|
|
|
|
mainContainer.Delay(2000).FadeIn(1600, Easing.OutQuint);
|
|
|
|
});
|
2018-11-11 01:39:04 +00:00
|
|
|
}
|
|
|
|
}
|