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

Better handling of logged in state

This commit is contained in:
Dean Herbert 2017-05-16 19:55:45 +09:00
parent 2384f7b0c1
commit 23807aa3b9
2 changed files with 12 additions and 2 deletions

View File

@ -191,7 +191,7 @@ namespace osu.Game.Online.API
req.Perform(this); req.Perform(this);
//we could still be in initialisation, at which point we don't want to say we're Online yet. //we could still be in initialisation, at which point we don't want to say we're Online yet.
if (LocalUser.Value != null) if (IsLoggedIn)
State = APIState.Online; State = APIState.Online;
failureCount = 0; failureCount = 0;
@ -266,6 +266,8 @@ namespace osu.Game.Online.API
} }
} }
public bool IsLoggedIn => LocalUser.Value.Id > 1;
public void Queue(APIRequest request) public void Queue(APIRequest request)
{ {
queue.Enqueue(request); queue.Enqueue(request);

View File

@ -353,7 +353,15 @@ namespace osu.Game.Overlays
{ {
var postText = textbox.Text; var postText = textbox.Text;
if (string.IsNullOrEmpty(postText) || api.LocalUser.Value == null) return; if (string.IsNullOrEmpty(postText))
return;
if (!api.IsLoggedIn)
{
currentChannel?.AddNewMessages(new ErrorMessage("Please login to participate in chat!"));
textbox.Text = string.Empty;
return;
}
if (currentChannel == null) return; if (currentChannel == null) return;