Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTapNote.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
using System.Linq;
using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Tests.Objects;

public partial class TestSceneTapNote : OsuTestScene
public partial class TestSceneTapNote : SentakkiSkinnableTestScene
{
private Container content = null!;
protected override Container<Drawable> Content => content;

protected override Ruleset CreateRuleset() => new SentakkiRuleset();

private int depthIndex;

public static bool[][] ObjectFlagsSource =
Expand All @@ -28,19 +21,19 @@
[false, true],
[true, true],
];

Check notice on line 24 in osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTapNote.cs

View check run for this annotation

codefactor.io / CodeFactor

osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTapNote.cs#L24

Code should not contain multiple blank lines in a row. (SA1507)
[BackgroundDependencyLoader]
private void load()
{
base.Content.Add(content = new SentakkiInputManager(new SentakkiRuleset().RulesetInfo));
}

[TestCaseSource(nameof(ObjectFlagsSource))]
public void PerformNoteTest(bool breakState = false, bool ex = false)
{
AddStep("Miss Single", () => testSingle(false, breakState, ex));
AddStep("Hit Single", () => testSingle(true, breakState, ex));
AddUntilStep("Wait for object despawn", () => !Children.Any(h => h is DrawableSentakkiHitObject sentakkiHitObject && sentakkiHitObject.AllJudged == false));
addStep("Miss Single", () => testSingle(false, breakState, ex));
addStep("Hit Single", () => testSingle(true, breakState, ex));
}

private void addStep(string title, Action action)
{
AddStep(title, action);
AddUntilStep("Wait for object despawn", () => !CreatedDrawables.Any(h => h is DrawableSentakkiHitObject sentakkiHitObject && sentakkiHitObject.AllJudged == false));
}

private void testSingle(bool auto = false, bool breakState = false, bool ex = false)
Expand All @@ -57,7 +50,7 @@

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

Add(new DrawableTap(circle)
SetContents(_ => new DrawableTap(circle)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
using osu.Game.Rulesets.Sentakki.Extensions;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces.Slides;
using osu.Game.Rulesets.Sentakki.Skinning;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Screens.Edit;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;

Expand All @@ -26,7 +28,7 @@ public partial class SlideSelectionBlueprint : SentakkiSelectionBlueprint<Slide,
[Cached]
private readonly SlideTapPiece slideTapHighlight;

private readonly TapPiece tapHighlight;
private readonly SkinnableDrawable tapHighlight;

public override Quad SelectionQuad => slideTapHighlight.ScreenSpaceDrawQuad;

Expand All @@ -50,7 +52,13 @@ public SlideSelectionBlueprint(Slide item)
Colour = Color4.YellowGreen,
Children = [
slideTapHighlight = new SlideTapPiece(),
tapHighlight = new TapPiece()
tapHighlight = new SkinnableDrawable(new SentakkiSkinComponentLookup(SentakkiSkinComponents.Tap), _ => new TapRing())
{
RelativeSizeAxes = Axes.None,
Size = new Vector2(TapRing.CIRCLE_RADIUS * 2),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
]
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
Expand All @@ -9,8 +8,10 @@
using osu.Game.Rulesets.Sentakki.Edit.Snapping;
using osu.Game.Rulesets.Sentakki.Extensions;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Sentakki.Skinning;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
Expand All @@ -22,19 +23,22 @@ public partial class TapPlacementBlueprint : LanedPlacementBlueprint<Tap>
[Resolved]
private LaneNoteSnapGrid snapGrid { get; set; } = null!;

private readonly TapPiece highlight;
private readonly SkinnableDrawable highlight;

public TapPlacementBlueprint()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;

InternalChild = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Child = highlight = new TapPiece
Size = new Vector2(TapRing.CIRCLE_RADIUS * 2),

Child = highlight = new SkinnableDrawable(new SentakkiSkinComponentLookup(SentakkiSkinComponents.Tap), _ => new TapRing())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0.5f,
Colour = Color4.YellowGreen
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Sentakki.Extensions;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Sentakki.Skinning;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Edit.Blueprints.Taps;

public partial class TapSelectionBlueprint : SentakkiSelectionBlueprint<Tap, DrawableTap>
{
private readonly TapPiece highlight;
public override Quad SelectionQuad => DrawableObject.TapVisual.ScreenSpaceDrawQuad;
private readonly SkinnableDrawable highlight;
public override Quad SelectionQuad => highlight.ScreenSpaceDrawQuad;

protected override bool AlwaysShowWhenSelected => true;

public TapSelectionBlueprint(Tap item)
: base(item)
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;

AddInternal(highlight = new TapPiece
InternalChild = new Container
{
Alpha = 0.5f,
Colour = Color4.YellowGreen
});
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(TapRing.CIRCLE_RADIUS * 2),

Child = highlight = new SkinnableDrawable(new SentakkiSkinComponentLookup(SentakkiSkinComponents.Tap), _ => new TapRing(), ConfineMode.ScaleToFit)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.YellowGreen
}
};
}

protected override void Update()
{
base.Update();
Rotation = HitObject.Lane.GetRotationForLane();
highlight.Scale = DrawableObject.TapVisual.Scale;
highlight.Y = DrawableObject.TapVisual.Y;

InternalChild.Rotation = HitObject.Lane.GetRotationForLane();
highlight.Scale = DrawableObject.Scale;
highlight.Y = DrawableObject.Y;
}
}
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Sentakki/Mods/SentakkiModHidden.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Rulesets.UI;
using osuTK;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void ApplyToDrawableRuleset(DrawableRuleset<SentakkiHitObject> drawableRu
var lanedHitObjectArea = lanedPlayfield.LanedHitObjectArea;
var lanedNoteProxyContainer = lanedHitObjectArea.Child;

const float note_visible_point = SentakkiPlayfield.NOTESTARTDISTANCE - TapPiece.CIRCLE_RADIUS;
const float note_visible_point = SentakkiPlayfield.NOTESTARTDISTANCE - TapRing.CIRCLE_RADIUS;
const float total_visible_distance = SentakkiPlayfield.INTERSECTDISTANCE;

const float visibility_start_point = note_visible_point / total_visible_distance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces.Slides;
using osuTK;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables;

public partial class DrawableSlideTap : DrawableTap
{
protected override Drawable CreateTapRepresentation() => new SlideTapPiece();
protected override Drawable CreateTapRepresentation() => new SlideTapPiece()
{
Alpha = 1,
Scale = Vector2.One,
Position = Vector2.Zero,
};

protected new DrawableSlide ParentHitObject => (DrawableSlide)base.ParentHitObject;

Expand Down
29 changes: 16 additions & 13 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableTap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Sentakki.Skinning;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables;

public partial class DrawableTap : DrawableSentakkiLanedHitObject, IKeyBindingHandler<SentakkiAction>
{
protected virtual Drawable CreateTapRepresentation() => new TapPiece
{
Y = -SentakkiPlayfield.NOTESTARTDISTANCE,
Scale = Vector2.Zero
};
protected virtual Drawable CreateTapRepresentation() => new ProxyableSkinnableDrawable(new SentakkiSkinComponentLookup(SentakkiSkinComponents.Tap), _ => new TapRing(), ConfineMode.ScaleToFit);

public override double LifetimeStart
{
Expand Down Expand Up @@ -57,6 +55,12 @@ private void load()
{
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Size = new Vector2(TapRing.CIRCLE_RADIUS * 2);

Y = -SentakkiPlayfield.NOTESTARTDISTANCE;
Alpha = 0;
Scale = Vector2.Zero;

AddRangeInternal([
TapVisual = CreateTapRepresentation()
]);
Expand All @@ -67,12 +71,12 @@ protected override void UpdateInitialTransforms()
base.UpdateInitialTransforms();
double animTime = AnimationDuration.Value / 2;

TapVisual.FadeInFromZero(animTime).ScaleTo(1, animTime);
this.FadeInFromZero(animTime).ScaleTo(1, animTime);

using (BeginDelayedSequence(animTime))
{
double excessDistance = (-SentakkiPlayfield.INTERSECTDISTANCE + SentakkiPlayfield.NOTESTARTDISTANCE) / animTime * HitObject.HitWindows.WindowFor(HitResult.Miss);
TapVisual.MoveToY((float)(-SentakkiPlayfield.INTERSECTDISTANCE + excessDistance), animTime + HitObject.HitWindows.WindowFor(HitResult.Miss));
this.MoveToY((float)(-SentakkiPlayfield.INTERSECTDISTANCE + excessDistance), animTime + HitObject.HitWindows.WindowFor(HitResult.Miss));
}
}

Expand Down Expand Up @@ -106,15 +110,14 @@ protected override void UpdateHitStateTransforms(ArmedState state)
switch (state)
{
case ArmedState.Hit:
TapVisual.FadeOut();
this.FadeOut();
break;

case ArmedState.Miss:
TapVisual.ScaleTo(0.5f, time_fade_miss, Easing.InCubic)
.FadeColour(Color4.Red, time_fade_miss, Easing.OutQuint)
.MoveToOffset(new Vector2(0, -100), time_fade_miss, Easing.OutCubic)
.FadeOut(time_fade_miss);
this.ScaleTo(0.5f, time_fade_miss, Easing.InCubic)
.FadeColour(Color4.Red, time_fade_miss, Easing.OutQuint)
.MoveToOffset(new Vector2(0, -100), time_fade_miss, Easing.OutCubic)
.FadeOut(time_fade_miss);

this.Delay(time_fade_miss).FadeOut();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
Expand All @@ -27,7 +28,7 @@ public HoldBody()
{
// For simplicity in sizing and positioning
// let's put the endpoints outside the main area
Padding = new MarginPadding(-TapPiece.CIRCLE_RADIUS),
Padding = new MarginPadding(-TapRing.CIRCLE_RADIUS),
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osu.Game.Rulesets.Sentakki.UI;
using osuTK;
using osuTK.Graphics;
Expand All @@ -19,7 +20,7 @@ public partial class SlideTapPiece : CompositeDrawable

public SlideTapPiece()
{
Size = new Vector2(TapPiece.CIRCLE_RADIUS * 2);
Size = new Vector2(TapRing.CIRCLE_RADIUS * 2);

Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Sentakki.Skinning.Default;
using osuTK;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces.Slides;
Expand All @@ -11,7 +12,7 @@ public StarPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Size = new Vector2(TapPiece.CIRCLE_RADIUS * 2);
Size = new Vector2(TapRing.CIRCLE_RADIUS * 2);
}

[BackgroundDependencyLoader]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
using osu.Framework.Allocation;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Sentakki.Skinning.Default;

public partial class TapPiece : CompositeDrawable
public partial class TapRing : CompositeDrawable
{
// This will be proxied, so a must.
public override bool RemoveWhenNotAlive => false;

public const float CIRCLE_RADIUS = 75 * 0.5f;

public TapPiece()
public TapRing()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Expand Down
Loading
Loading