1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge branch 'master' into difficulty-point-multiple

This commit is contained in:
Dean Herbert 2021-11-13 23:47:12 +09:00 committed by GitHub
commit 983d5a6cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 130 additions and 45 deletions

View File

@ -10,9 +10,12 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Game.Screens.Edit.GameplayTest;
using osu.Game.Tests.Beatmaps.IO;
using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Editing
@ -58,6 +61,42 @@ namespace osu.Game.Tests.Visual.Editing
AddUntilStep("player pushed", () => (editorPlayer = Stack.CurrentScreen as EditorPlayer) != null);
AddStep("exit player", () => editorPlayer.Exit());
AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor);
AddUntilStep("background has correct params", () =>
{
var background = this.ChildrenOfType<BackgroundScreenBeatmap>().Single();
return background.Colour == Color4.DarkGray && background.BlurAmount.Value == 0;
});
}
[Test]
public void TestGameplayTestWhenTrackRunning()
{
AddStep("start track", () => EditorClock.Start());
AddAssert("sample playback enabled", () => !Editor.SamplePlaybackDisabled.Value);
AddStep("click test gameplay button", () =>
{
var button = Editor.ChildrenOfType<TestGameplayButton>().Single();
InputManager.MoveMouseTo(button);
InputManager.Click(MouseButton.Left);
});
EditorPlayer editorPlayer = null;
AddUntilStep("player pushed", () => (editorPlayer = Stack.CurrentScreen as EditorPlayer) != null);
AddAssert("editor track stopped", () => !EditorClock.IsRunning);
AddAssert("sample playback disabled", () => Editor.SamplePlaybackDisabled.Value);
AddStep("exit player", () => editorPlayer.Exit());
AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor);
AddUntilStep("background has correct params", () =>
{
var background = this.ChildrenOfType<BackgroundScreenBeatmap>().Single();
return background.Colour == Color4.DarkGray && background.BlurAmount.Value == 0;
});
AddStep("start track", () => EditorClock.Start());
AddAssert("sample playback re-enabled", () => !Editor.SamplePlaybackDisabled.Value);
}
[Test]

View File

@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Settings
{
@ -29,36 +29,26 @@ namespace osu.Game.Overlays.Settings
Children = new Drawable[]
{
new FillFlowContainer
new OsuTextFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
Padding = new MarginPadding
{
new OsuSpriteText
{
Text = heading,
Font = OsuFont.TorusAlternate.With(size: 40),
Margin = new MarginPadding
{
Left = SettingsPanel.CONTENT_MARGINS,
Top = Toolbar.Toolbar.TOOLTIP_HEIGHT
},
},
new OsuSpriteText
{
Colour = colourProvider.Content2,
Text = subheading,
Font = OsuFont.GetFont(size: 18),
Margin = new MarginPadding
{
Left = SettingsPanel.CONTENT_MARGINS,
Bottom = 30
},
},
Horizontal = SettingsPanel.CONTENT_MARGINS,
Top = Toolbar.Toolbar.TOOLTIP_HEIGHT,
Bottom = 30
}
}
}.With(flow =>
{
flow.AddText(heading, header => header.Font = OsuFont.TorusAlternate.With(size: 40));
flow.NewLine();
flow.AddText(subheading, subheader =>
{
subheader.Colour = colourProvider.Content2;
subheader.Font = OsuFont.GetFont(size: 18);
});
})
};
}
}

View File

@ -31,6 +31,7 @@ using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Design;
using osu.Game.Screens.Edit.GameplayTest;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Edit.Timing;
using osu.Game.Screens.Edit.Verify;
@ -486,7 +487,18 @@ namespace osu.Game.Screens.Edit
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
dimBackground();
resetTrack(true);
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
dimBackground();
}
private void dimBackground()
{
ApplyToBackground(b =>
{
// todo: temporary. we want to be applying dim using the UserDimContainer eventually.
@ -495,8 +507,6 @@ namespace osu.Game.Screens.Edit
b.IgnoreUserSettings.Value = true;
b.BlurAmount.Value = 0;
});
resetTrack(true);
}
public override bool OnExiting(IScreen next)
@ -535,9 +545,9 @@ namespace osu.Game.Screens.Edit
public override void OnSuspending(IScreen next)
{
refetchBeatmap();
base.OnSuspending(next);
clock.Stop();
refetchBeatmap();
}
private void refetchBeatmap()
@ -797,7 +807,7 @@ namespace osu.Game.Screens.Edit
pushEditorPlayer();
}
void pushEditorPlayer() => this.Push(new PlayerLoader(() => new EditorPlayer()));
void pushEditorPlayer() => this.Push(new EditorPlayerLoader());
}
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);

View File

@ -6,7 +6,7 @@ using osu.Framework.Screens;
using osu.Game.Overlays;
using osu.Game.Screens.Play;
namespace osu.Game.Screens.Edit
namespace osu.Game.Screens.Edit.GameplayTest
{
public class EditorPlayer : Player
{

View File

@ -0,0 +1,44 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
namespace osu.Game.Screens.Edit.GameplayTest
{
public class EditorPlayerLoader : PlayerLoader
{
[Resolved]
private OsuLogo osuLogo { get; set; }
public EditorPlayerLoader()
: base(() => new EditorPlayer())
{
}
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
MetadataInfo.FinishTransforms(true);
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
{
// call base with resuming forcefully set to true to reduce logo movements.
base.LogoArriving(logo, true);
logo.FinishTransforms(true, nameof(Scale));
}
protected override void ContentOut()
{
base.ContentOut();
osuLogo.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint);
}
protected override double PlayerPushDelay => 0;
}
}

View File

@ -5,7 +5,7 @@ using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Edit
namespace osu.Game.Screens.Edit.GameplayTest
{
public class SaveBeforeGameplayTestDialog : PopupDialog
{

View File

@ -36,7 +36,9 @@ namespace osu.Game.Screens.Play
{
protected const float BACKGROUND_BLUR = 15;
private const double content_out_duration = 300;
protected const double CONTENT_OUT_DURATION = 300;
protected virtual double PlayerPushDelay => 1800;
public override bool HideOverlaysOnEnter => hideOverlays;
@ -213,7 +215,7 @@ namespace osu.Game.Screens.Play
// after an initial delay, start the debounced load check.
// this will continue to execute even after resuming back on restart.
Scheduler.Add(new ScheduledDelegate(pushWhenLoaded, Clock.CurrentTime + 1800, 0));
Scheduler.Add(new ScheduledDelegate(pushWhenLoaded, Clock.CurrentTime + PlayerPushDelay, 0));
showMuteWarningIfNeeded();
showBatteryWarningIfNeeded();
@ -248,13 +250,13 @@ namespace osu.Game.Screens.Play
public override bool OnExiting(IScreen next)
{
cancelLoad();
contentOut();
ContentOut();
// If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed).
epilepsyWarning?.Hide();
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
this.Delay(content_out_duration).FadeOut();
this.Delay(CONTENT_OUT_DURATION).FadeOut();
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
@ -361,15 +363,15 @@ namespace osu.Game.Screens.Play
ApplyToBackground(b => b?.FadeColour(Color4.White, 800, Easing.OutQuint));
}
private void contentOut()
protected virtual void ContentOut()
{
// Ensure the logo is no longer tracking before we scale the content
content.StopTracking();
content.ScaleTo(0.7f, content_out_duration * 2, Easing.OutQuint);
content.FadeOut(content_out_duration, Easing.OutQuint);
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, content_out_duration);
highPassFilter.CutoffTo(0, content_out_duration);
content.ScaleTo(0.7f, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
content.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint);
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, CONTENT_OUT_DURATION);
highPassFilter.CutoffTo(0, CONTENT_OUT_DURATION);
}
private void pushWhenLoaded()
@ -394,9 +396,9 @@ namespace osu.Game.Screens.Play
// ensure that once we have reached this "point of no return", readyForPush will be false for all future checks (until a new player instance is prepared).
var consumedPlayer = consumePlayer();
contentOut();
ContentOut();
TransformSequence<PlayerLoader> pushSequence = this.Delay(content_out_duration);
TransformSequence<PlayerLoader> pushSequence = this.Delay(CONTENT_OUT_DURATION);
// only show if the warning was created (i.e. the beatmap needs it)
// and this is not a restart of the map (the warning expires after first load).
@ -418,7 +420,7 @@ namespace osu.Game.Screens.Play
else
{
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
this.TransformBindableTo(volumeAdjustment, 0, content_out_duration, Easing.OutCubic);
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
}
pushSequence.Schedule(() =>