mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Implement the new results screen
This commit is contained in:
@ -14,9 +14,7 @@ using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Multi.Ranking;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Play
|
||||
{
|
||||
@ -115,7 +113,5 @@ namespace osu.Game.Screens.Multi.Play
|
||||
|
||||
Exited = null;
|
||||
}
|
||||
|
||||
protected override Results CreateResults(ScoreInfo score) => new MatchResults(score);
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Multi.Ranking.Types;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Ranking.Types;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Ranking
|
||||
{
|
||||
public class MatchResults : Results
|
||||
{
|
||||
public MatchResults(ScoreInfo score)
|
||||
: base(score)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new IResultPageInfo[]
|
||||
{
|
||||
new ScoreOverviewPageInfo(Score, Beatmap.Value),
|
||||
new LocalLeaderboardPageInfo(Score, Beatmap.Value),
|
||||
new RoomLeaderboardPageInfo(Score, Beatmap.Value),
|
||||
};
|
||||
}
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Lists;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Multi.Match.Components;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Ranking.Pages
|
||||
{
|
||||
public class RoomLeaderboardPage : ResultsPage
|
||||
{
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private TextFlowContainer rankText;
|
||||
|
||||
[Resolved(typeof(Room), nameof(Room.Name))]
|
||||
private Bindable<string> name { get; set; }
|
||||
|
||||
public RoomLeaderboardPage(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
: base(score, beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
MatchLeaderboard leaderboard;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colours.Gray6,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new BufferedContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BackgroundColour = colours.Gray6,
|
||||
Child = leaderboard = CreateLeaderboard()
|
||||
},
|
||||
rankText = new TextFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Y = 50,
|
||||
TextAnchor = Anchor.TopCentre
|
||||
},
|
||||
};
|
||||
|
||||
leaderboard.Origin = Anchor.Centre;
|
||||
leaderboard.Anchor = Anchor.Centre;
|
||||
leaderboard.RelativeSizeAxes = Axes.Both;
|
||||
leaderboard.Height = 0.8f;
|
||||
leaderboard.Y = 55;
|
||||
leaderboard.ScoresLoaded = scoresLoaded;
|
||||
}
|
||||
|
||||
private void scoresLoaded(IEnumerable<APIUserScoreAggregate> scores)
|
||||
{
|
||||
void gray(SpriteText s) => s.Colour = colours.GrayC;
|
||||
|
||||
void white(SpriteText s)
|
||||
{
|
||||
s.Font = s.Font.With(size: s.Font.Size * 1.4f);
|
||||
s.Colour = colours.GrayF;
|
||||
}
|
||||
|
||||
rankText.AddText(name + "\n", white);
|
||||
rankText.AddText("You are placed ", gray);
|
||||
|
||||
int index = scores.IndexOf(new APIUserScoreAggregate { User = Score.User }, new FuncEqualityComparer<APIUserScoreAggregate>((s1, s2) => s1.User.Id.Equals(s2.User.Id)));
|
||||
|
||||
rankText.AddText($"#{index + 1} ", s =>
|
||||
{
|
||||
s.Font = s.Font.With(Typeface.Torus, weight: FontWeight.Bold);
|
||||
s.Colour = colours.YellowDark;
|
||||
});
|
||||
|
||||
rankText.AddText("in the room!", gray);
|
||||
}
|
||||
|
||||
protected virtual MatchLeaderboard CreateLeaderboard() => new ResultsMatchLeaderboard();
|
||||
|
||||
public class ResultsMatchLeaderboard : MatchLeaderboard
|
||||
{
|
||||
protected override bool FadeTop => true;
|
||||
|
||||
protected override LeaderboardScore CreateDrawableScore(APIUserScoreAggregate model, int index)
|
||||
=> new ResultsMatchLeaderboardScore(model, index);
|
||||
|
||||
protected override FillFlowContainer<LeaderboardScore> CreateScoreFlow()
|
||||
{
|
||||
var flow = base.CreateScoreFlow();
|
||||
flow.Padding = new MarginPadding
|
||||
{
|
||||
Top = LeaderboardScore.HEIGHT * 2,
|
||||
Bottom = LeaderboardScore.HEIGHT * 3,
|
||||
};
|
||||
return flow;
|
||||
}
|
||||
|
||||
private class ResultsMatchLeaderboardScore : MatchLeaderboardScore
|
||||
{
|
||||
public ResultsMatchLeaderboardScore(APIUserScoreAggregate score, int rank)
|
||||
: base(score, rank)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Multi.Ranking.Pages;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Ranking.Types
|
||||
{
|
||||
public class RoomLeaderboardPageInfo : IResultPageInfo
|
||||
{
|
||||
private readonly ScoreInfo score;
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
|
||||
public RoomLeaderboardPageInfo(ScoreInfo score, WorkingBeatmap beatmap)
|
||||
{
|
||||
this.score = score;
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
public IconUsage Icon => FontAwesome.Solid.Users;
|
||||
|
||||
public string Name => "Room Leaderboard";
|
||||
|
||||
public virtual ResultsPage CreatePage() => new RoomLeaderboardPage(score, beatmap);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user