Skip to content

Commit

Permalink
Implement selection handler for Touch notes
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Jun 27, 2020
1 parent d4ffdd3 commit fa0e08e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
48 changes: 31 additions & 17 deletions osu.Game.Rulesets.Sentakki/Edit/SentakkiSelectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System.Linq;
using System;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Screens.Edit.Compose.Components;
Expand All @@ -19,27 +20,40 @@ public override bool HandleMovement(MoveSelectionEvent moveEvent)

foreach (var h in SelectedHitObjects.OfType<SentakkiHitObject>())
{
if (h is TouchHold)
{
// Spinners don't support position adjustments
continue;
}
var newPos = ToLocalSpace(moveEvent.ScreenSpacePosition);
newPos.Y = -newPos.Y;
var path = newPos.GetDegreesFromPosition(new Vector2(300, -300)).GetNotePathFromDegrees();
var angle = path.GetAngleFromPath();
newPos = new Vector2(newPos.X - 300, -(newPos.Y - 300));

if (h is Hold)
{
h.EndPosition = new Vector2(0, -SentakkiPlayfield.INTERSECTDISTANCE + 40);
}
else if (h is Tap)
switch (h)
{
h.Position = SentakkiExtensions.GetCircularPosition(SentakkiPlayfield.NOTESTARTDISTANCE, angle);
h.EndPosition = SentakkiExtensions.GetCircularPosition(SentakkiPlayfield.INTERSECTDISTANCE, angle);
}
case TouchHold _:
continue;
case Touch touch:
{
float angle = newPos.GetDegreesFromPosition(Vector2.Zero);
float distance = Math.Clamp(Vector2.Distance(newPos, Vector2.Zero), 0, 200);
newPos = SentakkiExtensions.GetCircularPosition(distance, angle);

h.Angle = angle;
touch.Position = newPos;
break;
}
case Tap _:
{
var path = newPos.GetDegreesFromPosition(Vector2.Zero).GetNotePathFromDegrees();
var angle = path.GetAngleFromPath();
h.Position = SentakkiExtensions.GetCircularPosition(SentakkiPlayfield.NOTESTARTDISTANCE, angle);
h.EndPosition = SentakkiExtensions.GetCircularPosition(SentakkiPlayfield.INTERSECTDISTANCE, angle);
h.Angle = angle;
break;
}
case Hold _:
{
var path = newPos.GetDegreesFromPosition(Vector2.Zero).GetNotePathFromDegrees();
var angle = path.GetAngleFromPath();
h.EndPosition = new Vector2(0, -SentakkiPlayfield.INTERSECTDISTANCE + 40);
h.Angle = angle;
break;
}
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private void load(SentakkiRulesetConfigManager sentakkiConfigs)
protected override void Update()
{
base.Update();
Position = HitObject.Position;
if (Result.HasResult) return;

double fadeIn = AnimationDuration.Value * GameplaySpeed;
Expand Down

0 comments on commit fa0e08e

Please sign in to comment.