1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Use fades instead of event listening. Fixed same issue in the playlist room creation.

This commit is contained in:
Mysfit 2021-01-19 00:35:56 -05:00
parent cbfb999c28
commit 3a7608275d
2 changed files with 70 additions and 13 deletions

View File

@ -180,9 +180,40 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
State = { Value = client.Room == null ? Visibility.Visible : Visibility.Hidden } State = { Value = client.Room == null ? Visibility.Visible : Visibility.Hidden }
} }
}; };
}
subScreenContainer.Hide(); public override void OnEntering(IScreen last)
client.RoomUpdated += roomUpdated; {
base.OnEntering(last);
subScreenContainer.FadeOut().Delay(1000).FadeIn(500);
}
public override bool OnExiting(IScreen next)
{
if (base.OnExiting(next))
return true;
subScreenContainer.FadeOut();
return false;
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
if (client.Room == null)
subScreenContainer.FadeOut().Delay(1000).FadeIn(500);
else
subScreenContainer.FadeInFromZero();
}
public override void OnSuspending(IScreen next)
{
subScreenContainer.FadeOut();
base.OnSuspending(next);
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -263,16 +294,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
readyClickOperation = null; readyClickOperation = null;
} }
private void roomUpdated()
{
if (client.Room != null)
{
// If the room is updated and is not null, show the room sub screen container and unsubscribe.
subScreenContainer.Show();
client.RoomUpdated -= roomUpdated;
}
}
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);

View File

@ -33,6 +33,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
private OverlinedHeader participantsHeader; private OverlinedHeader participantsHeader;
private GridContainer subScreenContainer;
public PlaylistsRoomSubScreen(Room room) public PlaylistsRoomSubScreen(Room room)
{ {
Title = room.RoomID.Value == null ? "New playlist" : room.Name.Value; Title = room.RoomID.Value == null ? "New playlist" : room.Name.Value;
@ -44,7 +46,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new GridContainer subScreenContainer = new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Content = new[] Content = new[]
@ -195,6 +197,40 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
subScreenContainer.FadeOut().Delay(1000).FadeIn(500);
}
public override bool OnExiting(IScreen next)
{
if (base.OnExiting(next))
return true;
subScreenContainer.FadeOut();
return false;
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
if (roomId.Value == null)
subScreenContainer.FadeOut().Delay(1000).FadeIn(500);
else
subScreenContainer.FadeInFromZero();
}
public override void OnSuspending(IScreen next)
{
subScreenContainer.FadeOut();
base.OnSuspending(next);
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();