mirror of
https://github.com/osukey/osukey.git
synced 2025-05-20 21:17:32 +09:00
Merge pull request #15627 from peppy/playlist-item-iruleset
Update `PlaylistItem` to use `IRulesetInfo`
This commit is contained in:
commit
96dddc8a0b
@ -10,6 +10,7 @@ using Newtonsoft.Json.Converters;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -62,7 +63,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public MultiplayerScoresAround ScoresAround { get; set; }
|
public MultiplayerScoresAround ScoresAround { get; set; }
|
||||||
|
|
||||||
public ScoreInfo CreateScoreInfo(PlaylistItem playlistItem, [NotNull] BeatmapInfo beatmap)
|
public ScoreInfo CreateScoreInfo(RulesetStore rulesets, PlaylistItem playlistItem, [NotNull] BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
var rulesetInstance = playlistItem.Ruleset.Value.CreateInstance();
|
var rulesetInstance = playlistItem.Ruleset.Value.CreateInstance();
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
MaxCombo = MaxCombo,
|
MaxCombo = MaxCombo,
|
||||||
BeatmapInfo = beatmap,
|
BeatmapInfo = beatmap,
|
||||||
BeatmapInfoID = playlistItem.BeatmapID,
|
BeatmapInfoID = playlistItem.BeatmapID,
|
||||||
Ruleset = playlistItem.Ruleset.Value,
|
Ruleset = rulesets.GetRuleset(playlistItem.RulesetID),
|
||||||
RulesetID = playlistItem.RulesetID,
|
RulesetID = playlistItem.RulesetID,
|
||||||
Statistics = Statistics,
|
Statistics = Statistics,
|
||||||
User = User,
|
User = User,
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
|
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
public readonly Bindable<IRulesetInfo> Ruleset = new Bindable<IRulesetInfo>();
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public readonly BindableList<Mod> AllowedMods = new BindableList<Mod>();
|
public readonly BindableList<Mod> AllowedMods = new BindableList<Mod>();
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
public PlaylistItem()
|
public PlaylistItem()
|
||||||
{
|
{
|
||||||
Beatmap.BindValueChanged(beatmap => BeatmapID = beatmap.NewValue?.OnlineID ?? -1);
|
Beatmap.BindValueChanged(beatmap => BeatmapID = beatmap.NewValue?.OnlineID ?? -1);
|
||||||
Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.ID ?? 0);
|
Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.OnlineID ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MapObjects(RulesetStore rulesets)
|
public void MapObjects(RulesetStore rulesets)
|
||||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private ModDisplay modDisplay;
|
private ModDisplay modDisplay;
|
||||||
|
|
||||||
private readonly Bindable<IBeatmapInfo> beatmap = new Bindable<IBeatmapInfo>();
|
private readonly Bindable<IBeatmapInfo> beatmap = new Bindable<IBeatmapInfo>();
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<IRulesetInfo> ruleset = new Bindable<IRulesetInfo>();
|
||||||
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
|
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
|
||||||
|
|
||||||
public readonly PlaylistItem Item;
|
public readonly PlaylistItem Item;
|
||||||
|
@ -18,6 +18,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
|
|
||||||
@ -59,6 +60,9 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
protected OnlinePlayScreen ParentScreen { get; private set; }
|
protected OnlinePlayScreen ParentScreen { get; private set; }
|
||||||
|
|
||||||
@ -344,7 +348,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
|
|
||||||
UpdateMods();
|
UpdateMods();
|
||||||
|
|
||||||
Ruleset.Value = selected.Ruleset.Value;
|
Ruleset.Value = rulesets.GetRuleset(selected.RulesetID);
|
||||||
|
|
||||||
if (!selected.AllowedMods.Any())
|
if (!selected.AllowedMods.Any())
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
|
|
||||||
@ -35,6 +36,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreManager scoreManager { get; set; }
|
private ScoreManager scoreManager { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
public PlaylistsResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, bool allowRetry, bool allowWatchingReplay = true)
|
public PlaylistsResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, bool allowRetry, bool allowWatchingReplay = true)
|
||||||
: base(score, allowRetry, allowWatchingReplay)
|
: base(score, allowRetry, allowWatchingReplay)
|
||||||
{
|
{
|
||||||
@ -169,7 +173,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
/// <param name="pivot">An optional pivot around which the scores were retrieved.</param>
|
/// <param name="pivot">An optional pivot around which the scores were retrieved.</param>
|
||||||
private void performSuccessCallback([NotNull] Action<IEnumerable<ScoreInfo>> callback, [NotNull] List<MultiplayerScore> scores, [CanBeNull] MultiplayerScores pivot = null)
|
private void performSuccessCallback([NotNull] Action<IEnumerable<ScoreInfo>> callback, [NotNull] List<MultiplayerScore> scores, [CanBeNull] MultiplayerScores pivot = null)
|
||||||
{
|
{
|
||||||
var scoreInfos = scores.Select(s => s.CreateScoreInfo(playlistItem, Beatmap.Value.BeatmapInfo)).ToArray();
|
var scoreInfos = scores.Select(s => s.CreateScoreInfo(rulesets, playlistItem, Beatmap.Value.BeatmapInfo)).ToArray();
|
||||||
|
|
||||||
// Score panels calculate total score before displaying, which can take some time. In order to count that calculation as part of the loading spinner display duration,
|
// Score panels calculate total score before displaying, which can take some time. In order to count that calculation as part of the loading spinner display duration,
|
||||||
// calculate the total scores locally before invoking the success callback.
|
// calculate the total scores locally before invoking the success callback.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user