Update PlaylistItem to use IRulesetInfo

This commit is contained in:
Dean Herbert
2021-11-15 16:13:03 +09:00
parent 1988b263c6
commit 5489b19c57
5 changed files with 16 additions and 7 deletions

View File

@ -10,6 +10,7 @@ using Newtonsoft.Json.Converters;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
@ -62,7 +63,7 @@ namespace osu.Game.Online.Rooms
[CanBeNull]
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();
@ -73,7 +74,7 @@ namespace osu.Game.Online.Rooms
MaxCombo = MaxCombo,
BeatmapInfo = beatmap,
BeatmapInfoID = playlistItem.BeatmapID,
Ruleset = playlistItem.Ruleset.Value,
Ruleset = rulesets.GetRuleset(playlistItem.RulesetID),
RulesetID = playlistItem.RulesetID,
Statistics = Statistics,
User = User,

View File

@ -34,7 +34,7 @@ namespace osu.Game.Online.Rooms
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
[JsonIgnore]
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
public readonly Bindable<IRulesetInfo> Ruleset = new Bindable<IRulesetInfo>();
[JsonIgnore]
public readonly BindableList<Mod> AllowedMods = new BindableList<Mod>();
@ -66,7 +66,7 @@ namespace osu.Game.Online.Rooms
public PlaylistItem()
{
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)