mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:52:55 +08:00
Fix leaderboard not being refreshed when finishing gameplay
This commit is contained in:
parent
7c4fd8ca60
commit
8d640cdc25
@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
LoungeScreen loungeScreen;
|
LoungeScreen loungeScreen;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
loungeScreen = new LoungeScreen
|
loungeScreen = new LoungeScreen(null)
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Top = Header.HEIGHT },
|
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -20,6 +21,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
private readonly SearchContainer search;
|
private readonly SearchContainer search;
|
||||||
private readonly RoomsContainer rooms;
|
private readonly RoomsContainer rooms;
|
||||||
|
private readonly Action<Screen> pushGameplayScreen;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly RoomManager manager;
|
private readonly RoomManager manager;
|
||||||
@ -28,8 +30,10 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
|
|
||||||
protected override Drawable TransitionContent => content;
|
protected override Drawable TransitionContent => content;
|
||||||
|
|
||||||
public LoungeScreen()
|
public LoungeScreen(Action<Screen> pushGameplayScreen)
|
||||||
{
|
{
|
||||||
|
this.pushGameplayScreen = pushGameplayScreen;
|
||||||
|
|
||||||
RoomInspector inspector;
|
RoomInspector inspector;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -122,7 +126,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
if (Filter.Tabs.Current.Value == LoungeTab.Create)
|
if (Filter.Tabs.Current.Value == LoungeTab.Create)
|
||||||
{
|
{
|
||||||
Filter.Tabs.Current.Value = LoungeTab.Public;
|
Filter.Tabs.Current.Value = LoungeTab.Public;
|
||||||
Push(new MatchScreen(new Room()));
|
openRoom(new Room());
|
||||||
}
|
}
|
||||||
|
|
||||||
search.SearchTerm = Filter.Search.Current.Value ?? string.Empty;
|
search.SearchTerm = Filter.Search.Current.Value ?? string.Empty;
|
||||||
@ -136,7 +140,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
if (!IsCurrentScreen)
|
if (!IsCurrentScreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Push(new MatchScreen(room));
|
Push(new MatchScreen(room, s => pushGameplayScreen?.Invoke(s)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -43,22 +44,21 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
private readonly Components.Header header;
|
private readonly Components.Header header;
|
||||||
private readonly Info info;
|
private readonly Info info;
|
||||||
private readonly MatchLeaderboard leaderboard;
|
private readonly MatchLeaderboard leaderboard;
|
||||||
|
private readonly Action<Screen> pushGameplayScreen;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly Room room;
|
private readonly Room room;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private Multiplayer multiplayer { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private APIAccess api { get; set; }
|
||||||
|
|
||||||
public MatchScreen(Room room)
|
public MatchScreen(Room room, Action<Screen> pushGameplayScreen)
|
||||||
{
|
{
|
||||||
this.room = room;
|
this.room = room;
|
||||||
|
this.pushGameplayScreen = pushGameplayScreen;
|
||||||
|
|
||||||
nameBind.BindTo(room.Name);
|
nameBind.BindTo(room.Name);
|
||||||
statusBind.BindTo(room.Status);
|
statusBind.BindTo(room.Status);
|
||||||
@ -146,13 +146,6 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
playlistBind.BindTo(room.Playlist);
|
playlistBind.BindTo(room.Playlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
|
||||||
{
|
|
||||||
base.OnResuming(last);
|
|
||||||
|
|
||||||
leaderboard.RefreshScores();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPlaylistItem(PlaylistItem item)
|
private void addPlaylistItem(PlaylistItem item)
|
||||||
{
|
{
|
||||||
playlistBind.Clear();
|
playlistBind.Clear();
|
||||||
@ -192,7 +185,10 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case GameTypeTimeshift _:
|
case GameTypeTimeshift _:
|
||||||
multiplayer.Push(new PlayerLoader(new TimeshiftPlayer(room.RoomID.Value ?? 0, room.Playlist.First().ID)));
|
var player = new TimeshiftPlayer(room.RoomID.Value ?? 0, room.Playlist.First().ID);
|
||||||
|
player.Exited += _ => leaderboard.RefreshScores();
|
||||||
|
|
||||||
|
pushGameplayScreen?.Invoke(new PlayerLoader(player));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = Header.HEIGHT },
|
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||||
Child = loungeScreen = new LoungeScreen(),
|
Child = loungeScreen = new LoungeScreen(Push),
|
||||||
},
|
},
|
||||||
new Header(loungeScreen)
|
new Header(loungeScreen)
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user