mirror of
https://github.com/ppy/osu.git
synced 2024-12-24 14:02:54 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
a23095ba0f
@ -43,6 +43,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Setup
|
||||
private void updateBeatmap()
|
||||
{
|
||||
Beatmap.BeatmapInfo.SpecialStyle = specialStyle.Current.Value;
|
||||
Beatmap.SaveState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
213
osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectMerging.cs
Normal file
213
osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectMerging.cs
Normal file
@ -0,0 +1,213 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
{
|
||||
public class TestSceneObjectMerging : TestSceneOsuEditor
|
||||
{
|
||||
[Test]
|
||||
public void TestSimpleMerge()
|
||||
{
|
||||
HitCircle? circle1 = null;
|
||||
HitCircle? circle2 = null;
|
||||
|
||||
AddStep("select first two circles", () =>
|
||||
{
|
||||
circle1 = (HitCircle)EditorBeatmap.HitObjects.First(h => h is HitCircle);
|
||||
circle2 = (HitCircle)EditorBeatmap.HitObjects.First(h => h is HitCircle && h != circle1);
|
||||
EditorClock.Seek(circle1.StartTime);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle1);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle2);
|
||||
});
|
||||
|
||||
mergeSelection();
|
||||
|
||||
AddAssert("slider created", () => circle1 is not null && circle2 is not null && sliderCreatedFor(
|
||||
(pos: circle1.Position, pathType: PathType.Linear),
|
||||
(pos: circle2.Position, pathType: null)));
|
||||
|
||||
AddStep("undo", () => Editor.Undo());
|
||||
AddAssert("merged objects restored", () => circle1 is not null && circle2 is not null && objectsRestored(circle1, circle2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMergeCircleSlider()
|
||||
{
|
||||
HitCircle? circle1 = null;
|
||||
Slider? slider = null;
|
||||
HitCircle? circle2 = null;
|
||||
|
||||
AddStep("select a circle, slider, circle", () =>
|
||||
{
|
||||
circle1 = (HitCircle)EditorBeatmap.HitObjects.First(h => h is HitCircle);
|
||||
slider = (Slider)EditorBeatmap.HitObjects.First(h => h is Slider && h.StartTime > circle1.StartTime);
|
||||
circle2 = (HitCircle)EditorBeatmap.HitObjects.First(h => h is HitCircle && h.StartTime > slider.StartTime);
|
||||
EditorClock.Seek(circle1.StartTime);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle1);
|
||||
EditorBeatmap.SelectedHitObjects.Add(slider);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle2);
|
||||
});
|
||||
|
||||
mergeSelection();
|
||||
|
||||
AddAssert("slider created", () =>
|
||||
{
|
||||
if (circle1 is null || circle2 is null || slider is null)
|
||||
return false;
|
||||
|
||||
var controlPoints = slider.Path.ControlPoints;
|
||||
(Vector2, PathType?)[] args = new (Vector2, PathType?)[controlPoints.Count + 2];
|
||||
args[0] = (circle1.Position, PathType.Linear);
|
||||
|
||||
for (int i = 0; i < controlPoints.Count; i++)
|
||||
{
|
||||
args[i + 1] = (controlPoints[i].Position + slider.Position, i == controlPoints.Count - 1 ? PathType.Linear : controlPoints[i].Type);
|
||||
}
|
||||
|
||||
args[^1] = (circle2.Position, null);
|
||||
return sliderCreatedFor(args);
|
||||
});
|
||||
|
||||
AddStep("undo", () => Editor.Undo());
|
||||
AddAssert("merged objects restored", () => circle1 is not null && circle2 is not null && slider is not null && objectsRestored(circle1, slider, circle2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMergeSliderSlider()
|
||||
{
|
||||
Slider? slider1 = null;
|
||||
SliderPath? slider1Path = null;
|
||||
Slider? slider2 = null;
|
||||
|
||||
AddStep("select two sliders", () =>
|
||||
{
|
||||
slider1 = (Slider)EditorBeatmap.HitObjects.First(h => h is Slider);
|
||||
slider1Path = new SliderPath(slider1.Path.ControlPoints.Select(p => new PathControlPoint(p.Position, p.Type)).ToArray(), slider1.Path.ExpectedDistance.Value);
|
||||
slider2 = (Slider)EditorBeatmap.HitObjects.First(h => h is Slider && h.StartTime > slider1.StartTime);
|
||||
EditorClock.Seek(slider1.StartTime);
|
||||
EditorBeatmap.SelectedHitObjects.Add(slider1);
|
||||
EditorBeatmap.SelectedHitObjects.Add(slider2);
|
||||
});
|
||||
|
||||
mergeSelection();
|
||||
|
||||
AddAssert("slider created", () =>
|
||||
{
|
||||
if (slider1 is null || slider2 is null || slider1Path is null)
|
||||
return false;
|
||||
|
||||
var controlPoints1 = slider1Path.ControlPoints;
|
||||
var controlPoints2 = slider2.Path.ControlPoints;
|
||||
(Vector2, PathType?)[] args = new (Vector2, PathType?)[controlPoints1.Count + controlPoints2.Count - 1];
|
||||
|
||||
for (int i = 0; i < controlPoints1.Count - 1; i++)
|
||||
{
|
||||
args[i] = (controlPoints1[i].Position + slider1.Position, controlPoints1[i].Type);
|
||||
}
|
||||
|
||||
for (int i = 0; i < controlPoints2.Count; i++)
|
||||
{
|
||||
args[i + controlPoints1.Count - 1] = (controlPoints2[i].Position + controlPoints1[^1].Position + slider1.Position, controlPoints2[i].Type);
|
||||
}
|
||||
|
||||
return sliderCreatedFor(args);
|
||||
});
|
||||
|
||||
AddAssert("merged slider matches first slider", () =>
|
||||
{
|
||||
var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
|
||||
return slider1 is not null && mergedSlider.HeadCircle.Samples.SequenceEqual(slider1.HeadCircle.Samples)
|
||||
&& mergedSlider.TailCircle.Samples.SequenceEqual(slider1.TailCircle.Samples)
|
||||
&& mergedSlider.Samples.SequenceEqual(slider1.Samples)
|
||||
&& mergedSlider.SampleControlPoint.IsRedundant(slider1.SampleControlPoint);
|
||||
});
|
||||
|
||||
AddAssert("slider end is at same completion for last slider", () =>
|
||||
{
|
||||
if (slider1Path is null || slider2 is null)
|
||||
return false;
|
||||
|
||||
var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
|
||||
return Precision.AlmostEquals(mergedSlider.Path.Distance, slider1Path.CalculatedDistance + slider2.Path.Distance);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNonMerge()
|
||||
{
|
||||
HitCircle? circle1 = null;
|
||||
HitCircle? circle2 = null;
|
||||
Spinner? spinner = null;
|
||||
|
||||
AddStep("select first two circles and spinner", () =>
|
||||
{
|
||||
circle1 = (HitCircle)EditorBeatmap.HitObjects.First(h => h is HitCircle);
|
||||
circle2 = (HitCircle)EditorBeatmap.HitObjects.First(h => h is HitCircle && h != circle1);
|
||||
spinner = (Spinner)EditorBeatmap.HitObjects.First(h => h is Spinner);
|
||||
EditorClock.Seek(spinner.StartTime);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle1);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle2);
|
||||
EditorBeatmap.SelectedHitObjects.Add(spinner);
|
||||
});
|
||||
|
||||
mergeSelection();
|
||||
|
||||
AddAssert("slider created", () => circle1 is not null && circle2 is not null && sliderCreatedFor(
|
||||
(pos: circle1.Position, pathType: PathType.Linear),
|
||||
(pos: circle2.Position, pathType: null)));
|
||||
|
||||
AddAssert("spinner not merged", () => EditorBeatmap.HitObjects.Contains(spinner));
|
||||
}
|
||||
|
||||
private void mergeSelection()
|
||||
{
|
||||
AddStep("merge selection", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.LControl);
|
||||
InputManager.PressKey(Key.LShift);
|
||||
InputManager.Key(Key.M);
|
||||
InputManager.ReleaseKey(Key.LShift);
|
||||
InputManager.ReleaseKey(Key.LControl);
|
||||
});
|
||||
}
|
||||
|
||||
private bool sliderCreatedFor(params (Vector2 pos, PathType? pathType)[] expectedControlPoints)
|
||||
{
|
||||
if (EditorBeatmap.SelectedHitObjects.Count != 1)
|
||||
return false;
|
||||
|
||||
var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
|
||||
int i = 0;
|
||||
|
||||
foreach ((Vector2 pos, PathType? pathType) in expectedControlPoints)
|
||||
{
|
||||
var controlPoint = mergedSlider.Path.ControlPoints[i++];
|
||||
|
||||
if (!Precision.AlmostEquals(controlPoint.Position + mergedSlider.Position, pos) || controlPoint.Type != pathType)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool objectsRestored(params HitObject[] objects)
|
||||
{
|
||||
foreach (var hitObject in objects)
|
||||
{
|
||||
if (EditorBeatmap.HitObjects.Contains(hitObject))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -251,13 +251,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
private void convertToStream()
|
||||
{
|
||||
if (editorBeatmap == null || changeHandler == null || beatDivisor == null)
|
||||
if (editorBeatmap == null || beatDivisor == null)
|
||||
return;
|
||||
|
||||
var timingPoint = editorBeatmap.ControlPointInfo.TimingPointAt(HitObject.StartTime);
|
||||
double streamSpacing = timingPoint.BeatLength / beatDivisor.Value;
|
||||
|
||||
changeHandler.BeginChange();
|
||||
changeHandler?.BeginChange();
|
||||
|
||||
int i = 0;
|
||||
double time = HitObject.StartTime;
|
||||
@ -292,7 +292,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
editorBeatmap.Remove(HitObject);
|
||||
|
||||
changeHandler.EndChange();
|
||||
changeHandler?.EndChange();
|
||||
}
|
||||
|
||||
public override MenuItem[] ContextMenuItems => new MenuItem[]
|
||||
|
@ -6,8 +6,11 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
@ -15,6 +18,7 @@ using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
@ -53,6 +57,17 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
referencePathTypes = null;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.Key == Key.M && e.ControlPressed && e.ShiftPressed)
|
||||
{
|
||||
mergeSelection();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandleMovement(MoveSelectionEvent<HitObject> moveEvent)
|
||||
{
|
||||
var hitObjects = selectedMovableObjects;
|
||||
@ -320,7 +335,109 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
/// All osu! hitobjects which can be moved/rotated/scaled.
|
||||
/// </summary>
|
||||
private OsuHitObject[] selectedMovableObjects => SelectedItems.OfType<OsuHitObject>()
|
||||
.Where(h => !(h is Spinner))
|
||||
.Where(h => h is not Spinner)
|
||||
.ToArray();
|
||||
|
||||
/// <summary>
|
||||
/// All osu! hitobjects which can be merged.
|
||||
/// </summary>
|
||||
private OsuHitObject[] selectedMergeableObjects => SelectedItems.OfType<OsuHitObject>()
|
||||
.Where(h => h is HitCircle or Slider)
|
||||
.OrderBy(h => h.StartTime)
|
||||
.ToArray();
|
||||
|
||||
private void mergeSelection()
|
||||
{
|
||||
var mergeableObjects = selectedMergeableObjects;
|
||||
|
||||
if (mergeableObjects.Length < 2)
|
||||
return;
|
||||
|
||||
ChangeHandler?.BeginChange();
|
||||
|
||||
// Have an initial slider object.
|
||||
var firstHitObject = mergeableObjects[0];
|
||||
var mergedHitObject = firstHitObject as Slider ?? new Slider
|
||||
{
|
||||
StartTime = firstHitObject.StartTime,
|
||||
Position = firstHitObject.Position,
|
||||
NewCombo = firstHitObject.NewCombo,
|
||||
SampleControlPoint = firstHitObject.SampleControlPoint,
|
||||
};
|
||||
|
||||
if (mergedHitObject.Path.ControlPoints.Count == 0)
|
||||
{
|
||||
mergedHitObject.Path.ControlPoints.Add(new PathControlPoint(Vector2.Zero, PathType.Linear));
|
||||
}
|
||||
|
||||
// Merge all the selected hit objects into one slider path.
|
||||
bool lastCircle = firstHitObject is HitCircle;
|
||||
|
||||
foreach (var selectedMergeableObject in mergeableObjects.Skip(1))
|
||||
{
|
||||
if (selectedMergeableObject is IHasPath hasPath)
|
||||
{
|
||||
var offset = lastCircle ? selectedMergeableObject.Position - mergedHitObject.Position : mergedHitObject.Path.ControlPoints[^1].Position;
|
||||
float distanceToLastControlPoint = Vector2.Distance(mergedHitObject.Path.ControlPoints[^1].Position, offset);
|
||||
|
||||
// Calculate the distance required to travel to the expected distance of the merging slider.
|
||||
mergedHitObject.Path.ExpectedDistance.Value = mergedHitObject.Path.CalculatedDistance + distanceToLastControlPoint + hasPath.Path.Distance;
|
||||
|
||||
// Remove the last control point if it sits exactly on the start of the next control point.
|
||||
if (Precision.AlmostEquals(distanceToLastControlPoint, 0))
|
||||
{
|
||||
mergedHitObject.Path.ControlPoints.RemoveAt(mergedHitObject.Path.ControlPoints.Count - 1);
|
||||
}
|
||||
|
||||
mergedHitObject.Path.ControlPoints.AddRange(hasPath.Path.ControlPoints.Select(o => new PathControlPoint(o.Position + offset, o.Type)));
|
||||
lastCircle = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Turn the last control point into a linear type if this is the first merging circle in a sequence, so the subsequent control points can be inherited path type.
|
||||
if (!lastCircle)
|
||||
{
|
||||
mergedHitObject.Path.ControlPoints.Last().Type = PathType.Linear;
|
||||
}
|
||||
|
||||
mergedHitObject.Path.ControlPoints.Add(new PathControlPoint(selectedMergeableObject.Position - mergedHitObject.Position));
|
||||
mergedHitObject.Path.ExpectedDistance.Value = null;
|
||||
lastCircle = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure only the merged hit object is in the beatmap.
|
||||
if (firstHitObject is Slider)
|
||||
{
|
||||
foreach (var selectedMergeableObject in mergeableObjects.Skip(1))
|
||||
{
|
||||
EditorBeatmap.Remove(selectedMergeableObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var selectedMergeableObject in mergeableObjects)
|
||||
{
|
||||
EditorBeatmap.Remove(selectedMergeableObject);
|
||||
}
|
||||
|
||||
EditorBeatmap.Add(mergedHitObject);
|
||||
}
|
||||
|
||||
// Make sure the merged hitobject is selected.
|
||||
SelectedItems.Clear();
|
||||
SelectedItems.Add(mergedHitObject);
|
||||
|
||||
ChangeHandler?.EndChange();
|
||||
}
|
||||
|
||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<HitObject>> selection)
|
||||
{
|
||||
foreach (var item in base.GetContextMenuItemsForSelection(selection))
|
||||
yield return item;
|
||||
|
||||
if (selectedMergeableObjects.Length > 1)
|
||||
yield return new OsuMenuItem("Merge selection", MenuItemType.Destructive, mergeSelection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Setup
|
||||
private void updateBeatmap()
|
||||
{
|
||||
Beatmap.BeatmapInfo.StackLeniency = stackLeniency.Current.Value;
|
||||
Beatmap.SaveState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
using osu.Game.Utils;
|
||||
using osuTK.Input;
|
||||
using SkipOverlay = osu.Game.Screens.Play.SkipOverlay;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -56,6 +57,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private readonly ChangelogOverlay changelogOverlay;
|
||||
|
||||
private double savedTrackVolume;
|
||||
private double savedMasterVolume;
|
||||
private bool savedMutedState;
|
||||
|
||||
public TestScenePlayerLoader()
|
||||
{
|
||||
AddRange(new Drawable[]
|
||||
@ -75,11 +80,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
player = null;
|
||||
audioManager.Volume.SetDefault();
|
||||
});
|
||||
public void Setup() => Schedule(() => player = null);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the input manager child to a new test player loader container instance.
|
||||
@ -98,7 +99,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private void prepareBeatmap()
|
||||
{
|
||||
var workingBeatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||
|
||||
// Add intro time to test quick retry skipping (TestQuickRetry).
|
||||
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
|
||||
|
||||
// Turn on epilepsy warning to test warning display (TestEpilepsyWarning).
|
||||
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
|
||||
|
||||
Beatmap.Value = workingBeatmap;
|
||||
|
||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToTrack>())
|
||||
@ -147,6 +154,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
moveMouse();
|
||||
return player?.LoadState == LoadState.Ready;
|
||||
});
|
||||
|
||||
AddRepeatStep("move mouse", moveMouse, 20);
|
||||
|
||||
AddAssert("loader still active", () => loader.IsCurrentScreen());
|
||||
@ -154,6 +162,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
void moveMouse()
|
||||
{
|
||||
notificationOverlay.State.Value = Visibility.Hidden;
|
||||
|
||||
InputManager.MoveMouseTo(
|
||||
loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft
|
||||
+ (loader.VisualSettings.ScreenSpaceDrawQuad.BottomRight - loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft)
|
||||
@ -274,6 +284,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("load player", () => resetPlayer(false, beforeLoad));
|
||||
AddUntilStep("wait for player", () => player?.LoadState == LoadState.Ready);
|
||||
|
||||
saveVolumes();
|
||||
|
||||
AddAssert("check for notification", () => notificationOverlay.UnreadCount.Value == 1);
|
||||
AddStep("click notification", () =>
|
||||
{
|
||||
@ -287,6 +299,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddAssert("check " + volumeName, assert);
|
||||
|
||||
restoreVolumes();
|
||||
|
||||
AddUntilStep("wait for player load", () => player.IsLoaded);
|
||||
}
|
||||
|
||||
@ -294,6 +308,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestCase(false)]
|
||||
public void TestEpilepsyWarning(bool warning)
|
||||
{
|
||||
saveVolumes();
|
||||
setFullVolume();
|
||||
|
||||
AddStep("change epilepsy warning", () => epilepsyWarning = warning);
|
||||
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||
|
||||
@ -306,6 +323,30 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("sound volume decreased", () => Beatmap.Value.Track.AggregateVolume.Value == 0.25);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
}
|
||||
|
||||
restoreVolumes();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEpilepsyWarningEarlyExit()
|
||||
{
|
||||
saveVolumes();
|
||||
setFullVolume();
|
||||
|
||||
AddStep("set epilepsy warning", () => epilepsyWarning = true);
|
||||
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
||||
|
||||
AddStep("exit early", () => loader.Exit());
|
||||
|
||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
|
||||
restoreVolumes();
|
||||
}
|
||||
|
||||
[TestCase(true, 1.0, false)] // on battery, above cutoff --> no warning
|
||||
@ -336,21 +377,65 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("wait for player load", () => player.IsLoaded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEpilepsyWarningEarlyExit()
|
||||
private void restoreVolumes()
|
||||
{
|
||||
AddStep("set epilepsy warning", () => epilepsyWarning = true);
|
||||
AddStep("restore previous volumes", () =>
|
||||
{
|
||||
audioManager.VolumeTrack.Value = savedTrackVolume;
|
||||
audioManager.Volume.Value = savedMasterVolume;
|
||||
volumeOverlay.IsMuted.Value = savedMutedState;
|
||||
});
|
||||
}
|
||||
|
||||
private void setFullVolume()
|
||||
{
|
||||
AddStep("set volumes to 100%", () =>
|
||||
{
|
||||
audioManager.VolumeTrack.Value = 1;
|
||||
audioManager.Volume.Value = 1;
|
||||
volumeOverlay.IsMuted.Value = false;
|
||||
});
|
||||
}
|
||||
|
||||
private void saveVolumes()
|
||||
{
|
||||
AddStep("save previous volumes", () =>
|
||||
{
|
||||
savedTrackVolume = audioManager.VolumeTrack.Value;
|
||||
savedMasterVolume = audioManager.Volume.Value;
|
||||
savedMutedState = volumeOverlay.IsMuted.Value;
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestQuickRetry()
|
||||
{
|
||||
TestPlayer getCurrentPlayer() => loader.CurrentPlayer as TestPlayer;
|
||||
bool checkSkipButtonVisible() => player.ChildrenOfType<SkipOverlay>().FirstOrDefault()?.IsButtonVisible == true;
|
||||
|
||||
TestPlayer previousPlayer = null;
|
||||
|
||||
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
AddUntilStep("wait for current", () => getCurrentPlayer()?.IsCurrentScreen() == true);
|
||||
AddStep("store previous player", () => previousPlayer = getCurrentPlayer());
|
||||
|
||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
||||
AddStep("Restart map normally", () => getCurrentPlayer().Restart());
|
||||
AddUntilStep("wait for load", () => getCurrentPlayer()?.LoadedBeatmapSuccessfully == true);
|
||||
|
||||
AddStep("exit early", () => loader.Exit());
|
||||
AddUntilStep("restart completed", () => getCurrentPlayer() != null && getCurrentPlayer() != previousPlayer);
|
||||
AddStep("store previous player", () => previousPlayer = getCurrentPlayer());
|
||||
|
||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
AddUntilStep("skip button visible", checkSkipButtonVisible);
|
||||
|
||||
AddStep("press quick retry key", () => InputManager.PressKey(Key.Tilde));
|
||||
AddUntilStep("restart completed", () => getCurrentPlayer() != null && getCurrentPlayer() != previousPlayer);
|
||||
AddStep("release quick retry key", () => InputManager.ReleaseKey(Key.Tilde));
|
||||
|
||||
AddUntilStep("wait for load", () => getCurrentPlayer()?.LoadedBeatmapSuccessfully == true);
|
||||
|
||||
AddUntilStep("time reached zero", () => getCurrentPlayer()?.GameplayClockContainer.CurrentTime > 0);
|
||||
AddUntilStep("skip button not visible", () => !checkSkipButtonVisible());
|
||||
}
|
||||
|
||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault();
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Mods
|
||||
protected override TestPlayer CreateModPlayer(Ruleset ruleset)
|
||||
{
|
||||
var player = base.CreateModPlayer(ruleset);
|
||||
player.RestartRequested = () => restartRequested = true;
|
||||
player.RestartRequested = _ => restartRequested = true;
|
||||
return player;
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,14 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public string OnlineMD5Hash { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The last time of a local modification (via the editor).
|
||||
/// </summary>
|
||||
public DateTimeOffset? LastLocalUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The last time online metadata was applied to this beatmap.
|
||||
/// </summary>
|
||||
public DateTimeOffset? LastOnlineUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -94,6 +94,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
var beatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
DateAdded = DateTimeOffset.UtcNow,
|
||||
Beatmaps =
|
||||
{
|
||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
|
||||
@ -313,6 +314,7 @@ namespace osu.Game.Beatmaps
|
||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
||||
|
||||
beatmapInfo.LastLocalUpdate = DateTimeOffset.Now;
|
||||
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
|
||||
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
||||
|
@ -134,6 +134,6 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// Reads the correct track restart point from beatmap metadata and sets looping to enabled.
|
||||
/// </summary>
|
||||
void PrepareTrackForPreviewLooping();
|
||||
void PrepareTrackForPreview(bool looping);
|
||||
}
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||
|
||||
public void PrepareTrackForPreviewLooping()
|
||||
public void PrepareTrackForPreview(bool looping)
|
||||
{
|
||||
Track.Looping = true;
|
||||
Track.Looping = looping;
|
||||
Track.RestartPoint = Metadata.PreviewTime;
|
||||
|
||||
if (Track.RestartPoint == -1)
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Database
|
||||
|
||||
if (existing != null)
|
||||
{
|
||||
foreach (string newBeatmap in existing.BeatmapMD5Hashes)
|
||||
foreach (string newBeatmap in collection.BeatmapMD5Hashes)
|
||||
{
|
||||
if (!existing.BeatmapMD5Hashes.Contains(newBeatmap))
|
||||
existing.BeatmapMD5Hashes.Add(newBeatmap);
|
||||
|
@ -68,8 +68,9 @@ namespace osu.Game.Database
|
||||
/// 20 2022-07-21 Added LastAppliedDifficultyVersion to RulesetInfo, changed default value of BeatmapInfo.StarRating to -1.
|
||||
/// 21 2022-07-27 Migrate collections to realm (BeatmapCollection).
|
||||
/// 22 2022-07-31 Added ModPreset.
|
||||
/// 23 2022-08-01 Added LastLocalUpdate to BeatmapInfo.
|
||||
/// </summary>
|
||||
private const int schema_version = 22;
|
||||
private const int schema_version = 23;
|
||||
|
||||
/// <summary>
|
||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||
|
@ -24,6 +24,7 @@ using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -233,6 +234,8 @@ namespace osu.Game.Screens.Edit
|
||||
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.GetSkin(), loadableBeatmap.BeatmapInfo));
|
||||
dependencies.CacheAs(editorBeatmap);
|
||||
|
||||
editorBeatmap.UpdateInProgress.BindValueChanged(updateInProgress);
|
||||
|
||||
canSave = editorBeatmap.BeatmapInfo.Ruleset.CreateInstance() is ILegacyRuleset;
|
||||
|
||||
if (canSave)
|
||||
@ -714,6 +717,27 @@ namespace osu.Game.Screens.Edit
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
#region Mute from update application
|
||||
|
||||
private ScheduledDelegate temporaryMuteRestorationDelegate;
|
||||
private bool temporaryMuteFromUpdateInProgress;
|
||||
|
||||
private void updateInProgress(ValueChangedEvent<bool> obj)
|
||||
{
|
||||
temporaryMuteFromUpdateInProgress = true;
|
||||
updateSampleDisabledState();
|
||||
|
||||
// Debounce is arbitrarily high enough to avoid flip-flopping the value each other frame.
|
||||
temporaryMuteRestorationDelegate?.Cancel();
|
||||
temporaryMuteRestorationDelegate = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
temporaryMuteFromUpdateInProgress = false;
|
||||
updateSampleDisabledState();
|
||||
}, 50);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Clipboard support
|
||||
|
||||
private EditorMenuItem cutMenuItem;
|
||||
@ -829,7 +853,9 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private void updateSampleDisabledState()
|
||||
{
|
||||
samplePlaybackDisabled.Value = clock.SeekingOrStopped.Value || !(currentScreen is ComposeScreen);
|
||||
samplePlaybackDisabled.Value = clock.SeekingOrStopped.Value
|
||||
|| currentScreen is not ComposeScreen
|
||||
|| temporaryMuteFromUpdateInProgress;
|
||||
}
|
||||
|
||||
private void seek(UIEvent e, int direction)
|
||||
|
@ -22,6 +22,17 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
public class EditorBeatmap : TransactionalCommitComponent, IBeatmap, IBeatSnapProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Will become <c>true</c> when a new update is queued, and <c>false</c> when all updates have been applied.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is intended to be used to avoid performing operations (like playback of samples)
|
||||
/// while mutating hitobjects.
|
||||
/// </remarks>
|
||||
public IBindable<bool> UpdateInProgress => updateInProgress;
|
||||
|
||||
private readonly BindableBool updateInProgress = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="EditorBeatmap"/>.
|
||||
/// </summary>
|
||||
@ -78,7 +89,10 @@ namespace osu.Game.Screens.Edit
|
||||
this.beatmapInfo = beatmapInfo ?? playableBeatmap.BeatmapInfo;
|
||||
|
||||
if (beatmapSkin is Skin skin)
|
||||
{
|
||||
BeatmapSkin = new EditorBeatmapSkin(skin);
|
||||
BeatmapSkin.BeatmapSkinChanged += SaveState;
|
||||
}
|
||||
|
||||
beatmapProcessor = playableBeatmap.BeatmapInfo.Ruleset.CreateInstance().CreateBeatmapProcessor(PlayableBeatmap);
|
||||
|
||||
@ -225,6 +239,8 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
// updates are debounced regardless of whether a batch is active.
|
||||
batchPendingUpdates.Add(hitObject);
|
||||
|
||||
updateInProgress.Value = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -234,6 +250,8 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
foreach (var h in HitObjects)
|
||||
batchPendingUpdates.Add(h);
|
||||
|
||||
updateInProgress.Value = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -326,6 +344,8 @@ namespace osu.Game.Screens.Edit
|
||||
foreach (var h in deletes) HitObjectRemoved?.Invoke(h);
|
||||
foreach (var h in inserts) HitObjectAdded?.Invoke(h);
|
||||
foreach (var h in updates) HitObjectUpdated?.Invoke(h);
|
||||
|
||||
updateInProgress.Value = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -126,6 +126,8 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
Beatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning.Current.Value;
|
||||
Beatmap.BeatmapInfo.LetterboxInBreaks = letterboxDuringBreaks.Current.Value;
|
||||
Beatmap.BeatmapInfo.SamplesMatchPlaybackRate = samplesMatchPlaybackRate.Current.Value;
|
||||
|
||||
Beatmap.SaveState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
Beatmap.Difficulty.OverallDifficulty = overallDifficultySlider.Current.Value;
|
||||
|
||||
Beatmap.UpdateAllHitObjects();
|
||||
Beatmap.SaveState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
target.Current.Value = value;
|
||||
|
||||
updateReadOnlyState();
|
||||
updateMetadata();
|
||||
Scheduler.AddOnce(updateMetadata);
|
||||
}
|
||||
|
||||
private void updateReadOnlyState()
|
||||
@ -102,7 +102,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
|
||||
// for now, update on commit rather than making BeatmapMetadata bindables.
|
||||
// after switching database engines we can reconsider if switching to bindables is a good direction.
|
||||
updateMetadata();
|
||||
Scheduler.AddOnce(updateMetadata);
|
||||
}
|
||||
|
||||
private void updateMetadata()
|
||||
@ -117,6 +117,8 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
Beatmap.BeatmapInfo.DifficultyName = difficultyTextBox.Current.Value;
|
||||
Beatmap.Metadata.Source = sourceTextBox.Current.Value;
|
||||
Beatmap.Metadata.Tags = tagsTextBox.Current.Value;
|
||||
|
||||
Beatmap.SaveState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,9 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override string BeatmapFile => "circles.osz";
|
||||
|
||||
private const double delay_step_one = 2300;
|
||||
private const double delay_step_two = 600;
|
||||
public const double TRACK_START_DELAY = 600;
|
||||
|
||||
private const double delay_for_menu = 2900;
|
||||
|
||||
private Sample welcome;
|
||||
|
||||
@ -50,8 +51,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
PrepareMenuLoad();
|
||||
|
||||
Scheduler.AddDelayed(LoadMenu, delay_step_one);
|
||||
}, delay_step_two);
|
||||
Scheduler.AddDelayed(LoadMenu, delay_for_menu - TRACK_START_DELAY);
|
||||
}, TRACK_START_DELAY);
|
||||
|
||||
logo.ScaleTo(1);
|
||||
logo.FadeIn();
|
||||
|
@ -272,11 +272,22 @@ namespace osu.Game.Screens.Menu
|
||||
FadeInBackground(200);
|
||||
}
|
||||
|
||||
protected virtual void StartTrack()
|
||||
protected void StartTrack()
|
||||
{
|
||||
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
|
||||
if (UsingThemedIntro)
|
||||
Track.Start();
|
||||
var drawableTrack = musicController.CurrentTrack;
|
||||
|
||||
if (!UsingThemedIntro)
|
||||
{
|
||||
initialBeatmap?.PrepareTrackForPreview(false);
|
||||
|
||||
drawableTrack.VolumeTo(0);
|
||||
drawableTrack.Restart();
|
||||
drawableTrack.VolumeTo(1, 2200, Easing.InCubic);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawableTrack.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||
|
@ -84,9 +84,17 @@ namespace osu.Game.Screens.Menu
|
||||
return;
|
||||
|
||||
if (!UsingThemedIntro)
|
||||
{
|
||||
// If the user has requested no theme, fallback to the same intro voice and delay as IntroCircles.
|
||||
// The triangles intro voice and theme are combined which makes it impossible to use.
|
||||
welcome?.Play();
|
||||
Scheduler.AddDelayed(StartTrack, IntroCircles.TRACK_START_DELAY);
|
||||
}
|
||||
else
|
||||
StartTrack();
|
||||
|
||||
StartTrack();
|
||||
// no-op for the case of themed intro, no harm in calling for both scenarios as a safety measure.
|
||||
decoupledClock.Start();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -99,11 +107,6 @@ namespace osu.Game.Screens.Menu
|
||||
intro.Expire();
|
||||
}
|
||||
|
||||
protected override void StartTrack()
|
||||
{
|
||||
decoupledClock.Start();
|
||||
}
|
||||
|
||||
private class TrianglesIntroSequence : CompositeDrawable
|
||||
{
|
||||
private readonly OsuLogo logo;
|
||||
|
@ -192,7 +192,7 @@ namespace osu.Game.Screens.Menu
|
||||
// presume the track is the current beatmap's track. not sure how correct this assumption is but it has worked until now.
|
||||
if (!track.IsRunning)
|
||||
{
|
||||
Beatmap.Value.PrepareTrackForPreviewLooping();
|
||||
Beatmap.Value.PrepareTrackForPreview(false);
|
||||
track.Restart();
|
||||
}
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
if (track != null)
|
||||
{
|
||||
Beatmap.Value.PrepareTrackForPreviewLooping();
|
||||
Beatmap.Value.PrepareTrackForPreview(true);
|
||||
music?.EnsurePlayingSomething();
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
protected virtual bool PauseOnFocusLost => true;
|
||||
|
||||
public Action RestartRequested;
|
||||
public Action<bool> RestartRequested;
|
||||
|
||||
private bool isRestarting;
|
||||
|
||||
@ -267,7 +267,7 @@ namespace osu.Game.Screens.Play
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
SaveReplay = prepareAndImportScore,
|
||||
OnRetry = Restart,
|
||||
OnRetry = () => Restart(),
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
new HotkeyExitOverlay
|
||||
@ -294,7 +294,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
fadeOut(true);
|
||||
Restart();
|
||||
Restart(true);
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -371,6 +371,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||
IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
|
||||
|
||||
if (Configuration.AutomaticallySkipIntro)
|
||||
skipIntroOverlay.SkipWhenReady();
|
||||
}
|
||||
|
||||
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
||||
@ -441,7 +444,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
OnResume = Resume,
|
||||
Retries = RestartCount,
|
||||
OnRetry = Restart,
|
||||
OnRetry = () => Restart(),
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
},
|
||||
@ -648,7 +651,8 @@ namespace osu.Game.Screens.Play
|
||||
/// Restart gameplay via a parent <see cref="PlayerLoader"/>.
|
||||
/// <remarks>This can be called from a child screen in order to trigger the restart process.</remarks>
|
||||
/// </summary>
|
||||
public void Restart()
|
||||
/// <param name="quickRestart">Whether a quick restart was requested (skipping intro etc.).</param>
|
||||
public void Restart(bool quickRestart = false)
|
||||
{
|
||||
if (!Configuration.AllowRestart)
|
||||
return;
|
||||
@ -660,7 +664,7 @@ namespace osu.Game.Screens.Play
|
||||
musicController.Stop();
|
||||
|
||||
sampleRestart?.Play();
|
||||
RestartRequested?.Invoke();
|
||||
RestartRequested?.Invoke(quickRestart);
|
||||
|
||||
PerformExit(false);
|
||||
}
|
||||
@ -840,7 +844,7 @@ namespace osu.Game.Screens.Play
|
||||
failAnimationLayer.Start();
|
||||
|
||||
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
||||
Restart();
|
||||
Restart(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -31,5 +31,10 @@ namespace osu.Game.Screens.Play
|
||||
/// Whether the player should be allowed to skip intros/outros, advancing to the start of gameplay or the end of a storyboard.
|
||||
/// </summary>
|
||||
public bool AllowSkipping { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the intro should be skipped by default.
|
||||
/// </summary>
|
||||
public bool AutomaticallySkipIntro { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private EpilepsyWarning? epilepsyWarning;
|
||||
|
||||
private bool quickRestart;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private INotificationOverlay? notificationOverlay { get; set; }
|
||||
|
||||
@ -361,6 +363,7 @@ namespace osu.Game.Screens.Play
|
||||
return;
|
||||
|
||||
CurrentPlayer = createPlayer();
|
||||
CurrentPlayer.Configuration.AutomaticallySkipIntro = quickRestart;
|
||||
CurrentPlayer.RestartCount = restartCount++;
|
||||
CurrentPlayer.RestartRequested = restartRequested;
|
||||
|
||||
@ -375,8 +378,9 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
}
|
||||
|
||||
private void restartRequested()
|
||||
private void restartRequested(bool quickRestartRequested)
|
||||
{
|
||||
quickRestart = quickRestartRequested;
|
||||
hideOverlays = true;
|
||||
ValidForResume = true;
|
||||
}
|
||||
|
@ -39,10 +39,13 @@ namespace osu.Game.Screens.Play
|
||||
private double displayTime;
|
||||
|
||||
private bool isClickable;
|
||||
private bool skipQueued;
|
||||
|
||||
[Resolved]
|
||||
private IGameplayClock gameplayClock { get; set; }
|
||||
|
||||
internal bool IsButtonVisible => fadeContainer.State == Visibility.Visible && buttonContainer.State.Value == Visibility.Visible;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
/// <summary>
|
||||
@ -123,6 +126,20 @@ namespace osu.Game.Screens.Play
|
||||
displayTime = gameplayClock.CurrentTime;
|
||||
|
||||
fadeContainer.TriggerShow();
|
||||
|
||||
if (skipQueued)
|
||||
{
|
||||
Scheduler.AddDelayed(() => button.TriggerClick(), 200);
|
||||
skipQueued = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SkipWhenReady()
|
||||
{
|
||||
if (IsLoaded)
|
||||
button.TriggerClick();
|
||||
else
|
||||
skipQueued = true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -177,7 +177,7 @@ namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
player?.Restart();
|
||||
player?.Restart(true);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -683,7 +683,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
private void ensureTrackLooping(IWorkingBeatmap beatmap, TrackChangeDirection changeDirection)
|
||||
=> beatmap.PrepareTrackForPreviewLooping();
|
||||
=> beatmap.PrepareTrackForPreview(true);
|
||||
|
||||
public override bool OnBackButton()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user