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

Merge branch 'master' into feature/EditorDeleteDiff

This commit is contained in:
Salman Ahmed 2022-09-06 18:48:06 +03:00 committed by GitHub
commit 90207b6032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 207 additions and 179 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.831.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.825.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.901.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
public void UpdateFrom(ScrollingHitObjectContainer hitObjectContainer, JuiceStream hitObject)
{
while (path.Vertices.Count < InternalChildren.Count)
RemoveInternal(InternalChildren[^1]);
RemoveInternal(InternalChildren[^1], true);
while (InternalChildren.Count < path.Vertices.Count)
AddInternal(new VertexPiece());

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
.Where(h => !(h is TinyDroplet)));
while (nestedHitObjects.Count < InternalChildren.Count)
RemoveInternal(InternalChildren[^1]);
RemoveInternal(InternalChildren[^1], true);
while (InternalChildren.Count < nestedHitObjects.Count)
AddInternal(new FruitOutline());

View File

@ -271,8 +271,8 @@ namespace osu.Game.Rulesets.Catch.UI
SetHyperDashState();
}
caughtObjectContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject);
droppedObjectTarget.RemoveAll(d => d.HitObject == drawableObject.HitObject);
caughtObjectContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject, false);
droppedObjectTarget.RemoveAll(d => d.HitObject == drawableObject.HitObject, false);
}
/// <summary>
@ -430,7 +430,7 @@ namespace osu.Game.Rulesets.Catch.UI
{
var droppedObject = getDroppedObject(caughtObject);
caughtObjectContainer.Remove(caughtObject);
caughtObjectContainer.Remove(caughtObject, false);
droppedObjectTarget.Add(droppedObject);

View File

@ -93,15 +93,15 @@ namespace osu.Game.Rulesets.Catch.UI
switch (entry.Animation)
{
case CatcherTrailAnimation.Dashing:
dashTrails.Remove(drawable);
dashTrails.Remove(drawable, false);
break;
case CatcherTrailAnimation.HyperDashing:
hyperDashTrails.Remove(drawable);
hyperDashTrails.Remove(drawable, false);
break;
case CatcherTrailAnimation.HyperDashAfterImage:
hyperDashAfterImages.Remove(drawable);
hyperDashAfterImages.Remove(drawable, false);
break;
}
}

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty
private readonly bool isForCurrentRuleset;
private readonly double originalOverallDifficulty;
public override int Version => 20220701;
public override int Version => 20220902;
public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Mods
HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer;
Container hocParent = (Container)hoc.Parent;
hocParent.Remove(hoc);
hocParent.Remove(hoc, false);
hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c =>
{
c.RelativeSizeAxes = Axes.Both;

View File

@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
else
{
lightContainer.FadeOut(120)
.OnComplete(d => Column.TopLevelContainer.Remove(d));
.OnComplete(d => Column.TopLevelContainer.Remove(d, false));
}
}

View File

@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
var drawableObject = getFunc.Invoke();
hitObjectContainer.Remove(drawableObject);
hitObjectContainer.Remove(drawableObject, false);
followPointRenderer.RemoveFollowPoints(drawableObject.HitObject);
});
}
@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Osu.Tests
else
targetTime = getObject(hitObjectContainer.Count - 1).HitObject.StartTime + 1;
hitObjectContainer.Remove(toReorder);
hitObjectContainer.Remove(toReorder, false);
toReorder.HitObject.StartTime = targetTime;
hitObjectContainer.Add(toReorder);
});

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
private const double difficulty_multiplier = 0.0675;
private double hitWindowGreat;
public override int Version => 20220701;
public override int Version => 20220902;
public OsuDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)

View File

@ -89,6 +89,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
HitObject.DifficultyControlPoint = nearestDifficultyPoint ?? new DifficultyControlPoint();
HitObject.Position = ToLocalSpace(result.ScreenSpacePosition);
// Replacing the DifficultyControlPoint above doesn't trigger any kind of invalidation.
// Without re-applying defaults, velocity won't be updated.
ApplyDefaultsToHitObject();
break;
case SliderPlacementState.Body:

View File

@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// This is a bit ugly but we don't have the concept of InternalContent so it'll have to do for now. (https://github.com/ppy/osu-framework/issues/1690)
protected override void AddInternal(Drawable drawable) => shakeContainer.Add(drawable);
protected override void ClearInternal(bool disposeChildren = true) => shakeContainer.Clear(disposeChildren);
protected override bool RemoveInternal(Drawable drawable) => shakeContainer.Remove(drawable);
protected override bool RemoveInternal(Drawable drawable, bool disposeImmediately) => shakeContainer.Remove(drawable, disposeImmediately);
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
{
private const double difficulty_multiplier = 1.35;
public override int Version => 20220701;
public override int Version => 20220902;
public TaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)

View File

@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
isProxied = true;
nonProxiedContent.Remove(Content);
nonProxiedContent.Remove(Content, false);
proxiedContent.Add(Content);
}
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
isProxied = false;
proxiedContent.Remove(Content);
proxiedContent.Remove(Content, false);
nonProxiedContent.Add(Content);
}
@ -141,7 +141,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Size = BaseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);
if (MainPiece != null)
Content.Remove(MainPiece);
Content.Remove(MainPiece, true);
Content.Add(MainPiece = CreateMainPiece());
}

View File

@ -117,6 +117,26 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
}
[Test]
public void TestEarliestStartTimeWithLoopAlphas()
{
var decoder = new LegacyStoryboardDecoder();
using (var resStream = TestResources.OpenResource("loop-containing-earlier-non-zero-fade.osb"))
using (var stream = new LineBufferedReader(resStream))
{
var storyboard = decoder.Decode(stream);
StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3);
Assert.AreEqual(2, background.Elements.Count);
Assert.AreEqual(1000, background.Elements[0].StartTime);
Assert.AreEqual(1000, background.Elements[1].StartTime);
Assert.AreEqual(1000, storyboard.EarliestEventTime);
}
}
[Test]
public void TestDecodeVariableWithSuffix()
{

View File

@ -7,10 +7,12 @@ using System.Linq;
using Moq;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks;
using osu.Game.Rulesets.Objects;
using osu.Game.Tests.Visual;
namespace osu.Game.Tests.Editing.Checks
{
@ -109,7 +111,7 @@ namespace osu.Game.Tests.Editing.Checks
/// <param name="audioBitrate">The bitrate of the audio file the beatmap uses.</param>
private Mock<IWorkingBeatmap> getMockWorkingBeatmap(int? audioBitrate)
{
var mockTrack = new Mock<Track>();
var mockTrack = new Mock<OsuTestScene.ClockBackedTestWorkingBeatmap.TrackVirtualManual>(new FramedClock(), "virtual");
mockTrack.SetupGet(t => t.Bitrate).Returns(audioBitrate);
var mockWorkingBeatmap = new Mock<IWorkingBeatmap>();

View File

@ -0,0 +1,14 @@
osu file format v14
[Events]
//Storyboard Layer 0 (Background)
Sprite,Background,TopCentre,"img.jpg",320,240
L,1000,1
F,0,0,,1 // fade inside a loop with non-zero alpha and an earlier start time should be the true start time..
F,0,2000,,0 // ..not a zero alpha fade with a later start time
Sprite,Background,TopCentre,"img.jpg",320,240
L,2000,1
F,0,0,24,0 // fade inside a loop with zero alpha but later start time than the top-level zero alpha start time.
F,0,24,48,1
F,0,1000,,1 // ..so this should be the true start time

View File

@ -171,7 +171,7 @@ namespace osu.Game.Tests.Visual.Background
=> AddStep("create loader", () =>
{
if (backgroundLoader != null)
Remove(backgroundLoader);
Remove(backgroundLoader, true);
Add(backgroundLoader = new SeasonalBackgroundLoader());
});

View File

@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual.Gameplay
Add(expectedComponentsAdjustmentContainer);
expectedComponentsAdjustmentContainer.UpdateSubTree();
var expectedInfo = expectedComponentsContainer.CreateSkinnableInfo();
Remove(expectedComponentsAdjustmentContainer);
Remove(expectedComponentsAdjustmentContainer, true);
return almostEqual(actualInfo, expectedInfo);
}

View File

@ -66,18 +66,20 @@ namespace osu.Game.Tests.Visual.Gameplay
[TestCase(-10000, -10000, true)]
public void TestStoryboardProducesCorrectStartTimeFadeInAfterOtherEvents(double firstStoryboardEvent, double expectedStartTime, bool addEventToLoop)
{
const double loop_start_time = -20000;
var storyboard = new Storyboard();
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
// these should be ignored as we have an alpha visibility blocker proceeding this command.
sprite.TimelineGroup.Scale.Add(Easing.None, -20000, -18000, 0, 1);
var loopGroup = sprite.AddLoop(-20000, 50);
loopGroup.Scale.Add(Easing.None, -20000, -18000, 0, 1);
sprite.TimelineGroup.Scale.Add(Easing.None, loop_start_time, -18000, 0, 1);
var loopGroup = sprite.AddLoop(loop_start_time, 50);
loopGroup.Scale.Add(Easing.None, loop_start_time, -18000, 0, 1);
var target = addEventToLoop ? loopGroup : sprite.TimelineGroup;
double targetTime = addEventToLoop ? 20000 : 0;
target.Alpha.Add(Easing.None, targetTime + firstStoryboardEvent, targetTime + firstStoryboardEvent + 500, 0, 1);
double loopRelativeOffset = addEventToLoop ? -loop_start_time : 0;
target.Alpha.Add(Easing.None, loopRelativeOffset + firstStoryboardEvent, loopRelativeOffset + firstStoryboardEvent + 500, 0, 1);
// these should be ignored due to being in the future.
sprite.TimelineGroup.Alpha.Add(Easing.None, 18000, 20000, 0, 1);

View File

@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
base.TearDownSteps();
AddStep("stop watching user", () => spectatorClient.StopWatchingUser(dummy_user_id));
AddStep("remove test spectator client", () => Remove(spectatorClient));
AddStep("remove test spectator client", () => Remove(spectatorClient, false));
}
}
}

View File

@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private void loadStoryboard(IWorkingBeatmap working)
{
if (storyboard != null)
storyboardContainer.Remove(storyboard);
storyboardContainer.Remove(storyboard, true);
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
storyboardContainer.Clock = decoupledClock;
@ -106,7 +106,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private void loadStoryboardNoVideo()
{
if (storyboard != null)
storyboardContainer.Remove(storyboard);
storyboardContainer.Remove(storyboard, true);
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
storyboardContainer.Clock = decoupledClock;

View File

@ -62,8 +62,8 @@ namespace osu.Game.Tests.Visual.Menus
[SetUp]
public void SetUp() => Schedule(() =>
{
Remove(nowPlayingOverlay);
Remove(volumeOverlay);
Remove(nowPlayingOverlay, false);
Remove(volumeOverlay, false);
Children = new Drawable[]
{

View File

@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("force save config", () => Game.LocalConfig.Save());
AddStep("remove game", () => Remove(Game));
AddStep("remove game", () => Remove(Game, true));
AddStep("create game again", CreateGame);

View File

@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.Online
{
if (selected.Text == mod.Acronym)
{
selectedMods.Remove(selected);
selectedMods.Remove(selected, true);
break;
}
}

View File

@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.SongSelect
OsuLogo logo = new OsuLogo { Scale = new Vector2(0.15f) };
Remove(testDifficultyCache);
Remove(testDifficultyCache, false);
Children = new Drawable[]
{

View File

@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.UserInterface
private void removeFacade()
{
trackingContainer.Remove(logoFacade);
trackingContainer.Remove(logoFacade, false);
visualBox.Colour = Color4.White;
moveLogoFacade();
}

View File

@ -53,7 +53,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("setup screen", () =>
{
Remove(chat);
Remove(chat, false);
Children = new Drawable[]
{

View File

@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
{
allTeams.RemoveAll(gt => gt.Team == team);
if (teams.RemoveAll(gt => gt.Team == team) > 0)
if (teams.RemoveAll(gt => gt.Team == team, true) > 0)
{
TeamsCount--;
return true;

View File

@ -170,7 +170,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
availableTeams.Add(team);
RemoveAll(c => c is ScrollingTeam);
RemoveAll(c => c is ScrollingTeam, true);
setScrollState(ScrollState.Idle);
}
@ -186,7 +186,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
public void ClearTeams()
{
availableTeams.Clear();
RemoveAll(c => c is ScrollingTeam);
RemoveAll(c => c is ScrollingTeam, true);
setScrollState(ScrollState.Idle);
}

View File

@ -57,7 +57,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
if (allLines.Count == 0)
return;
Remove(allLines.First());
Remove(allLines.First(), true);
allLines.Remove(allLines.First());
}

View File

@ -106,7 +106,7 @@ namespace osu.Game.Tournament.Screens.Editors
break;
case NotifyCollectionChangedAction.Remove:
args.OldItems.Cast<TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i));
args.OldItems.Cast<TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i, true));
break;
}
};

View File

@ -108,47 +108,42 @@ namespace osu.Game.Database
bool isBatchImport = tasks.Length >= minimum_items_considered_batch_import;
try
await Task.WhenAll(tasks.Select(async task =>
{
await Task.WhenAll(tasks.Select(async task =>
if (notification.CancellationToken.IsCancellationRequested)
return;
try
{
notification.CancellationToken.ThrowIfCancellationRequested();
var model = await Import(task, isBatchImport, notification.CancellationToken).ConfigureAwait(false);
try
lock (imported)
{
var model = await Import(task, isBatchImport, notification.CancellationToken).ConfigureAwait(false);
if (model != null)
imported.Add(model);
current++;
lock (imported)
{
if (model != null)
imported.Add(model);
current++;
notification.Text = $"Imported {current} of {tasks.Length} {HumanisedModelName}s";
notification.Progress = (float)current / tasks.Length;
}
}
catch (OperationCanceledException)
{
}
catch (Exception e)
{
Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database);
}
})).ConfigureAwait(false);
notification.Text = $"Imported {current} of {tasks.Length} {HumanisedModelName}s";
notification.Progress = (float)current / tasks.Length;
}
}
catch (TaskCanceledException)
{
throw;
}
catch (Exception e)
{
Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database);
}
})).ConfigureAwait(false);
}
catch (OperationCanceledException)
if (imported.Count == 0)
{
if (imported.Count == 0)
if (notification.CancellationToken.IsCancellationRequested)
{
notification.State = ProgressNotificationState.Cancelled;
return imported;
}
}
if (imported.Count == 0)
{
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import failed!";
notification.State = ProgressNotificationState.Cancelled;
}

View File

@ -57,7 +57,7 @@ namespace osu.Game.Graphics.Backgrounds
{
if (bufferedContainer == null && newBlurSigma != Vector2.Zero)
{
RemoveInternal(Sprite);
RemoveInternal(Sprite, false);
AddInternal(bufferedContainer = new BufferedContainer(cachedFrameBuffer: true)
{

View File

@ -35,7 +35,7 @@ namespace osu.Game.Graphics.Containers
if (value == expandableHeader) return;
if (expandableHeader != null)
RemoveInternal(expandableHeader);
RemoveInternal(expandableHeader, false);
expandableHeader = value;
@ -55,6 +55,7 @@ namespace osu.Game.Graphics.Containers
fixedHeader?.Expire();
fixedHeader = value;
if (value == null) return;
AddInternal(fixedHeader);
@ -70,8 +71,10 @@ namespace osu.Game.Graphics.Containers
if (value == footer) return;
if (footer != null)
scrollContainer.Remove(footer);
scrollContainer.Remove(footer, false);
footer = value;
if (value == null) return;
footer.Anchor |= Anchor.y2;

View File

@ -59,7 +59,7 @@ namespace osu.Game.Graphics.Containers
drawable.StateChanged += state => selectionChanged(drawable, state);
}
public override bool Remove(T drawable)
public override bool Remove(T drawable, bool disposeImmediately)
=> throw new NotSupportedException($"Cannot remove drawables from {nameof(SelectionCycleFillFlowContainer<T>)}");
private void setSelected(int? value)

View File

@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface
}
//I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards
RemoveRange(Children.Where((_, index) => index >= value.Count()).ToList());
RemoveRange(Children.Where((_, index) => index >= value.Count()).ToList(), true);
}
}
}

View File

@ -283,7 +283,7 @@ namespace osu.Game.Graphics.UserInterface
return samples[RNG.Next(0, samples.Length)]?.GetChannel();
}
private void playSample(FeedbackSampleType feedbackSample)
private void playSample(FeedbackSampleType feedbackSample) => Schedule(() =>
{
if (Time.Current < sampleLastPlaybackTime + 15) return;
@ -300,7 +300,7 @@ namespace osu.Game.Graphics.UserInterface
channel.Play();
sampleLastPlaybackTime = Time.Current;
}
});
private class OsuCaret : Caret
{

View File

@ -64,8 +64,8 @@ namespace osu.Game.Graphics.UserInterface
X = value.HasFlagFast(Anchor.x2) ? SIZE_RETRACTED.X * shear.X * 0.5f : 0;
Remove(c1);
Remove(c2);
Remove(c1, false);
Remove(c2, false);
c1.Depth = value.HasFlagFast(Anchor.x2) ? 0 : 1;
c2.Depth = value.HasFlagFast(Anchor.x2) ? 1 : 0;
Add(c1);

View File

@ -18,9 +18,6 @@ namespace osu.Game.Online.API.Requests.Responses
[Serializable]
public class SoloScoreInfo : IHasOnlineID<long>
{
[JsonProperty("has_replay")]
public bool HasReplay { get; set; }
[JsonProperty("beatmap_id")]
public int BeatmapID { get; set; }
@ -114,12 +111,16 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty("pp")]
public double? PP { get; set; }
[JsonProperty("has_replay")]
public bool HasReplay { get; set; }
public bool ShouldSerializeID() => false;
public bool ShouldSerializeUser() => false;
public bool ShouldSerializeBeatmap() => false;
public bool ShouldSerializeBeatmapSet() => false;
public bool ShouldSerializePP() => false;
public bool ShouldSerializeOnlineID() => false;
public bool ShouldSerializeHasReplay() => false;
#endregion

View File

@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
FillFlowContainer<ChannelListItem> flow = getFlowForChannel(channel);
channelMap.Remove(channel);
flow.Remove(item);
flow.Remove(item, true);
updateVisibility();
}

View File

@ -181,7 +181,7 @@ namespace osu.Game.Overlays.Chat
{
Trace.Assert(updated.Id.HasValue, "An updated message was returned with no ID.");
ChatLineFlow.Remove(found);
ChatLineFlow.Remove(found, false);
found.Message = updated;
ChatLineFlow.Add(found);
}

View File

@ -126,13 +126,13 @@ namespace osu.Game.Overlays
Debug.Assert(notification.Parent == toastFlow);
// Temporarily remove from flow so we can animate the position off to the right.
toastFlow.Remove(notification);
toastFlow.Remove(notification, false);
AddInternal(notification);
notification.MoveToOffset(new Vector2(400, 0), NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint);
notification.FadeOut(NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint).OnComplete(_ =>
{
RemoveInternal(notification);
RemoveInternal(notification, false);
ForwardNotificationToPermanentStore?.Invoke(notification);
notification.FadeIn(300, Easing.OutQuint);

View File

@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Judgements
// sub-classes might have added their own children that would be removed here if .InternalChild was used.
if (JudgementBody != null)
RemoveInternal(JudgementBody);
RemoveInternal(JudgementBody, true);
AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ =>
CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling)

View File

@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Objects.Pooling
/// <remarks>
/// Invoked when the entry became dead.
/// </remarks>
protected virtual void RemoveDrawable(TEntry entry, TDrawable drawable) => RemoveInternal(drawable);
protected virtual void RemoveDrawable(TEntry entry, TDrawable drawable) => RemoveInternal(drawable, false);
private void entryCrossedBoundary(LifetimeEntry lifetimeEntry, LifetimeBoundaryKind kind, LifetimeBoundaryCrossingDirection direction)
{

View File

@ -124,7 +124,7 @@ namespace osu.Game.Rulesets.UI
unbindStartTime(drawable);
RemoveInternal(drawable);
RemoveInternal(drawable, false);
}
#endregion

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.UI
// remove any existing judgements for the judged object.
// this can be the case when rewinding.
RemoveAll(c => c.JudgedObject == judgement.JudgedObject);
RemoveAll(c => c.JudgedObject == judgement.JudgedObject, false);
base.Add(judgement);
}

View File

@ -292,7 +292,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
blueprint.Selected -= OnBlueprintSelected;
blueprint.Deselected -= OnBlueprintDeselected;
SelectionBlueprints.Remove(blueprint);
SelectionBlueprints.Remove(blueprint, true);
if (movementBlueprints?.Contains(blueprint) == true)
finishSelectionMovement();

View File

@ -35,10 +35,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
base.Add(drawable);
}
public override bool Remove(SelectionBlueprint<HitObject> drawable)
public override bool Remove(SelectionBlueprint<HitObject> drawable, bool disposeImmediately)
{
SortInternal();
return base.Remove(drawable);
return base.Remove(drawable, disposeImmediately);
}
protected override int Compare(Drawable x, Drawable y)

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
if (placementBlueprint != null)
{
SelectionBlueprints.Remove(placementBlueprint);
SelectionBlueprints.Remove(placementBlueprint, true);
placementBlueprint = null;
}
}

View File

@ -1,8 +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.
#nullable disable
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -33,19 +31,19 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
private const float circle_size = 38;
private Container repeatsContainer;
private Container? repeatsContainer;
public Action<DragEvent> OnDragHandled;
public Action<DragEvent?>? OnDragHandled = null!;
[UsedImplicitly]
private readonly Bindable<double> startTime;
private Bindable<int> indexInCurrentComboBindable;
private Bindable<int>? indexInCurrentComboBindable;
private Bindable<int> comboIndexBindable;
private Bindable<int> comboIndexWithOffsetsBindable;
private Bindable<int>? comboIndexBindable;
private Bindable<int>? comboIndexWithOffsetsBindable;
private Bindable<Color4> displayColourBindable;
private Bindable<Color4> displayColourBindable = null!;
private readonly ExtendableCircle circle;
private readonly Border border;
@ -54,7 +52,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly OsuSpriteText comboIndexText;
[Resolved]
private ISkinSource skin { get; set; }
private ISkinSource skin { get; set; } = null!;
public TimelineHitObjectBlueprint(HitObject item)
: base(item)
@ -124,7 +122,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
case IHasComboInformation comboInfo:
indexInCurrentComboBindable = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
indexInCurrentComboBindable.BindValueChanged(_ => updateComboIndex(), true);
indexInCurrentComboBindable.BindValueChanged(_ =>
{
comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
}, true);
comboIndexBindable = comboInfo.ComboIndexBindable.GetBoundCopy();
comboIndexWithOffsetsBindable = comboInfo.ComboIndexWithOffsetsBindable.GetBoundCopy();
@ -149,8 +150,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
updateColour();
}
private void updateComboIndex() => comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
private void updateColour()
{
Color4 colour;
@ -183,11 +182,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
colouredComponents.Colour = OsuColour.ForegroundTextColourFor(averageColour);
}
private SamplePointPiece sampleOverrideDisplay;
private DifficultyPointPiece difficultyOverrideDisplay;
private SamplePointPiece? sampleOverrideDisplay;
private DifficultyPointPiece? difficultyOverrideDisplay;
private DifficultyControlPoint difficultyControlPoint;
private SampleControlPoint sampleControlPoint;
private DifficultyControlPoint difficultyControlPoint = null!;
private SampleControlPoint sampleControlPoint = null!;
protected override void Update()
{
@ -276,16 +275,27 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public class DragArea : Circle
{
private readonly HitObject hitObject;
private readonly HitObject? hitObject;
[Resolved]
private Timeline timeline { get; set; }
private EditorBeatmap beatmap { get; set; } = null!;
public Action<DragEvent> OnDragHandled;
[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; } = null!;
[Resolved]
private Timeline timeline { get; set; } = null!;
[Resolved(CanBeNull = true)]
private IEditorChangeHandler? changeHandler { get; set; }
private ScheduledDelegate? dragOperation;
public Action<DragEvent?>? OnDragHandled;
public override bool HandlePositionalInput => hitObject != null;
public DragArea(HitObject hitObject)
public DragArea(HitObject? hitObject)
{
this.hitObject = hitObject;
@ -356,23 +366,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
this.FadeTo(IsHovered || hasMouseDown ? 1f : 0.9f, 200, Easing.OutQuint);
}
[Resolved]
private EditorBeatmap beatmap { get; set; }
[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; }
[Resolved(CanBeNull = true)]
private IEditorChangeHandler changeHandler { get; set; }
protected override bool OnDragStart(DragStartEvent e)
{
changeHandler?.BeginChange();
return true;
}
private ScheduledDelegate dragOperation;
protected override void OnDrag(DragEvent e)
{
base.OnDrag(e);

View File

@ -255,8 +255,7 @@ namespace osu.Game.Screens.Menu
{
lazerLogo.FadeOut().OnComplete(_ =>
{
logoContainerSecondary.Remove(lazerLogo);
lazerLogo.Dispose(); // explicit disposal as we are pushing a new screen and the expire may not get run.
logoContainerSecondary.Remove(lazerLogo, true);
logo.FadeIn();

View File

@ -232,7 +232,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private void removeUser(APIUser user)
{
avatarFlow.RemoveAll(a => a.User == user);
avatarFlow.RemoveAll(a => a.User == user, true);
}
private void clearUsers()
@ -250,7 +250,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
hiddenUsers.Count = hiddenCount;
if (displayedCircles > NumberOfCircles)
avatarFlow.Remove(avatarFlow.Last());
avatarFlow.Remove(avatarFlow.Last(), true);
else if (displayedCircles < NumberOfCircles)
{
var nextUser = RecentParticipants.FirstOrDefault(u => avatarFlow.All(a => a.User != u));

View File

@ -138,7 +138,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
foreach (var r in rooms)
{
roomFlow.RemoveAll(d => d.Room == r);
roomFlow.RemoveAll(d => d.Room == r, true);
// selection may have a lease due to being in a sub screen.
if (!SelectedRoom.Disabled)

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
roomAccessTypeDropdown.Current.BindValueChanged(_ => UpdateFilter());
return base.CreateFilterControls().Prepend(roomAccessTypeDropdown);
return base.CreateFilterControls().Append(roomAccessTypeDropdown);
}
protected override FilterCriteria CreateFilterCriteria()

View File

@ -166,8 +166,7 @@ namespace osu.Game.Screens.Play
if (filters.Parent == null)
return;
RemoveInternal(filters);
filters.Dispose();
RemoveInternal(filters, true);
}
protected override void Update()

View File

@ -317,7 +317,7 @@ namespace osu.Game.Screens.Ranking
var screenSpacePos = detachedPanel.ScreenSpaceDrawQuad.TopLeft;
// Remove from the local container and re-attach.
detachedPanelContainer.Remove(detachedPanel);
detachedPanelContainer.Remove(detachedPanel, false);
ScorePanelList.Attach(detachedPanel);
// Move into its original location in the attached container first, then to the final location.

View File

@ -34,7 +34,7 @@ namespace osu.Game.Screens.Ranking
if (InternalChildren.Count == 0)
throw new InvalidOperationException("Score panel container is not attached.");
RemoveInternal(Panel);
RemoveInternal(Panel, false);
}
/// <summary>

View File

@ -151,7 +151,7 @@ namespace osu.Game.Skinning
bool wasPlaying = IsPlaying;
// Remove all pooled samples (return them to the pool), and dispose the rest.
samplesContainer.RemoveAll(s => s.IsInPool);
samplesContainer.RemoveAll(s => s.IsInPool, false);
samplesContainer.Clear();
foreach (var s in samples)

View File

@ -85,7 +85,7 @@ namespace osu.Game.Skinning
if (!(component is Drawable drawable))
throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component));
content.Remove(drawable);
content.Remove(drawable, true);
components.Remove(component);
}

View File

@ -47,30 +47,11 @@ namespace osu.Game.Storyboards
};
}
/// <summary>
/// Returns the earliest visible time. Will be null unless this group's first <see cref="Alpha"/> command has a start value of zero.
/// </summary>
public double? EarliestDisplayedTime
{
get
{
var first = Alpha.Commands.FirstOrDefault();
return first?.StartValue == 0 ? first.StartTime : null;
}
}
[JsonIgnore]
public double CommandsStartTime
{
get
{
// if the first alpha command starts at zero it should be given priority over anything else.
// this is due to it creating a state where the target is not present before that time, causing any other events to not be visible.
double? earliestDisplay = EarliestDisplayedTime;
if (earliestDisplay != null)
return earliestDisplay.Value;
double min = double.MaxValue;
for (int i = 0; i < timelines.Length; i++)

View File

@ -30,24 +30,35 @@ namespace osu.Game.Storyboards
{
get
{
// check for presence affecting commands as an initial pass.
double earliestStartTime = TimelineGroup.EarliestDisplayedTime ?? double.MaxValue;
// To get the initial start time, we need to check whether the first alpha command to exist (across all loops) has a StartValue of zero.
// A StartValue of zero governs, above all else, the first valid display time of a sprite.
//
// You can imagine that the first command of each type decides that type's start value, so if the initial alpha is zero,
// anything before that point can be ignored (the sprite is not visible after all).
var alphaCommands = new List<(double startTime, bool isZeroStartValue)>();
foreach (var l in loops)
var command = TimelineGroup.Alpha.Commands.FirstOrDefault();
if (command != null) alphaCommands.Add((command.StartTime, command.StartValue == 0));
foreach (var loop in loops)
{
if (l.EarliestDisplayedTime is double loopEarliestDisplayTime)
earliestStartTime = Math.Min(earliestStartTime, l.LoopStartTime + loopEarliestDisplayTime);
command = loop.Alpha.Commands.FirstOrDefault();
if (command != null) alphaCommands.Add((command.StartTime + loop.LoopStartTime, command.StartValue == 0));
}
if (earliestStartTime < double.MaxValue)
return earliestStartTime;
if (alphaCommands.Count > 0)
{
var firstAlpha = alphaCommands.OrderBy(t => t.startTime).First();
// if an alpha-affecting command was not found, use the earliest of any command.
earliestStartTime = TimelineGroup.StartTime;
if (firstAlpha.isZeroStartValue)
return firstAlpha.startTime;
}
// If we got to this point, either no alpha commands were present, or the earliest had a non-zero start value.
// The sprite's StartTime will be determined by the earliest command, regardless of type.
double earliestStartTime = TimelineGroup.StartTime;
foreach (var l in loops)
earliestStartTime = Math.Min(earliestStartTime, l.StartTime);
return earliestStartTime;
}
}

View File

@ -58,10 +58,7 @@ namespace osu.Game.Tests.Visual
AddStep("Create new game instance", () =>
{
if (Game?.Parent != null)
{
Remove(Game);
Game.Dispose();
}
Remove(Game, true);
RecycleLocalStorage(false);

View File

@ -404,9 +404,9 @@ namespace osu.Game.Tests.Visual
public IEnumerable<string> GetAvailableResources() => throw new NotImplementedException();
public Track GetVirtual(double length = double.PositiveInfinity)
public Track GetVirtual(double length = double.PositiveInfinity, string name = "virtual")
{
var track = new TrackVirtualManual(referenceClock) { Length = length };
var track = new TrackVirtualManual(referenceClock, name) { Length = length };
AddItem(track);
return track;
}
@ -421,7 +421,8 @@ namespace osu.Game.Tests.Visual
private bool running;
public TrackVirtualManual(IFrameBasedClock referenceClock)
public TrackVirtualManual(IFrameBasedClock referenceClock, string name = "virtual")
: base(name)
{
this.referenceClock = referenceClock;
Length = double.PositiveInfinity;

View File

@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual
protected void ResetPlacement()
{
if (CurrentBlueprint != null)
Remove(CurrentBlueprint);
Remove(CurrentBlueprint, true);
Add(CurrentBlueprint = CreateBlueprint());
}

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="10.15.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.825.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.901.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.831.0" />
<PackageReference Include="Sentry" Version="3.20.1" />
<PackageReference Include="SharpCompress" Version="0.32.2" />

View File

@ -61,7 +61,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.825.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.901.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.831.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
@ -84,7 +84,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.825.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.901.0" />
<PackageReference Include="SharpCompress" Version="0.32.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />