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

Fix leaderboard not being refreshed when finishing gameplay

This commit is contained in:
smoogipoo 2018-12-18 12:56:16 +09:00
parent 7c4fd8ca60
commit 8d640cdc25
4 changed files with 17 additions and 17 deletions

View File

@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual
LoungeScreen loungeScreen;
Children = new Drawable[]
{
loungeScreen = new LoungeScreen
loungeScreen = new LoungeScreen(null)
{
Padding = new MarginPadding { Top = Header.HEIGHT },
},

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -20,6 +21,7 @@ namespace osu.Game.Screens.Multi.Lounge
private readonly Container content;
private readonly SearchContainer search;
private readonly RoomsContainer rooms;
private readonly Action<Screen> pushGameplayScreen;
[Cached]
private readonly RoomManager manager;
@ -28,8 +30,10 @@ namespace osu.Game.Screens.Multi.Lounge
protected override Drawable TransitionContent => content;
public LoungeScreen()
public LoungeScreen(Action<Screen> pushGameplayScreen)
{
this.pushGameplayScreen = pushGameplayScreen;
RoomInspector inspector;
Children = new Drawable[]
@ -122,7 +126,7 @@ namespace osu.Game.Screens.Multi.Lounge
if (Filter.Tabs.Current.Value == LoungeTab.Create)
{
Filter.Tabs.Current.Value = LoungeTab.Public;
Push(new MatchScreen(new Room()));
openRoom(new Room());
}
search.SearchTerm = Filter.Search.Current.Value ?? string.Empty;
@ -136,7 +140,7 @@ namespace osu.Game.Screens.Multi.Lounge
if (!IsCurrentScreen)
return;
Push(new MatchScreen(room));
Push(new MatchScreen(room, s => pushGameplayScreen?.Invoke(s)));
}
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -43,22 +44,21 @@ namespace osu.Game.Screens.Multi.Match
private readonly Components.Header header;
private readonly Info info;
private readonly MatchLeaderboard leaderboard;
private readonly Action<Screen> pushGameplayScreen;
[Cached]
private readonly Room room;
[Resolved]
private Multiplayer multiplayer { get; set; }
[Resolved]
private BeatmapManager beatmapManager { get; set; }
[Resolved]
private APIAccess api { get; set; }
public MatchScreen(Room room)
public MatchScreen(Room room, Action<Screen> pushGameplayScreen)
{
this.room = room;
this.pushGameplayScreen = pushGameplayScreen;
nameBind.BindTo(room.Name);
statusBind.BindTo(room.Status);
@ -146,13 +146,6 @@ namespace osu.Game.Screens.Multi.Match
playlistBind.BindTo(room.Playlist);
}
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
leaderboard.RefreshScores();
}
private void addPlaylistItem(PlaylistItem item)
{
playlistBind.Clear();
@ -192,7 +185,10 @@ namespace osu.Game.Screens.Multi.Match
{
default:
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;
}
}

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Multi
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = Header.HEIGHT },
Child = loungeScreen = new LoungeScreen(),
Child = loungeScreen = new LoungeScreen(Push),
},
new Header(loungeScreen)
});