From b637cf84050088fddfe201c44b968b2b9372c56b Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:18:31 -0700 Subject: [PATCH] change the editor ui a bit WIP --- source/funkin/editors/charter/Charter.hx | 78 ++++++++---------------- 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index bb337350..8cfad2f1 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -41,7 +41,7 @@ class Charter extends UIState { public var topMenu:Array; @:noCompletion private var playbackIndex:Int = 7; @:noCompletion private var snapIndex:Int = 6; - @:noCompletion private var noteIndex:Int = 4; + @:noCompletion private var noteIndex:Int = 5; public var scrollBar:UIScrollBar; public var songPosInfo:UIText; @@ -71,6 +71,7 @@ class Charter extends UIState { public var noteType:Int = 0; public var noteTypes:Array = []; + public var noteTypeText:UIText; public var strumLines:CharterStrumLineGroup = new CharterStrumLineGroup(); public var notesGroup:CharterNoteGroup = new CharterNoteGroup(); @@ -248,45 +249,6 @@ class Charter extends UIState { } ] }, - { - label: "Note", - childs: [ - { - label: "Add sustain length", - keybind: [E], - onSelect: _note_addsustain - }, - { - label: "Subtract sustain length", - keybind: [Q], - onSelect: _note_subtractsustain - }, - null, - { - label: "Select all", - keybind: [CONTROL, A], - onSelect: _note_selectall - }, - { - label: "Select measure", - keybind: [CONTROL, SHIFT, A], - onSelect: _note_selectmeasure - }, - null, - { - label: "Edit Note Types List", - color: 0xFF959829, icon: 4, - onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, - closeOnSelect: false, - onSelect: editNoteTypesList - }, - null, - { - label: "(0) Default Note", - keybind: [ZERO] - } - ] - }, { label: "Song", childs: [ @@ -311,6 +273,10 @@ class Charter extends UIState { } ] }, + { + label: "Note >", + childs: buildNoteTypesUI() + }, { label: "Snap >", childs: { @@ -423,6 +389,9 @@ class Charter extends UIState { topMenuSpr = new UITopMenu(topMenu); topMenuSpr.cameras = uiGroup.cameras = [uiCamera]; + noteTypeText = new UIText(0, 0, 0, "(0) Default Note"); + noteTypeText.cameras = [uiCamera]; + scrollBar = new UIScrollBar(FlxG.width - 20, topMenuSpr.bHeight, 1000, 0, 100); scrollBar.cameras = [uiCamera]; scrollBar.onChange = function(v) { @@ -486,6 +455,7 @@ class Charter extends UIState { add(strumLines); // add the top menu last OUT of the ui group so that it stays on top add(topMenuSpr); + add(noteTypeText); // add the ui group add(uiGroup); @@ -1015,6 +985,13 @@ class Charter extends UIState { snapButton.x = (lastButtonX -= snapButton.bWidth)-10; } } + + if (topMenuSpr.members[noteIndex] != null) { + var noteTopButton:UITopMenuButton = cast topMenuSpr.members[noteIndex]; + noteTypeText.x = noteTopButton.x + noteTopButton.bWidth + 6; + noteTypeText.y = Std.int((noteTopButton.bHeight - noteTypeText.height) / 2); + } + noteTypeText.text = '($noteType) ${noteTypes[noteType-1] == null ? "Default Note" : noteTypes[noteType-1]}'; super.update(elapsed); @@ -1438,8 +1415,8 @@ class Charter extends UIState { function editNoteTypesList(_) FlxG.state.openSubState(new EditNoteTypesList()); - function buildNoteTypesUI() { - var noteTopButton:UITopMenuButton = cast topMenuSpr.members[noteIndex]; + function buildNoteTypesUI():Array { + var noteTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[noteIndex]; var newChilds:Array = [ { label: "Add sustain length", @@ -1463,14 +1440,6 @@ class Charter extends UIState { onSelect: _note_selectmeasure }, null, - { - label: "Edit Note Types List", - color: 0xFF959829, icon: 4, - onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, - closeOnSelect: false, - onSelect: editNoteTypesList - }, - null, { label: "(0) Default Note", keybind: [ZERO], @@ -1490,7 +1459,14 @@ class Charter extends UIState { if (realNoteID <= 9) newChild.keybind = [noteKeys[realNoteID]]; newChilds.push(newChild); } - noteTopButton.contextMenu = newChilds; + newChilds.push({ + label: "Edit Note Types List", + color: 0xFF959829, icon: 4, + onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, + onSelect: editNoteTypesList + }); + if (noteTopButton != null) noteTopButton.contextMenu = newChilds; + return newChilds; } public function playtestChart(time:Float = 0, opponentMode = false, here = false) {