Merge branch 'master' into cinema-mod

This commit is contained in:
Dean Herbert
2019-12-17 12:52:55 +09:00
98 changed files with 1141 additions and 897 deletions

View File

@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play
private readonly double firstHitObjectTime;
public readonly Bindable<double> UserPlaybackRate = new BindableDouble(1)
public readonly BindableNumber<double> UserPlaybackRate = new BindableDouble(1)
{
Default = 1,
MinValue = 0.5,
@ -73,7 +73,6 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both;
track = beatmap.Track;
track.AddAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust);
adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
@ -120,7 +119,6 @@ namespace osu.Game.Screens.Play
Seek(startTime);
adjustableClock.ProcessFrame();
UserPlaybackRate.ValueChanged += _ => updateRate();
}
public void Restart()
@ -223,7 +221,8 @@ namespace osu.Game.Screens.Play
speedAdjustmentsApplied = true;
track.ResetSpeedAdjustments();
track.Tempo.Value = UserPlaybackRate.Value;
track.AddAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust);
track.AddAdjustment(AdjustableProperty.Tempo, UserPlaybackRate);
foreach (var mod in mods.OfType<IApplicableToTrack>())
mod.ApplyToTrack(track);
@ -244,8 +243,6 @@ namespace osu.Game.Screens.Play
track.ResetSpeedAdjustments();
speedAdjustmentsApplied = false;
}
track.RemoveAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust);
}
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
{
public class HUDOverlay : Container
{
private const int fade_duration = 400;
private const float fade_duration = 400;
private const Easing fade_easing = Easing.Out;
public readonly KeyCounterDisplay KeyCounter;
@ -78,6 +78,7 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
HealthDisplay = CreateHealthDisplay(),
topScoreContainer = new Container
{
Anchor = Anchor.TopCentre,
@ -90,7 +91,6 @@ namespace osu.Game.Screens.Play
ComboCounter = CreateComboCounter(),
},
},
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(),
ModDisplay = CreateModsContainer(),
HitErrorDisplay = CreateHitErrorDisplayOverlay(),
@ -103,8 +103,8 @@ namespace osu.Game.Screens.Play
Origin = Anchor.BottomRight,
Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y),
AutoSizeAxes = Axes.Both,
AutoSizeDuration = fade_duration,
AutoSizeEasing = fade_easing,
LayoutDuration = fade_duration / 2,
LayoutEasing = fade_easing,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{

View File

@ -114,26 +114,31 @@ namespace osu.Game.Screens.Play
Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray();
WorkingBeatmap working = loadBeatmap();
if (Beatmap.Value is DummyWorkingBeatmap)
return;
if (working == null)
IBeatmap playableBeatmap = loadPlayableBeatmap();
if (playableBeatmap == null)
return;
sampleRestart = audio.Samples.Get(@"Gameplay/restart");
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
DrawableRuleset = ruleset.CreateDrawableRulesetWith(playableBeatmap, Mods.Value);
ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
ScoreProcessor.Mods.BindTo(Mods);
if (!ScoreProcessor.Mode.Disabled)
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, Mods.Value, DrawableRuleset.GameplayStartTime);
InternalChild = GameplayClockContainer = new GameplayClockContainer(Beatmap.Value, Mods.Value, DrawableRuleset.GameplayStartTime);
addUnderlayComponents(GameplayClockContainer);
addGameplayComponents(GameplayClockContainer, working);
addOverlayComponents(GameplayClockContainer, working);
addGameplayComponents(GameplayClockContainer, Beatmap.Value);
addOverlayComponents(GameplayClockContainer, Beatmap.Value);
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
@ -250,36 +255,32 @@ namespace osu.Game.Screens.Play
&& !DrawableRuleset.HasReplayLoaded.Value
&& !BreakOverlay.IsBreakTime.Value;
private WorkingBeatmap loadBeatmap()
private IBeatmap loadPlayableBeatmap()
{
WorkingBeatmap working = Beatmap.Value;
if (working is DummyWorkingBeatmap)
return null;
IBeatmap playable;
try
{
var beatmap = working.Beatmap;
if (beatmap == null)
if (Beatmap.Value.Beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded");
rulesetInfo = Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset;
rulesetInfo = Ruleset.Value ?? Beatmap.Value.BeatmapInfo.Ruleset;
ruleset = rulesetInfo.CreateInstance();
try
{
DrawableRuleset = ruleset.CreateDrawableRulesetWith(working, Mods.Value);
playable = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Mods.Value);
}
catch (BeatmapInvalidForRulesetException)
{
// we may fail to create a DrawableRuleset if the beatmap cannot be loaded with the user's preferred ruleset
// let's try again forcing the beatmap's ruleset.
rulesetInfo = beatmap.BeatmapInfo.Ruleset;
// A playable beatmap may not be creatable with the user's preferred ruleset, so try using the beatmap's default ruleset
rulesetInfo = Beatmap.Value.BeatmapInfo.Ruleset;
ruleset = rulesetInfo.CreateInstance();
DrawableRuleset = ruleset.CreateDrawableRulesetWith(Beatmap.Value, Mods.Value);
playable = Beatmap.Value.GetPlayableBeatmap(rulesetInfo, Mods.Value);
}
if (!DrawableRuleset.Objects.Any())
if (playable.HitObjects.Count == 0)
{
Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error);
return null;
@ -292,7 +293,7 @@ namespace osu.Game.Screens.Play
return null;
}
return working;
return playable;
}
private void performImmediateExit()
@ -510,6 +511,11 @@ namespace osu.Game.Screens.Play
Background.EnableUserDim.Value = true;
Background.BlurAmount.Value = 0;
// bind component bindables.
Background.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
DimmableStoryboard.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
DimmableVideo.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);