mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Make multiplayer screen handle user activity updates from subscreens.
This commit is contained in:
parent
55070556a7
commit
89b98b5388
@ -24,6 +24,7 @@ using osu.Game.Screens.Multi.Lounge;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
using osu.Game.Screens.Multi.Match;
|
||||
using osu.Game.Screens.Multi.Match.Components;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Multi
|
||||
@ -140,10 +141,10 @@ namespace osu.Game.Screens.Multi
|
||||
}
|
||||
};
|
||||
|
||||
screenStack.Push(loungeSubScreen = new LoungeSubScreen());
|
||||
|
||||
screenStack.ScreenPushed += screenPushed;
|
||||
screenStack.ScreenExited += screenExited;
|
||||
|
||||
screenStack.Push(loungeSubScreen = new LoungeSubScreen());
|
||||
}
|
||||
|
||||
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
|
||||
@ -311,18 +312,18 @@ namespace osu.Game.Screens.Multi
|
||||
|
||||
private void screenPushed(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
subScreenChanged(newScreen);
|
||||
subScreenChanged(lastScreen, newScreen);
|
||||
}
|
||||
|
||||
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
subScreenChanged(newScreen);
|
||||
subScreenChanged(lastScreen, newScreen);
|
||||
|
||||
if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
private void subScreenChanged(IScreen newScreen)
|
||||
private void subScreenChanged(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
switch (newScreen)
|
||||
{
|
||||
@ -337,6 +338,12 @@ namespace osu.Game.Screens.Multi
|
||||
break;
|
||||
}
|
||||
|
||||
if (lastScreen is IOsuScreen lastOsuScreen)
|
||||
Activity.UnbindFrom(lastOsuScreen.Activity);
|
||||
|
||||
if (newScreen is IOsuScreen newOsuScreen)
|
||||
((IBindable<UserActivity>)Activity).BindTo(newOsuScreen.Activity);
|
||||
|
||||
updatePollingRate(isIdle.Value);
|
||||
createButton.FadeTo(newScreen is LoungeSubScreen ? 1 : 0, 200);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user