Merge remote-tracking branch 'upstream/release' into multiplayer-lounge

This commit is contained in:
Dean Herbert 2018-05-28 10:48:33 +09:00
commit 3c3412791c
4 changed files with 29 additions and 13 deletions

@ -1 +1 @@
Subproject commit a191c104b8e254e81a1a7bb1c200ccdf02628796
Subproject commit 84fdfc77a86d581638e69f5e8061c118de4b30f9

View File

@ -5,6 +5,7 @@ using System.ComponentModel;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
@ -15,7 +16,20 @@ namespace osu.Game.Tests.Visual
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
{
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
return base.CreatePlayer(beatmap, ruleset);
return new ScoreAccessiblePlayer
{
InitialBeatmap = beatmap,
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
};
}
protected override bool ContinueCondition(Player player) => base.ContinueCondition(player) && ((ScoreAccessiblePlayer)player).ScoreProcessor.TotalScore > 0;
private class ScoreAccessiblePlayer : Player
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
}
}
}

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Play
private SampleChannel sampleRestart;
private ScoreProcessor scoreProcessor;
protected ScoreProcessor ScoreProcessor;
protected RulesetContainer RulesetContainer;
private HUDOverlay hudOverlay;
@ -149,7 +149,7 @@ namespace osu.Game.Screens.Play
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
userAudioOffset.TriggerChange();
scoreProcessor = RulesetContainer.CreateScoreProcessor();
ScoreProcessor = RulesetContainer.CreateScoreProcessor();
Children = new Drawable[]
{
@ -176,7 +176,7 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both,
Child = RulesetContainer
},
new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, scoreProcessor)
new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -184,7 +184,7 @@ namespace osu.Game.Screens.Play
Breaks = beatmap.Breaks
},
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
hudOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
{
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
ProcessCustomClock = false,
@ -225,11 +225,11 @@ namespace osu.Game.Screens.Play
initializeStoryboard(false);
// Bind ScoreProcessor to ourselves
scoreProcessor.AllJudged += onCompletion;
scoreProcessor.Failed += onFail;
ScoreProcessor.AllJudged += onCompletion;
ScoreProcessor.Failed += onFail;
foreach (var mod in Beatmap.Value.Mods.Value.OfType<IApplicableToScoreProcessor>())
mod.ApplyToScoreProcessor(scoreProcessor);
mod.ApplyToScoreProcessor(ScoreProcessor);
}
private void applyRateFromMods()
@ -254,7 +254,7 @@ namespace osu.Game.Screens.Play
private void onCompletion()
{
// Only show the completion screen if the player hasn't failed
if (scoreProcessor.HasFailed || onCompletionEvent != null)
if (ScoreProcessor.HasFailed || onCompletionEvent != null)
return;
ValidForResume = false;
@ -272,7 +272,7 @@ namespace osu.Game.Screens.Play
Beatmap = Beatmap.Value.BeatmapInfo,
Ruleset = ruleset
};
scoreProcessor.PopulateScore(score);
ScoreProcessor.PopulateScore(score);
score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value;
Push(new Results(score));
});

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual
{
Player p = null;
AddStep(ruleset.RulesetInfo.Name, () => p = loadPlayerFor(ruleset));
AddUntilStep(() => p.IsLoaded);
AddUntilStep(() => ContinueCondition(p));
}
else
{
@ -52,11 +52,13 @@ namespace osu.Game.Tests.Visual
{
Player p = null;
AddStep(r.Name, () => p = loadPlayerFor(r));
AddUntilStep(() => p.IsLoaded);
AddUntilStep(() => ContinueCondition(p));
}
}
}
protected virtual bool ContinueCondition(Player player) => player.IsLoaded;
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);
private Player loadPlayerFor(RulesetInfo ri) => loadPlayerFor(ri.CreateInstance());