mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 00:52:59 +08:00
Permitted nulls in ChatOverlay.load() so that in testing, no "OsuGame" instance is required. Also added null checks to the links' on click actions
This commit is contained in:
parent
006ac44e11
commit
ec8b5c2465
@ -99,7 +99,7 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
chat.Game.LoadEditorTimestamp();
|
chat.Game?.LoadEditorTimestamp();
|
||||||
break;
|
break;
|
||||||
case "b":
|
case "b":
|
||||||
if (args.Length > 1 && int.TryParse(args[1], out int mapId))
|
if (args.Length > 1 && int.TryParse(args[1], out int mapId))
|
||||||
@ -122,11 +122,9 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
|
|
||||||
req.Success += user =>
|
req.Success += user =>
|
||||||
{
|
{
|
||||||
// TODO: Open spectator screen and start spectating
|
chat.Game?.LoadSpectatorScreen();
|
||||||
|
|
||||||
};
|
};
|
||||||
// api.Queue(req);
|
api.Queue(req);
|
||||||
chat.Game.LoadSpectatorScreen();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -139,7 +137,7 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
if (!int.TryParse(url.Split('/').ElementAtOrDefault(1), out int multiId))
|
if (!int.TryParse(url.Split('/').ElementAtOrDefault(1), out int multiId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
chat.Game.LoadMultiplayerLobby();
|
chat.Game?.LoadMultiplayerLobby();
|
||||||
}
|
}
|
||||||
else if (url.StartsWith("http://") || url.StartsWith("https://"))
|
else if (url.StartsWith("http://") || url.StartsWith("https://"))
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,9 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private readonly FocusedTextBox textbox;
|
private readonly FocusedTextBox textbox;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current OsuGame instance. Will be null for Tests.
|
||||||
|
/// </summary>
|
||||||
public OsuGame Game;
|
public OsuGame Game;
|
||||||
|
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
@ -272,9 +275,10 @@ namespace osu.Game.Overlays
|
|||||||
base.PopOut();
|
base.PopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(APIAccess api, OsuConfigManager config, OsuColour colours, OsuGame game)
|
private void load(APIAccess api, OsuConfigManager config, OsuColour colours, OsuGame game)
|
||||||
{
|
{
|
||||||
|
// game will be null in testing, so some links will not work
|
||||||
Game = game;
|
Game = game;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
api.Register(this);
|
api.Register(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user