Skip to content

Commit

Permalink
Merge branch 'master' into remove-dispose-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Sep 1, 2022
2 parents 105aa01 + e1e46ad commit 6a35b23
Show file tree
Hide file tree
Showing 111 changed files with 1,628 additions and 868 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@ public Icon(char c)
};
}
}

// Leave this line intact. It will bake the correct version into the ruleset on each build/release.
public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) =
};

public override Drawable CreateIcon() => new PippidonRulesetIcon(this);

// Leave this line intact. It will bake the correct version into the ruleset on each build/release.
public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) =
Text = ShortName[0].ToString(),
Font = OsuFont.Default.With(size: 18),
};

// Leave this line intact. It will bake the correct version into the ruleset on each build/release.
public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) =
};

public override Drawable CreateIcon() => new PippidonRulesetIcon(this);

// Leave this line intact. It will bake the correct version into the ruleset on each build/release.
public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;
}
}
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.819.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.831.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.825.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop/Security/ElevatedPrivilegesChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ElevatedPrivilegesNotification()
private void load(OsuColour colours)
{
Icon = FontAwesome.Solid.ShieldAlt;
IconBackground.Colour = colours.YellowDark;
IconContent.Colour = colours.YellowDark;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,17 @@ private class EditorBeatmapDependencyContainer : Container
[Cached]
private readonly BindableBeatDivisor beatDivisor;

protected override Container<Drawable> Content { get; } = new Container { RelativeSizeAxes = Axes.Both };

public EditorBeatmapDependencyContainer(IBeatmap beatmap, BindableBeatDivisor beatDivisor)
{
editorClock = new EditorClock(beatmap, beatDivisor);
this.beatDivisor = beatDivisor;

InternalChildren = new Drawable[]
{
editorClock = new EditorClock(beatmap, beatDivisor),
Content,
};
}
}
}
Expand Down
30 changes: 16 additions & 14 deletions osu.Game.Rulesets.Catch/CatchRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@

#nullable disable

using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Catch.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Graphics;
using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Catch.Difficulty;
using osu.Game.Rulesets.Catch.Scoring;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Scoring;
using System;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Catch.Edit;
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Replays;
using osu.Game.Rulesets.Catch.Scoring;
using osu.Game.Rulesets.Catch.Skinning.Legacy;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Catch
Expand All @@ -43,6 +43,8 @@ public class CatchRuleset : Ruleset, ILegacyRuleset

public const string SHORT_NAME = "fruits";

public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;

public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{
new KeyBinding(InputKey.Z, CatchAction.MoveLeft),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Database;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
Expand All @@ -34,10 +35,14 @@ public void SetUpSteps()
{
AddStep("setup compose screen", () =>
{
var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 4 })
{
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
});
};

beatmap.ControlPointInfo.Add(0, new TimingControlPoint());

var editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null));

Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);

Expand All @@ -50,7 +55,11 @@ public void SetUpSteps()
(typeof(IBeatSnapProvider), editorBeatmap),
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
},
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
Children = new Drawable[]
{
editorBeatmap,
new ComposeScreen { State = { Value = Visibility.Visible } },
}
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TestSceneManiaHitObjectComposer : EditorClockTestScene
public void Setup() => Schedule(() =>
{
BeatDivisor.Value = 8;
Clock.Seek(0);
EditorClock.Seek(0);

Child = composer = new TestComposer { RelativeSizeAxes = Axes.Both };
});
Expand All @@ -53,7 +53,7 @@ public void TestDragOffscreenSelectionVerticallyUpScroll()
{
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
originalTime = lastObject.HitObject.StartTime;
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
EditorClock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
});

AddStep("select all objects", () => composer.EditorBeatmap.SelectedHitObjects.AddRange(composer.EditorBeatmap.HitObjects));
Expand Down Expand Up @@ -90,7 +90,7 @@ public void TestDragOffscreenSelectionVerticallyDownScroll()
{
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
originalTime = lastObject.HitObject.StartTime;
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
EditorClock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
});

AddStep("select all objects", () => composer.EditorBeatmap.SelectedHitObjects.AddRange(composer.EditorBeatmap.HitObjects));
Expand Down Expand Up @@ -125,7 +125,7 @@ public void TestDragOffscreenSelectionHorizontally()
AddStep("seek to last object", () =>
{
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
EditorClock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
});

AddStep("select all objects", () => composer.EditorBeatmap.SelectedHitObjects.AddRange(composer.EditorBeatmap.HitObjects));
Expand Down
20 changes: 11 additions & 9 deletions osu.Game.Rulesets.Mania/ManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
#nullable disable

using System;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Difficulty;
Expand All @@ -31,13 +25,19 @@
using osu.Game.Rulesets.Mania.Difficulty;
using osu.Game.Rulesets.Mania.Edit;
using osu.Game.Rulesets.Mania.Edit.Setup;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Mania.Scoring;
using osu.Game.Rulesets.Mania.Skinning.Legacy;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Mania
{
Expand All @@ -60,6 +60,8 @@ public class ManiaRuleset : Ruleset, ILegacyRuleset

public const string SHORT_NAME = "mania";

public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;

public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this);

public override ISkin CreateLegacySkinProvider(ISkin skin, IBeatmap beatmap) => new ManiaLegacySkinTransformer(skin, beatmap);
Expand Down
70 changes: 70 additions & 0 deletions osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectMerging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
using osuTK.Input;
Expand All @@ -14,6 +16,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneObjectMerging : TestSceneOsuEditor
{
private OsuSelectionHandler selectionHandler => Editor.ChildrenOfType<OsuSelectionHandler>().First();

[Test]
public void TestSimpleMerge()
{
Expand All @@ -29,6 +33,9 @@ public void TestSimpleMerge()
EditorBeatmap.SelectedHitObjects.Add(circle2);
});

moveMouseToHitObject(1);
AddAssert("merge option available", () => selectionHandler.ContextMenuItems.Any(o => o.Text.Value == "Merge selection"));

mergeSelection();

AddAssert("slider created", () => circle1 is not null && circle2 is not null && sliderCreatedFor(
Expand Down Expand Up @@ -174,6 +181,57 @@ public void TestNonMerge()
AddAssert("spinner not merged", () => EditorBeatmap.HitObjects.Contains(spinner));
}

[Test]
public void TestIllegalMerge()
{
HitCircle? circle1 = null;
HitCircle? circle2 = null;

AddStep("add two circles on the same position", () =>
{
circle1 = new HitCircle();
circle2 = new HitCircle { Position = circle1.Position + Vector2.UnitX };
EditorClock.Seek(0);
EditorBeatmap.Add(circle1);
EditorBeatmap.Add(circle2);
EditorBeatmap.SelectedHitObjects.Add(circle1);
EditorBeatmap.SelectedHitObjects.Add(circle2);
});

moveMouseToHitObject(1);
AddAssert("merge option not available", () => selectionHandler.ContextMenuItems.Length > 0 && selectionHandler.ContextMenuItems.All(o => o.Text.Value != "Merge selection"));
mergeSelection();
AddAssert("circles not merged", () => circle1 is not null && circle2 is not null
&& EditorBeatmap.HitObjects.Contains(circle1) && EditorBeatmap.HitObjects.Contains(circle2));
}

[Test]
public void TestSameStartTimeMerge()
{
HitCircle? circle1 = null;
HitCircle? circle2 = null;

AddStep("add two circles at the same time", () =>
{
circle1 = new HitCircle();
circle2 = new HitCircle { Position = circle1.Position + 100 * Vector2.UnitX };
EditorClock.Seek(0);
EditorBeatmap.Add(circle1);
EditorBeatmap.Add(circle2);
EditorBeatmap.SelectedHitObjects.Add(circle1);
EditorBeatmap.SelectedHitObjects.Add(circle2);
});

moveMouseToHitObject(1);
AddAssert("merge option available", () => selectionHandler.ContextMenuItems.Any(o => o.Text.Value == "Merge selection"));

mergeSelection();

AddAssert("slider created", () => circle1 is not null && circle2 is not null && sliderCreatedFor(
(pos: circle1.Position, pathType: PathType.Linear),
(pos: circle2.Position, pathType: null)));
}

private void mergeSelection()
{
AddStep("merge selection", () =>
Expand Down Expand Up @@ -225,5 +283,17 @@ private bool sliderSampleExist()

return mergedSlider.Samples[0] is not null;
}

private void moveMouseToHitObject(int index)
{
AddStep($"hover mouse over hit object {index}", () =>
{
if (EditorBeatmap.HitObjects.Count <= index)
return;

Vector2 position = ((OsuHitObject)EditorBeatmap.HitObjects[index]).Position;
InputManager.MoveMouseTo(selectionHandler.ToScreenSpace(position));
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ public TestSceneOsuDistanceSnapGrid()
}
});

editorClock = new EditorClock(editorBeatmap);

base.Content.Children = new Drawable[]
{
editorClock = new EditorClock(editorBeatmap),
snapProvider,
Content
};
Expand Down
Loading

0 comments on commit 6a35b23

Please sign in to comment.