diff --git a/source/funkin/editors/EditorTreeMenu.hx b/source/funkin/editors/EditorTreeMenu.hx index 0eac78b1..499f0a5a 100644 --- a/source/funkin/editors/EditorTreeMenu.hx +++ b/source/funkin/editors/EditorTreeMenu.hx @@ -17,6 +17,10 @@ class EditorTreeMenu extends TreeMenu { bg.antialiasing = true; add(bg); } + + public override function exit() { + FlxG.switchState(new MainMenuState()); + } public override function update(elapsed:Float) { super.update(elapsed); diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index a7ffb382..6d2330d9 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -71,8 +71,6 @@ class Charter extends UIState { public override function create() { super.create(); - trace('Entering Charter for song $__song with difficulty $__diff.'); - topMenu = [ { label: "File", @@ -92,25 +90,31 @@ class Charter extends UIState { childs: [ { label: "Undo", + keybind: "Ctrl+Z", onSelect: _edit_undo }, { label: "Redo", + keybind: "Ctrl+Y", onSelect: _edit_redo }, null, { - label: "Cut" + label: "Cut", + keybind: "Ctrl+X" }, { - label: "Copy" + label: "Copy", + keybind: "Ctrl+C" }, { - label: "Paste" + label: "Paste", + keybind: "Ctrl+V" }, null, { label: "Delete", + keybind: "Del", onSelect: _edit_delete } ] @@ -119,17 +123,21 @@ class Charter extends UIState { label: "Chart", childs: [ { - label: "Playtest" + label: "Playtest", + keybind: "Enter" }, { - label: "Playtest here" + label: "Playtest here", + keybind: "Shift+Enter" }, null, { - label: "Playtest as opponent" + label: "Playtest as opponent", + keybind: "Ctrl+Enter" }, { - label: "Playtest as opponent here" + label: "Playtest as opponent here", + keybind: "Ctrl+Shift+Enter" }, null, { @@ -142,22 +150,31 @@ class Charter extends UIState { childs: [ { label: "Play/Pause", + keybind: "Space", onSelect: _playback_play }, null, { label: "Go back a section", + keybind: "A", onSelect: _playback_back }, { label: "Go forward a section", + keybind: "D", onSelect: _playback_forward }, null, { label: "Go back to the start", + keybind: "Home", onSelect: _playback_start }, + { + label: "Go to the end", + keybind: "End", + onSelect: _playback_end + }, null, { label: "Metronome", @@ -439,13 +456,13 @@ class Charter extends UIState { _edit_delete(null); if (FlxG.keys.pressed.CONTROL) { - if (FlxG.keys.justPressed.Z) - _edit_undo(null); - if (FlxG.keys.justPressed.Y) + if (FlxG.keys.justPressed.Y || (FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.Z)) // CTRL+Y or CTRL+SHIFT+Z _edit_redo(null); + else if (FlxG.keys.justPressed.Z) // CTRL+Z + _edit_undo(null); } - if (FlxG.keys.justPressed.SPACE) + if (FlxG.keys.justPressed.SPACE) // SPACE _playback_play(null); __crochet = ((60 / Conductor.bpm) * 1000); diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx index e6effaf5..6aa5ed60 100644 --- a/source/funkin/editors/charter/CharterNote.hx +++ b/source/funkin/editors/charter/CharterNote.hx @@ -1,5 +1,6 @@ package funkin.editors.charter; +import funkin.system.Conductor; import flixel.tweens.FlxTween; import funkin.shaders.CustomShader; import flixel.util.FlxColor; @@ -24,6 +25,14 @@ class CharterNote extends UISprite { moves = false; } + public override function updateButton() { + __rect.x = x; + __rect.y = y; + __rect.width = 40; + __rect.height = 40; + UIState.state.updateRectButtonHandler(this, __rect, onHovered); + } + public var step:Float; public var id:Int; @@ -66,8 +75,16 @@ class CharterNote extends UISprite { super.kill(); } + var __passed:Bool = false; public override function update(elapsed:Float) { super.update(elapsed); + + if (__passed != (__passed = step < Conductor.curStepFloat)) { + alpha = __passed ? 0.6 : 1; + if (__passed && FlxG.sound.music.playing) { + + } + } colorTransform.redMultiplier = colorTransform.greenMultiplier = colorTransform.blueMultiplier = selected ? 0.75 : 1; colorTransform.redOffset = colorTransform.greenOffset = selected ? 96 : 0; diff --git a/source/funkin/editors/ui/UIContextMenu.hx b/source/funkin/editors/ui/UIContextMenu.hx index e6fad90e..df2cb1f5 100644 --- a/source/funkin/editors/ui/UIContextMenu.hx +++ b/source/funkin/editors/ui/UIContextMenu.hx @@ -107,6 +107,7 @@ class UIContextMenu extends MusicBeatSubstate { typedef UIContextMenuCallback = UIContextMenu->Int->UIContextMenuOption->Void; typedef UIContextMenuOption = { var label:String; + var ?keybind:String; var ?icon:Int; var ?onSelect:UIContextMenuOption->Void; var ?childs:Array; @@ -114,6 +115,8 @@ typedef UIContextMenuOption = { class UIContextMenuOptionSpr extends UISliceSprite { public var label:UIText; + public var labelKeybind:UIText; + public var icon:FlxSprite; public var option:UIContextMenuOption; var parent:UIContextMenu; @@ -123,13 +126,32 @@ class UIContextMenuOptionSpr extends UISliceSprite { this.option = option; this.parent = parent; - super(x, y, label.frameWidth + 22, label.frameHeight, 'editors/ui/menu-item'); + if (option.icon != null && option.icon > 0) { + icon = new FlxSprite(0, 0).loadGraphic(Paths.image('editors/ui/context-icons'), true, 20, 20); + icon.animation.add('icon', [option.icon-1], 0, true); + icon.animation.play('icon'); + } + + if (option.keybind != null) { + labelKeybind = new UIText(label.x + label.frameWidth + 10, 2, 0, option.keybind); + labelKeybind.alpha = 0.75; + } + + super(x, y, labelKeybind != null ? Std.int(labelKeybind.x + labelKeybind.frameWidth + 10) : (label.frameWidth + 22), label.frameHeight, 'editors/ui/menu-item'); members.push(label); + if (icon != null) + members.push(icon); + if (labelKeybind != null) + members.push(labelKeybind); } public override function draw() { alpha = hovered ? 1 : 0; label.follow(this, 20, 2); + if (icon != null) + icon.follow(this, 0, 0); + if (labelKeybind != null) + labelKeybind.follow(this, bWidth - 10 - labelKeybind.frameWidth, 2); super.draw(); }