diff --git a/osu.Game/Localisation/MultiplayerResultsScreenStrings.cs b/osu.Game/Localisation/MultiplayerResultsScreenStrings.cs new file mode 100644 index 0000000000..e586faba66 --- /dev/null +++ b/osu.Game/Localisation/MultiplayerResultsScreenStrings.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class MultiplayerResultsScreenStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.MultiplayerResultsScreen"; + + /// + /// "Team {0} wins!" + /// + public static LocalisableString TeamWins(string winner) => new TranslatableString(getKey(@"team_wins"), @"Team {0} wins!", winner); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs index 66de572b77..61bc66de45 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs @@ -5,10 +5,18 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Online.Rooms; using osu.Game.Scoring; using osu.Game.Screens.OnlinePlay.Playlists; using osu.Game.Screens.Play.HUD; +using osu.Game.Localisation; +using osuTK.Graphics; namespace osu.Game.Screens.OnlinePlay.Multiplayer { @@ -16,22 +24,78 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { private readonly SortedDictionary teamScores; + private Drawable winnerText; + public MultiplayerResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary teamScores) : base(score, roomId, playlistItem, false, false) { this.teamScores = teamScores; } + [Resolved] + private OsuColour colours { get; set; } + [BackgroundDependencyLoader] private void load() { if (teamScores.Count == 2) { - LoadComponentAsync(new MatchScoreDisplay + var redScore = teamScores.First().Value; + var blueScore = teamScores.Last().Value; + + // eventually this will be replaced by team names coming from the multiplayer match state. + string winner = redScore.Value > blueScore.Value ? @"Red" : @"Blue"; + + var winnerColour = redScore.Value > blueScore.Value ? colours.TeamColourRed : colours.TeamColourBlue; + + AddRangeInternal(new Drawable[] { - Team1Score = { BindTarget = teamScores.First().Value }, - Team2Score = { BindTarget = teamScores.Last().Value }, - }, AddInternal); + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new MatchScoreDisplay + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Team1Score = { BindTarget = redScore }, + Team2Score = { BindTarget = blueScore }, + }, + (winnerText = new OsuSpriteText + { + Alpha = 0, + Font = OsuFont.Torus.With(size: 40, weight: FontWeight.Bold), + Text = MultiplayerResultsScreenStrings.TeamWins(winner) + }).WithEffect(new GlowEffect + { + Colour = winnerColour, + }).With(e => + { + e.Anchor = Anchor.TopCentre; + e.Origin = Anchor.TopCentre; + }) + } + }, + }); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + using (BeginDelayedSequence(300)) + { + winnerText.FadeInFromZero(600, Easing.InQuint); + + winnerText + .ScaleTo(10) + .ScaleTo(1, 600, Easing.InQuad) + .Then() + .ScaleTo(1.02f, 1600, Easing.OutQuint); } } }