mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Add ruleset to state
This commit is contained in:
parent
4fca7675b0
commit
e20a986401
@ -14,18 +14,13 @@ namespace osu.Game.Online.Spectator
|
||||
{
|
||||
public int? BeatmapID { get; set; }
|
||||
|
||||
public int? RulesetID { get; set; }
|
||||
|
||||
[NotNull]
|
||||
public IEnumerable<APIMod> Mods { get; set; } = Enumerable.Empty<APIMod>();
|
||||
|
||||
public SpectatorState(int? beatmapId = null, IEnumerable<APIMod> mods = null)
|
||||
{
|
||||
BeatmapID = beatmapId;
|
||||
if (mods != null)
|
||||
Mods = mods;
|
||||
}
|
||||
public bool Equals(SpectatorState other) => BeatmapID == other?.BeatmapID && Mods.SequenceEqual(other?.Mods) && RulesetID == other?.RulesetID;
|
||||
|
||||
public bool Equals(SpectatorState other) => BeatmapID == other?.BeatmapID && Mods.SequenceEqual(other?.Mods);
|
||||
|
||||
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)}";
|
||||
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID}";
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Replays.Legacy;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Replays.Types;
|
||||
@ -41,6 +42,9 @@ namespace osu.Game.Online.Spectator
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
@ -171,6 +175,7 @@ namespace osu.Game.Online.Spectator
|
||||
|
||||
// transfer state at point of beginning play
|
||||
currentState.BeatmapID = beatmap.Value.BeatmapInfo.OnlineBeatmapID;
|
||||
currentState.RulesetID = ruleset.Value.ID;
|
||||
currentState.Mods = mods.Value.Select(m => new APIMod(m));
|
||||
|
||||
beginPlaying();
|
||||
|
Loading…
Reference in New Issue
Block a user