mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 04:07:25 +08:00
Allow channel manager and osugame to be null
This commit is contained in:
parent
dbd391825a
commit
09d7dc73dc
@ -11,7 +11,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
{
|
{
|
||||||
private readonly Room room;
|
private readonly Room room;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private ChannelManager channelManager { get; set; }
|
private ChannelManager channelManager { get; set; }
|
||||||
|
|
||||||
public MatchChatDisplay(Room room)
|
public MatchChatDisplay(Room room)
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
private void updateChannel()
|
private void updateChannel()
|
||||||
{
|
{
|
||||||
if (room.RoomID.Value != null)
|
if (room.RoomID.Value != null)
|
||||||
Channel.Value = channelManager.JoinChannel(new Channel { Id = room.ChannelId, Type = ChannelType.Multiplayer, Name = $"#mp_{room.RoomID}" });
|
Channel.Value = channelManager?.JoinChannel(new Channel { Id = room.ChannelId, Type = ChannelType.Multiplayer, Name = $"#mp_{room.RoomID}" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private OsuGame game { get; set; }
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
@ -120,7 +120,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
||||||
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID);
|
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID);
|
||||||
|
|
||||||
game.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMods(IEnumerable<Mod> mods)
|
private void setMods(IEnumerable<Mod> mods)
|
||||||
@ -133,7 +133,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
if (ruleset == null)
|
if (ruleset == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
game.ForcefullySetRuleset(ruleset);
|
game?.ForcefullySetRuleset(ruleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPlaylistItem(PlaylistItem item)
|
private void addPlaylistItem(PlaylistItem item)
|
||||||
|
Loading…
Reference in New Issue
Block a user