From 6774061fca56ae09d75b851fe8eaeb3881dad22f Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Sat, 9 Sep 2023 20:31:12 -0700 Subject: [PATCH] i forgot what i added --- source/funkin/editors/charter/Charter.hx | 2 +- .../funkin/editors/charter/CharterEventScreen.hx | 3 +-- source/funkin/editors/charter/CharterNote.hx | 2 +- .../funkin/editors/charter/CharterStrumline.hx | 16 ++++++++++------ .../editors/charter/CharterStrumlineScreen.hx | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 291b1479..2e42977b 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -616,7 +616,7 @@ class Charter extends UIState { } else { if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) { var note = new CharterNote(); - note.updatePos(FlxMath.bound(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Math.floor(mousePos.y / 40), 0, __endStep-1), id % 4, 0, 0, strumLines.members[Std.int(id/4)]); + note.updatePos(FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : Math.floor(mousePos.y / 40), 0, __endStep-1), id % 4, 0, 0, strumLines.members[Std.int(id/4)]); notesGroup.add(note); selection = [note]; undos.addToUndo(CCreateSelection([note])); diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index ee8107c4..257922c2 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -62,7 +62,7 @@ class CharterEventScreen extends UISubstateWindow { paramsPanel = new FlxGroup(); add(paramsPanel); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 10, windowSpr.y + windowSpr.bHeight - 10, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { saveCurTab(); chartEvent.refreshEventIcons(); @@ -88,7 +88,6 @@ class CharterEventScreen extends UISubstateWindow { Charter.instance.updateBPMEvents(); }); saveButton.x -= saveButton.bWidth; - saveButton.y -= saveButton.bHeight; add(saveButton); closeButton = new UIButton(saveButton.x - 10, saveButton.y, "Close", ()->close()); diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx index df2b522e..95bfa53d 100644 --- a/source/funkin/editors/charter/CharterNote.hx +++ b/source/funkin/editors/charter/CharterNote.hx @@ -162,7 +162,7 @@ class CharterNote extends UISprite implements ICharterSelectable { public override function draw() { if (snappedToStrumline) - x = (strumLine != null ? strumLine.button.x : 0) + (id % 4) * 40; + x = (strumLine != null ? strumLine.x : 0) + (id % 4) * 40; drawMembers(); drawSuper(); diff --git a/source/funkin/editors/charter/CharterStrumline.hx b/source/funkin/editors/charter/CharterStrumline.hx index 31636780..0f53f092 100644 --- a/source/funkin/editors/charter/CharterStrumline.hx +++ b/source/funkin/editors/charter/CharterStrumline.hx @@ -51,6 +51,9 @@ class CharterStrumline extends UISprite { members.push(button); } + private var __healthYOffset:Float = 0; + private var __draggingYOffset:Float = 0; + public override function update(elapsed:Float) { if (FlxG.keys.justPressed.K) draggable = !draggable; if (healthIcon != null) { @@ -58,20 +61,21 @@ class CharterStrumline extends UISprite { healthIcon.scale.set(healthScale, healthScale); healthIcon.updateHitbox(); - healthIcon.follow(this, ((40 * 4) - healthIcon.width) / 2, FlxMath.lerp(healthIcon.y - y, draggable ? 29 : 7, 1/20)); + healthIcon.follow(this, ((40 * 4) - healthIcon.width) / 2, 7 + (__healthYOffset = FlxMath.lerp(__healthYOffset, draggable ? 22 : 0, 1/20))); } + draggingSprite.selectable = draggable; + UIState.state.updateSpriteRect(draggingSprite); + var dragScale:Float = FlxMath.lerp(draggingSprite.scale.x, draggable ? 1 : 0.8, 1/16); draggingSprite.scale.set(dragScale, dragScale); draggingSprite.updateHitbox(); - draggingSprite.follow(this, (160/2) - (draggingSprite.width/2), FlxMath.lerp(draggingSprite.y - y, draggable ? 9 : 6, 1/12)); - draggingSprite.alpha = FlxMath.lerp(draggingSprite.alpha, draggable ? 0.4 : 0, 1/12); + draggingSprite.follow(this, (160/2) - (draggingSprite.width/2), 6 + (__draggingYOffset = FlxMath.lerp(__draggingYOffset, draggable ? 3 : 0, 1/12))); + var fullAlpha:Float = UIState.state.isOverlapping(draggingSprite, @:privateAccess draggingSprite.__rect) ? 0.8 : 0.35; + draggingSprite.alpha = FlxMath.lerp(draggingSprite.alpha, draggable ? fullAlpha : 0, 1/12); button.follow(this, 0, 95); - draggingSprite.selectable = draggable; - - UIState.state.updateSpriteRect(draggingSprite); super.update(elapsed); } diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 00eea694..57914860 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -127,7 +127,7 @@ class CharterStrumlineScreen extends UISubstateWindow { }, 125); add(saveButton); - closeButton = new UIButton(saveButton.x - 20, saveButton.y, creatingStrumLine ? "Cancel" : "Close", function() { + closeButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, creatingStrumLine ? "Cancel" : "Close", function() { if (creatingStrumLine && onSave != null) onSave(null); close(); }, 125);