1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:33:05 +08:00

Allow channel manager and osugame to be null

This commit is contained in:
smoogipoo 2018-12-22 14:38:46 +09:00
parent dbd391825a
commit 09d7dc73dc
2 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
private readonly Room room;
[Resolved]
[Resolved(CanBeNull = true)]
private ChannelManager channelManager { get; set; }
public MatchChatDisplay(Room room)
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Multi.Match.Components
private void updateChannel()
{
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}" });
}
}
}

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Multi.Match
[Resolved]
private BeatmapManager beatmapManager { get; set; }
[Resolved]
[Resolved(CanBeNull = true)]
private OsuGame game { get; set; }
[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
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)
@ -133,7 +133,7 @@ namespace osu.Game.Screens.Multi.Match
if (ruleset == null)
return;
game.ForcefullySetRuleset(ruleset);
game?.ForcefullySetRuleset(ruleset);
}
private void addPlaylistItem(PlaylistItem item)