1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-06 02:46:08 +08:00

Remove unnecessary properties and parameters

This commit is contained in:
Dean Herbert 2021-11-04 13:33:54 +09:00
parent 3453160a8b
commit 05f1fd4bc9
3 changed files with 9 additions and 8 deletions

View File

@ -69,7 +69,7 @@ namespace osu.Game.Online.Rooms
Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.ID ?? 0); Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.ID ?? 0);
} }
public void MapObjects(BeatmapManager beatmaps, RulesetStore rulesets) public void MapObjects(RulesetStore rulesets)
{ {
Beatmap.Value ??= APIBeatmap; Beatmap.Value ??= APIBeatmap;
Ruleset.Value ??= rulesets.GetRuleset(RulesetID); Ruleset.Value ??= rulesets.GetRuleset(RulesetID);

View File

@ -119,7 +119,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
try try
{ {
foreach (var pi in room.Playlist) foreach (var pi in room.Playlist)
pi.MapObjects(beatmaps, rulesets); pi.MapObjects(rulesets);
var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value); var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value);
if (existing == null) if (existing == null)

View File

@ -51,7 +51,6 @@ namespace osu.Game.Screens.Play
private Container beatmapPanelContainer; private Container beatmapPanelContainer;
private TriangleButton watchButton; private TriangleButton watchButton;
private SettingsCheckbox automaticDownload; private SettingsCheckbox automaticDownload;
private APIBeatmapSet onlineBeatmap;
/// <summary> /// <summary>
/// The player's immediate online gameplay state. /// The player's immediate online gameplay state.
@ -61,6 +60,8 @@ namespace osu.Game.Screens.Play
private GetBeatmapSetRequest onlineBeatmapRequest; private GetBeatmapSetRequest onlineBeatmapRequest;
private APIBeatmapSet beatmapSet;
public SoloSpectator([NotNull] User targetUser) public SoloSpectator([NotNull] User targetUser)
: base(targetUser.Id) : base(targetUser.Id)
{ {
@ -221,10 +222,10 @@ namespace osu.Game.Screens.Play
Debug.Assert(state.BeatmapID != null); Debug.Assert(state.BeatmapID != null);
onlineBeatmapRequest = new GetBeatmapSetRequest(state.BeatmapID.Value, BeatmapSetLookupType.BeatmapId); onlineBeatmapRequest = new GetBeatmapSetRequest(state.BeatmapID.Value, BeatmapSetLookupType.BeatmapId);
onlineBeatmapRequest.Success += res => Schedule(() => onlineBeatmapRequest.Success += beatmapSet => Schedule(() =>
{ {
onlineBeatmap = res; this.beatmapSet = beatmapSet;
beatmapPanelContainer.Child = new GridBeatmapPanel(onlineBeatmap); beatmapPanelContainer.Child = new GridBeatmapPanel(this.beatmapSet);
checkForAutomaticDownload(); checkForAutomaticDownload();
}); });
@ -233,14 +234,14 @@ namespace osu.Game.Screens.Play
private void checkForAutomaticDownload() private void checkForAutomaticDownload()
{ {
if (onlineBeatmap == null) if (beatmapSet == null)
return; return;
if (!automaticDownload.Current.Value) if (!automaticDownload.Current.Value)
return; return;
// Used to interact with manager classes that don't support interface types. Will eventually be replaced. // Used to interact with manager classes that don't support interface types. Will eventually be replaced.
var beatmapSetInfo = new BeatmapSetInfo { OnlineBeatmapSetID = onlineBeatmap.OnlineID }; var beatmapSetInfo = new BeatmapSetInfo { OnlineBeatmapSetID = beatmapSet.OnlineID };
if (beatmaps.IsAvailableLocally(beatmapSetInfo)) if (beatmaps.IsAvailableLocally(beatmapSetInfo))
return; return;