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-10-14 04:19:50 +08:00
|
|
|
|
2018-11-04 20:15:02 +08:00
|
|
|
using osu.Framework.Allocation;
|
2019-03-02 12:40:43 +08:00
|
|
|
using osu.Framework.Bindables;
|
2018-10-14 04:19:50 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-11-04 20:15:02 +08:00
|
|
|
using osu.Framework.Platform;
|
2018-10-14 04:19:50 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Tournament.Components;
|
2019-06-18 13:51:48 +08:00
|
|
|
using osu.Game.Tournament.Models;
|
2018-11-22 09:25:30 +08:00
|
|
|
using osuTK;
|
2018-10-14 04:19:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Screens.TeamIntro
|
|
|
|
{
|
2018-11-11 00:39:02 +08:00
|
|
|
public class TeamIntroScreen : TournamentScreen, IProvideVideo
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
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]
|
2019-05-20 13:48:33 +08:00
|
|
|
private void load(Storage storage)
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
2018-11-07 00:20:32 +08:00
|
|
|
InternalChildren = new Drawable[]
|
2018-11-06 19:13:04 +08:00
|
|
|
{
|
2020-03-06 17:38:29 +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);
|
2019-05-20 13:48:33 +08:00
|
|
|
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
|
|
|
|
2018-11-07 00:20:32 +08:00
|
|
|
mainContainer.Children = new Drawable[]
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
new TeamWithPlayers(match.NewValue.Team1.Value, true)
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Width = 0.5f,
|
|
|
|
Height = 0.6f,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.CentreRight
|
|
|
|
},
|
2019-06-18 13:57:05 +08:00
|
|
|
new TeamWithPlayers(match.NewValue.Team2.Value)
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Width = 0.5f,
|
|
|
|
Height = 0.6f,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.CentreLeft
|
|
|
|
},
|
2019-06-18 13:57:05 +08:00
|
|
|
new RoundDisplay(match.NewValue)
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-10-18 01:18:09 +08:00
|
|
|
Height = 0.25f,
|
2020-03-03 18:14:44 +08:00
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Y = 180,
|
2018-10-14 04:19:50 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
private class RoundDisplay : CompositeDrawable
|
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
public RoundDisplay(TournamentMatch match)
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
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[]
|
|
|
|
{
|
2020-03-03 18:14:44 +08:00
|
|
|
new TournamentSpriteText
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
2020-03-03 18:14:44 +08:00
|
|
|
Colour = OsuColour.Gray(0.33f),
|
2019-06-18 13:57:05 +08:00
|
|
|
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
|
2020-03-03 18:14:44 +08:00
|
|
|
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.Light)
|
2018-10-14 04:19:50 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class TeamWithPlayers : CompositeDrawable
|
|
|
|
{
|
|
|
|
public TeamWithPlayers(TournamentTeam team, bool left = false)
|
|
|
|
{
|
|
|
|
FillFlowContainer players;
|
2020-03-03 18:14:44 +08:00
|
|
|
var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
|
2018-10-14 04:19:50 +08:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2020-03-03 18:14:44 +08:00
|
|
|
new TeamDisplay(team)
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
|
|
|
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
2020-03-03 18:14:44 +08:00
|
|
|
Origin = Anchor.TopCentre,
|
2018-10-18 01:18:09 +08:00
|
|
|
RelativePositionAxes = Axes.Both,
|
2020-03-03 18:14:44 +08:00
|
|
|
X = (left ? -1 : 1) * 0.3145f,
|
|
|
|
Y = -0.077f,
|
2018-10-14 04:19:50 +08:00
|
|
|
},
|
|
|
|
players = new FillFlowContainer
|
|
|
|
{
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Spacing = new Vector2(0, 5),
|
|
|
|
Padding = new MarginPadding(20),
|
2018-11-22 15:23:44 +08:00
|
|
|
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
|
|
|
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
2018-10-14 04:19:50 +08:00
|
|
|
RelativePositionAxes = Axes.Both,
|
2020-03-03 18:14:44 +08:00
|
|
|
X = (left ? -1 : 1) * 0.58f,
|
2018-10-14 04:19:50 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-10-25 00:29:08 +08:00
|
|
|
if (team != null)
|
|
|
|
{
|
|
|
|
foreach (var p in team.Players)
|
2019-11-11 19:53:22 +08:00
|
|
|
{
|
2020-03-03 18:14:44 +08:00
|
|
|
players.Add(new TournamentSpriteText
|
2018-10-25 00:29:08 +08:00
|
|
|
{
|
|
|
|
Text = p.Username,
|
2020-03-03 18:14:44 +08:00
|
|
|
Font = OsuFont.Torus.With(size: 24),
|
2018-10-25 00:29:08 +08:00
|
|
|
Colour = colour,
|
|
|
|
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
|
|
|
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
|
|
|
|
});
|
2019-11-11 19:53:22 +08:00
|
|
|
}
|
2018-10-25 00:29:08 +08:00
|
|
|
}
|
2018-10-14 04:19:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private class TeamDisplay : DrawableTournamentTeam
|
|
|
|
{
|
2020-03-03 18:14:44 +08:00
|
|
|
public TeamDisplay(TournamentTeam team)
|
2018-10-14 04:19:50 +08:00
|
|
|
: base(team)
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
Flag.Anchor = Flag.Origin = Anchor.TopCentre;
|
|
|
|
Flag.RelativeSizeAxes = Axes.None;
|
|
|
|
Flag.Size = new Vector2(300, 200);
|
2020-03-03 18:14:44 +08:00
|
|
|
Flag.Scale = new Vector2(0.32f);
|
2018-10-14 04:19:50 +08:00
|
|
|
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-03-03 18:14:44 +08:00
|
|
|
Spacing = new Vector2(160),
|
2018-10-14 04:19:50 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
Flag,
|
2020-03-03 18:14:44 +08:00
|
|
|
new TournamentSpriteText
|
2018-10-14 04:19:50 +08:00
|
|
|
{
|
2020-03-03 18:14:44 +08:00
|
|
|
Text = team?.FullName.Value ?? "???",
|
2020-03-03 17:04:12 +08:00
|
|
|
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.Regular),
|
2020-03-03 18:14:44 +08:00
|
|
|
Colour = OsuColour.Gray(0.2f),
|
2018-10-14 04:19:50 +08:00
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Anchor = Anchor.TopCentre,
|
2020-03-03 18:14:44 +08:00
|
|
|
},
|
2018-10-14 04:19:50 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|