-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge circle segments when chaining them
- Loading branch information
1 parent
e2d97af
commit bdf049c
Showing
3 changed files
with
157 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
osu.Game.Rulesets.Sentakki.Tests/Objects/Slides/TestSceneCircleChaining.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Pooling; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Game.Rulesets.Sentakki.Objects; | ||
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces.Slides; | ||
using osu.Game.Rulesets.Sentakki.UI; | ||
using osu.Game.Rulesets.Sentakki.UI.Components; | ||
using osu.Game.Tests.Visual; | ||
using osuTK; | ||
using osuTK.Graphics; | ||
|
||
namespace osu.Game.Rulesets.Sentakki.Tests.Objects.Slides | ||
{ | ||
[TestFixture] | ||
public partial class TestSceneCircleChaining : OsuTestScene | ||
{ | ||
protected override Ruleset CreateRuleset() => new SentakkiRuleset(); | ||
|
||
private bool mirrored; | ||
|
||
private readonly SlideVisual slide; | ||
private readonly Container nodes; | ||
|
||
[Cached] | ||
private readonly DrawablePool<SlideChevron> chevronPool = null!; | ||
|
||
[Cached] | ||
private readonly SlideFanChevrons fanChevrons = null!; | ||
|
||
public TestSceneCircleChaining() | ||
{ | ||
Add(chevronPool = new DrawablePool<SlideChevron>(62)); | ||
Add(fanChevrons = new SlideFanChevrons()); | ||
|
||
Add(new SentakkiRing | ||
{ | ||
RelativeSizeAxes = Axes.None, | ||
Size = new Vector2(SentakkiPlayfield.RINGSIZE) | ||
}); | ||
|
||
Add(slide = new SlideVisual()); | ||
|
||
AddToggleStep("Mirrored second part", b => | ||
{ | ||
mirrored = b; | ||
RefreshSlide(); | ||
}); | ||
|
||
AddStep("Perform entry animation", () => slide.PerformEntryAnimation(1000)); | ||
AddWaitStep("Wait for transforms", 5); | ||
|
||
AddStep("Perform exit animation", () => slide.PerformExitAnimation(1000)); | ||
AddWaitStep("Wait for transforms", 5); | ||
|
||
Add(nodes = new Container | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
}); | ||
} | ||
|
||
protected SentakkiSlidePath CreatePattern() | ||
{ | ||
var pathParameters = new[]{ | ||
new SlideBodyPart(SlidePaths.PathShapes.Circle, endOffset: 4, false), | ||
new SlideBodyPart(SlidePaths.PathShapes.Circle, endOffset: 4, mirrored), | ||
}; | ||
|
||
return SlidePaths.CreateSlidePath(pathParameters); | ||
} | ||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
RefreshSlide(); | ||
} | ||
|
||
protected void RefreshSlide() | ||
{ | ||
slide.Path = CreatePattern(); | ||
nodes.Clear(); | ||
|
||
foreach (var node in slide.Path.SlideSegments.SelectMany(s => s.ControlPoints)) | ||
{ | ||
nodes.Add(new CircularContainer | ||
{ | ||
Size = new Vector2(10), | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
Position = node.Position, | ||
Masking = true, | ||
Child = new Box | ||
{ | ||
Colour = Color4.Green, | ||
RelativeSizeAxes = Axes.Both | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters