1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Fix starting matches not working

This commit is contained in:
Dean Herbert 2019-02-12 11:19:34 +09:00
parent e57409fe41
commit 78b47f9fe3
2 changed files with 20 additions and 8 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -15,7 +14,6 @@ using osu.Game.Online.Multiplayer.GameTypes;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Multi.Match.Components;
using osu.Game.Screens.Multi.Play;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select;
using PlaylistItem = osu.Game.Online.Multiplayer.PlaylistItem;
@ -52,8 +50,6 @@ namespace osu.Game.Screens.Multi.Match
Title = room.RoomID.Value == null ? "New room" : room.Name;
}
private readonly Action<Screen> pushGameplayScreen;
private MatchLeaderboard leaderboard;
[Resolved]
@ -200,6 +196,9 @@ namespace osu.Game.Screens.Multi.Match
beatmapManager.ItemAdded += beatmapAdded;
}
/// <summary>
/// Handle the case where a beatmap is imported (and can be used by this match).
/// </summary>
private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) => Schedule(() =>
{
if (Beatmap.Value != beatmapManager.DefaultBeatmap)
@ -215,19 +214,21 @@ namespace osu.Game.Screens.Multi.Match
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
});
[Resolved(canBeNull: true)]
private Multiplayer multiplayer { get; set; }
private void onStart()
{
// todo: is this required?
Beatmap.Value.Mods.Value = CurrentMods.Value.ToArray();
switch (type.Value)
{
default:
case GameTypeTimeshift _:
this.Push(new PlayerLoader(() => new TimeshiftPlayer(CurrentItem)
multiplayer?.Start(() => new TimeshiftPlayer(CurrentItem)
{
Exited = () => leaderboard.RefreshScores()
}));
});
break;
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -20,6 +21,7 @@ using osu.Game.Screens.Menu;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.Match;
using osu.Game.Screens.Play;
using osuTK;
namespace osu.Game.Screens.Multi
@ -29,7 +31,7 @@ namespace osu.Game.Screens.Multi
{
public override bool CursorVisible => (screenStack.CurrentScreen as IMultiplayerSubScreen)?.CursorVisible ?? true;
public override bool RemoveWhenNotAlive => false;
public override bool DisallowExternalBeatmapRulesetChanges => true;
private readonly MultiplayerWaveContainer waves;
@ -292,5 +294,14 @@ namespace osu.Game.Screens.Multi
FourthWaveColour = OsuColour.FromHex(@"392850");
}
}
/// <summary>
/// Push a <see cref="Player"/> to the main screen stack to begin gameplay.
/// Generally called from a <see cref="MatchSubScreen"/> via DI resolution.
/// </summary>
public void Start(Func<Player> player)
{
this.Push(new PlayerLoader(player));
}
}
}