-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbda82c
commit 2247a65
Showing
6 changed files
with
190 additions
and
1 deletion.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
osu.Game.Rulesets.Sentakki/Edit/Blueprints/Holds/HoldHighlight.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,55 @@ | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Primitives; | ||
using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces; | ||
using osuTK; | ||
using osuTK.Graphics; | ||
|
||
namespace osu.Game.Rulesets.Sentakki.Edit.Blueprints.Holds | ||
{ | ||
public class HoldHighlight : CompositeDrawable | ||
{ | ||
public readonly Container Note; | ||
|
||
// This drawable is zero width | ||
// We should use the quad of the note container | ||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => ring.ReceivePositionalInputAt(screenSpacePos); | ||
public override Quad ScreenSpaceDrawQuad => ring.ScreenSpaceDrawQuad.AABBFloat; | ||
|
||
private readonly RingPiece ring; | ||
|
||
public HoldHighlight() | ||
{ | ||
Anchor = Origin = Anchor.Centre; | ||
Colour = Color4.YellowGreen; | ||
Alpha = 0.5f; | ||
InternalChildren = new Drawable[] | ||
{ | ||
Note = new Container{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.BottomCentre, | ||
Children = new Drawable[]{ | ||
new Container | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
RelativeSizeAxes = Axes.Both, | ||
Padding = new MarginPadding(-75/2), | ||
Child = ring = new RingPiece() | ||
}, | ||
new DotPiece(squared: true) | ||
{ | ||
Anchor = Anchor.TopCentre, | ||
Rotation = 45, | ||
}, | ||
new DotPiece(squared: true) | ||
{ | ||
Anchor = Anchor.BottomCentre, | ||
Rotation = 45, | ||
}, | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
osu.Game.Rulesets.Sentakki/Edit/Blueprints/Holds/HoldPlacementBlueprint.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,70 @@ | ||
using System; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Input.Events; | ||
using osu.Game.Rulesets.Edit; | ||
using osu.Game.Rulesets.Sentakki.Objects; | ||
using osu.Game.Rulesets.Sentakki.UI; | ||
using osuTK.Input; | ||
|
||
namespace osu.Game.Rulesets.Sentakki.Edit.Blueprints.Holds | ||
{ | ||
public class HoldPlacementBlueprint : PlacementBlueprint | ||
{ | ||
private readonly HoldHighlight highlight; | ||
|
||
public new Hold HitObject => (Hold)base.HitObject; | ||
|
||
public HoldPlacementBlueprint() | ||
: base(new Hold()) | ||
{ | ||
Anchor = Origin = Anchor.Centre; | ||
InternalChild = highlight = new HoldHighlight(); | ||
highlight.Note.Y = -SentakkiPlayfield.INTERSECTDISTANCE; | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
highlight.Rotation = HitObject.Lane.GetRotationForLane(); | ||
} | ||
|
||
protected override bool OnMouseDown(MouseDownEvent e) | ||
{ | ||
if (e.Button != MouseButton.Left) | ||
return false; | ||
|
||
BeginPlacement(true); | ||
|
||
return base.OnMouseDown(e); | ||
} | ||
|
||
protected override void OnMouseUp(MouseUpEvent e) | ||
{ | ||
if (e.Button != MouseButton.Left) | ||
return; | ||
|
||
EndPlacement(true); | ||
} | ||
|
||
private double originalStartTime; | ||
|
||
public override void UpdateTimeAndPosition(SnapResult result) | ||
{ | ||
base.UpdateTimeAndPosition(result); | ||
|
||
if (PlacementActive == PlacementState.Active) | ||
{ | ||
if (result.Time is double endTime) | ||
{ | ||
HitObject.StartTime = endTime < originalStartTime ? endTime : originalStartTime; | ||
HitObject.Duration = Math.Abs(endTime - originalStartTime); | ||
} | ||
} | ||
else | ||
{ | ||
HitObject.Lane = OriginPosition.GetDegreesFromPosition(ToLocalSpace(result.ScreenSpacePosition)).GetNoteLaneFromDegrees(); | ||
if (result.Time is double startTime) | ||
originalStartTime = HitObject.StartTime = startTime; | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
osu.Game.Rulesets.Sentakki/Edit/Blueprints/Holds/HoldSelectionBlueprint.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,39 @@ | ||
using System; | ||
using osu.Framework.Graphics.Primitives; | ||
using osu.Game.Rulesets.Sentakki.Edit.Blueprints.Taps; | ||
using osu.Game.Rulesets.Sentakki.Objects.Drawables; | ||
using osu.Game.Rulesets.Sentakki.UI; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Sentakki.Edit.Blueprints.Holds | ||
{ | ||
public class HoldSelectionBlueprint : SentakkiSelectionBlueprint | ||
{ | ||
public new DrawableHold DrawableObject => (DrawableHold)base.DrawableObject; | ||
|
||
|
||
private readonly HoldHighlight highlight; | ||
|
||
public HoldSelectionBlueprint(DrawableHold drawableHold) | ||
: base(drawableHold) | ||
{ | ||
InternalChild = highlight = new HoldHighlight(); | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
|
||
highlight.Rotation = DrawableObject.HitObject.Lane.GetRotationForLane(); | ||
highlight.Note.Y = Math.Max(DrawableObject.NoteBody.Y, -SentakkiPlayfield.INTERSECTDISTANCE); | ||
highlight.Note.Height = DrawableObject.NoteBody.Height; | ||
highlight.Note.Scale = DrawableObject.NoteBody.Scale; | ||
} | ||
|
||
public override Vector2 ScreenSpaceSelectionPoint => highlight.ScreenSpaceDrawQuad.Centre; | ||
|
||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => highlight.ReceivePositionalInputAt(screenSpacePos); | ||
|
||
public override Quad SelectionQuad => highlight.ScreenSpaceDrawQuad; | ||
} | ||
} |
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,21 @@ | ||
using osu.Framework.Graphics; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Rulesets.Edit; | ||
using osu.Game.Rulesets.Edit.Tools; | ||
using osu.Game.Rulesets.Sentakki.Edit.Blueprints.Holds; | ||
using osu.Game.Rulesets.Sentakki.Objects; | ||
|
||
namespace osu.Game.Rulesets.Sentakki.Edit | ||
{ | ||
public class HoldCompositionTool : HitObjectCompositionTool | ||
{ | ||
public HoldCompositionTool() | ||
: base(nameof(Hold)) | ||
{ | ||
} | ||
|
||
public override Drawable CreateIcon() => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders); | ||
|
||
public override PlacementBlueprint CreatePlacementBlueprint() => new HoldPlacementBlueprint(); | ||
} | ||
} |
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
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