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.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Tournament.Components;
|
|
|
|
using osu.Game.Tournament.Screens.Ladder.Components;
|
2018-11-11 00:16:46 +00:00
|
|
|
using osu.Game.Tournament.Screens.Showcase;
|
2018-11-22 01:25:30 +00:00
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
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
|
|
|
|
2018-11-08 07:55:55 +00:00
|
|
|
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
|
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
|
|
|
{
|
2019-06-17 12:07:30 +00:00
|
|
|
new TourneyVideo(storage.GetStream(@"BG Team - Both OWC.m4v"))
|
2018-11-06 16:20:32 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Loop = true,
|
|
|
|
},
|
2018-11-11 00:16:46 +00:00
|
|
|
new TournamentLogo(),
|
2018-11-06 16:20:32 +00:00
|
|
|
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-03-02 04:40:43 +00:00
|
|
|
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
2018-11-06 11:13:04 +00:00
|
|
|
{
|
2019-03-02 04:40:43 +00:00
|
|
|
if (pairing.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
|
|
|
|
2018-11-06 16:20:32 +00:00
|
|
|
mainContainer.Children = new Drawable[]
|
2018-10-13 20:19:50 +00:00
|
|
|
{
|
2019-03-02 04:40:43 +00:00
|
|
|
new TeamWithPlayers(pairing.NewValue.Team1.Value, true)
|
2018-10-13 20:19:50 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Width = 0.5f,
|
|
|
|
Height = 0.6f,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.CentreRight
|
|
|
|
},
|
2019-03-02 04:40:43 +00:00
|
|
|
new TeamWithPlayers(pairing.NewValue.Team2.Value)
|
2018-10-13 20:19:50 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Width = 0.5f,
|
|
|
|
Height = 0.6f,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.CentreLeft
|
|
|
|
},
|
2019-03-02 04:40:43 +00:00
|
|
|
new RoundDisplay(pairing.NewValue)
|
2018-10-13 20:19:50 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-10-17 17:18:09 +00:00
|
|
|
Height = 0.25f,
|
2018-10-13 20:19:50 +00:00
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
private class RoundDisplay : CompositeDrawable
|
|
|
|
{
|
2018-11-11 00:05:36 +00:00
|
|
|
public RoundDisplay(MatchPairing pairing)
|
2018-10-13 20:19:50 +00:00
|
|
|
{
|
|
|
|
var col = OsuColour.Gray(0.33f);
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 10),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Colour = col,
|
|
|
|
Text = "COMING UP NEXT",
|
2018-11-22 07:23:44 +00:00
|
|
|
Spacing = new Vector2(2, 0),
|
2019-03-04 03:06:41 +00:00
|
|
|
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Black)
|
2018-10-13 20:19:50 +00:00
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Colour = col,
|
2019-06-18 05:44:15 +00:00
|
|
|
Text = pairing.Round.Value?.Name.Value ?? "Unknown Round",
|
2018-10-13 20:19:50 +00:00
|
|
|
Spacing = new Vector2(10, 0),
|
2019-03-04 03:06:41 +00:00
|
|
|
Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light)
|
2018-10-13 20:19:50 +00:00
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Colour = col,
|
2018-11-11 00:05:36 +00:00
|
|
|
Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
|
2019-03-04 03:06:41 +00:00
|
|
|
Font = OsuFont.GetFont(size: 20)
|
2018-10-13 20:19:50 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class TeamWithPlayers : CompositeDrawable
|
|
|
|
{
|
|
|
|
private readonly Color4 red = new Color4(129, 68, 65, 255);
|
|
|
|
private readonly Color4 blue = new Color4(41, 91, 97, 255);
|
|
|
|
|
|
|
|
public TeamWithPlayers(TournamentTeam team, bool left = false)
|
|
|
|
{
|
|
|
|
FillFlowContainer players;
|
|
|
|
var colour = left ? red : blue;
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new TeamDisplay(team, left ? "Team Red" : "Team Blue", colour)
|
|
|
|
{
|
|
|
|
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
2018-10-17 17:18:09 +00:00
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativePositionAxes = Axes.Both,
|
|
|
|
X = (left ? -1 : 1) * 0.36f,
|
2018-10-13 20:19:50 +00:00
|
|
|
},
|
|
|
|
players = new FillFlowContainer
|
|
|
|
{
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Spacing = new Vector2(0, 5),
|
|
|
|
Padding = new MarginPadding(20),
|
2018-11-22 07:23:44 +00:00
|
|
|
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
|
|
|
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
2018-10-13 20:19:50 +00:00
|
|
|
RelativePositionAxes = Axes.Both,
|
2018-11-22 07:23:44 +00:00
|
|
|
X = (left ? -1 : 1) * 0.66f,
|
2018-10-13 20:19:50 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-10-24 16:29:08 +00:00
|
|
|
if (team != null)
|
|
|
|
{
|
|
|
|
foreach (var p in team.Players)
|
|
|
|
players.Add(new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = p.Username,
|
2019-03-04 03:06:41 +00:00
|
|
|
Font = OsuFont.GetFont(size: 24),
|
2018-10-24 16:29:08 +00:00
|
|
|
Colour = colour,
|
|
|
|
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
|
|
|
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
|
|
|
});
|
|
|
|
}
|
2018-10-13 20:19:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private class TeamDisplay : DrawableTournamentTeam
|
|
|
|
{
|
|
|
|
public TeamDisplay(TournamentTeam team, string teamName, Color4 colour)
|
|
|
|
: base(team)
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
Flag.Anchor = Flag.Origin = Anchor.TopCentre;
|
|
|
|
Flag.RelativeSizeAxes = Axes.None;
|
|
|
|
Flag.Size = new Vector2(300, 200);
|
|
|
|
Flag.Scale = new Vector2(0.4f);
|
|
|
|
Flag.Margin = new MarginPadding { Bottom = 20 };
|
|
|
|
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 5),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
Flag,
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
2019-06-17 07:28:58 +00:00
|
|
|
Text = team?.FullName.Value.ToUpper() ?? "???",
|
2019-06-13 10:41:01 +00:00
|
|
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light),
|
2018-10-13 20:19:50 +00:00
|
|
|
Colour = Color4.Black,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = teamName.ToUpper(),
|
2019-06-13 10:41:01 +00:00
|
|
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Regular),
|
2018-10-13 20:19:50 +00:00
|
|
|
Colour = colour,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|