From e5c984dc8225f4331da190f650b56c9a1ac72602 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:26:51 -0700 Subject: [PATCH] character propetries window ui --- .../editors/character/CharacterAnimsWindow.hx | 2 +- .../editors/character/CharacterEditor.hx | 24 +++++++++---------- .../character/CharacterPropertiesWindow.hx | 22 ++++++++++++++++- source/funkin/editors/charter/Charter.hx | 1 - 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/source/funkin/editors/character/CharacterAnimsWindow.hx b/source/funkin/editors/character/CharacterAnimsWindow.hx index 6b7be858..e4679289 100644 --- a/source/funkin/editors/character/CharacterAnimsWindow.hx +++ b/source/funkin/editors/character/CharacterAnimsWindow.hx @@ -84,7 +84,7 @@ class CharacterAnimsWindow extends UIWindow { __rect.width = bWidth; __rect.height = bHeight; if(UIState.state.isOverlapping(this, __rect)) { var nextscrollY = scrollY - FlxG.mouse.wheel * 12; - if (nextscrollY >= 0 && nextscrollY + CharacterEditor.instance.animsCamera.height <= (addButton.y +32 +26)) + if (nextscrollY >= 0 && nextscrollY + CharacterEditor.instance.animsCamera.height <= (addButton.y +32 +23)) scrollY = nextscrollY; hovered = true; } else diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index ee48a4fd..8deaaad6 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -52,7 +52,8 @@ class CharacterEditor extends UIState { label: "File", childs: [ { - label: "New" + label: "New", + onSelect: _file_new, }, null, { @@ -122,11 +123,7 @@ class CharacterEditor extends UIState { { label: "Stop Animation", onSelect: _playback_stop_anim - }, - null, - { - label: "Go to frame", - }, + } ] }, { @@ -222,7 +219,7 @@ class CharacterEditor extends UIState { topMenuSpr = new UITopMenu(topMenu); topMenuSpr.cameras = uiGroup.cameras = [uiCamera]; - characterPropertiresWindow = new CharacterPropertiesWindow(800-23,23 + 23, 450 + 23, 140, "Character Properties"); + characterPropertiresWindow = new CharacterPropertiesWindow(); characterAnimsWindow = new CharacterAnimsWindow(character); uiGroup.add(characterPropertiresWindow); uiGroup.add(characterAnimsWindow); @@ -246,6 +243,9 @@ class CharacterEditor extends UIState { UIUtil.processShortcuts(topMenu); } + if (character != null) + characterPropertiresWindow.characterInfo.text = '(Num) Animations: ${character.animation.getNameList().length}\nFlipped: ${character.flipX}\nSprite: ${character.sprite}\nAnim: ${character.animation.name}'; + if (FlxG.mouse.wheel != 0 && !(characterPropertiresWindow.hovered || characterAnimsWindow.hovered)) { zoom += 0.25 * FlxG.mouse.wheel; __camZoom = Math.pow(2, zoom); @@ -263,8 +263,8 @@ class CharacterEditor extends UIState { } charCamera.scroll.set( - lerp(charCamera.scroll.x, nextScroll.x, 0.5), - lerp(charCamera.scroll.y, nextScroll.y, 0.5) + lerp(charCamera.scroll.x, nextScroll.x, 0.25), + lerp(charCamera.scroll.y, nextScroll.y, 0.25) ); charCamera.zoom = lerp(charCamera.zoom, __camZoom, 0.125); @@ -286,15 +286,15 @@ class CharacterEditor extends UIState { FlxG.switchState(new CharacterSelection()); } + function _file_new(_) { + } + function _file_save(_) { } function _file_saveas(_) { } - function _edit_delete(_) { - } - function _edit_undo(_) { var v = undoList.shift(); switch (v) { diff --git a/source/funkin/editors/character/CharacterPropertiesWindow.hx b/source/funkin/editors/character/CharacterPropertiesWindow.hx index 9f36bd9d..51c5a1cf 100644 --- a/source/funkin/editors/character/CharacterPropertiesWindow.hx +++ b/source/funkin/editors/character/CharacterPropertiesWindow.hx @@ -1,5 +1,25 @@ package funkin.editors.character; +import flixel.util.FlxColor; + class CharacterPropertiesWindow extends UIWindow { - + public var newButton:UIButton; + public var editButton:UIButton; + + public var characterInfo:UIText; + + public function new() { + super(800-23,23 + 23, 450 + 23, 140, "Character Properties"); + + newButton = new UIButton( x +(450 + 23)- 25 - 3 - 200, y + 12 + 31, "New Character", null, 200); + members.push(newButton); + newButton.color = FlxColor.GREEN; + + editButton = new UIButton(newButton.x, newButton.y + 12 + 30 + 4, "Edit Character Info", null, 200); + members.push(editButton); + + characterInfo = new UIText(x + 450 + 20 - 42 - 400, y + 36 + 16, 400, "(Num) Animations:\nFlipped:\nSprite:\nCurrent Anim:"); + characterInfo.alignment = LEFT; + members.push(characterInfo); + } } \ No newline at end of file diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index c0a0dc62..5abdfa08 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -356,7 +356,6 @@ class Charter extends UIState { sep.cameras = [charterCamera]; } - selectionBox = new UISliceSprite(0, 0, 2, 2, 'editors/ui/selection'); selectionBox.visible = false; selectionBox.scrollFactor.set(1, 1);