From a3593fbf47dcc0f161d9f747dcddc4d4338ef6aa Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Mon, 7 Aug 2023 23:23:47 +0200 Subject: [PATCH] New button for selector menus (horrible code)) --- assets/images/editors/new.png | Bin 0 -> 652 bytes .../editors/character/CharacterEditor.hx | 17 ++++++++++-- .../editors/character/CharacterSelection.hx | 20 ++++++++++++-- .../editors/charter/CharterSelection.hx | 26 +++++++++++++++--- source/funkin/options/type/NewOption.hx | 18 ++++++++++++ 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 assets/images/editors/new.png create mode 100644 source/funkin/options/type/NewOption.hx diff --git a/assets/images/editors/new.png b/assets/images/editors/new.png new file mode 100644 index 0000000000000000000000000000000000000000..d205c17ef58da963538144b3ad6c0fcf569adb70 GIT binary patch literal 652 zcmeAS@N?(olHy`uVBq!ia0vp^-XP4u1|%)~s$Kyp#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvNA9*$#}XrhE&A8o$cs%*g(Mb@`|LBU9tKM>2B#!p-`q} zo3yX{uK9Q5v+Sw*AQAmVDxZxC=Sr4d6^z_}r?x#Y^xJuBFBy}_xJ61liM}a!?eDf- zw6Tk`Kir|bn!j3VtBa)R`BKi3NXy@6#kXu-vT}{)!R;b$^EW?QJ(=zAhDx5rM(=NL zH~3|H|J$<-{hzOeo{O}c-eoi)*)~J(wZ38`!z5M(!i2-br+1A_B(7UrSt}{t^~AJd zONh+t50$+4q*s6ZuIqBO<*K!b|LPF2*N1|wtS2ty>sQZwCii@e*rI2LUMMb$>zg_C zbkdy;L-oyjP8ge|U4O9tVUVk2&%K8cf6`}8l{>LxzD%wVNzv%Jku!rK^>?<;Qc^d0R8eo^F!h|E9C~Qq*R3 z)8^zZBR?szdpu{mgN?OCk5*l-@mWA>w|Y0_w=2UI2-TGEq61@X?o~p z>BFzyxV$KyCf;M&t#?TfNTyR27yb# PlR=cHtDnm{r-UW|LplaR literal 0 HcmV?d00001 diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index 6e86e40f..352a890c 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -1,5 +1,6 @@ package funkin.editors.character; +import funkin.backend.system.framerate.Framerate; import haxe.xml.Printer; import haxe.xml.Access; import funkin.backend.utils.XMLUtil.AnimData; @@ -249,11 +250,21 @@ class CharacterEditor extends UIState { add(topMenuSpr); add(uiGroup); + + Framerate.fpsCounter.alpha = 0.4; + Framerate.memoryCounter.alpha = 0.4; + Framerate.codenameBuildField.alpha = 0.4; } - private var movingCam:Bool = false; - private var camDrag:FlxPoint = FlxPoint.get(0,0); - private var camDragSpeed:Float = 1.2; + override function destroy() { + super.destroy(); + Framerate.fpsCounter.alpha = 1; + Framerate.memoryCounter.alpha = 1; + Framerate.codenameBuildField.alpha = 1; + } + + //private var movingCam:Bool = false; + //private var camDragSpeed:Float = 1.2; private var nextScroll:FlxPoint = FlxPoint.get(0,0); diff --git a/source/funkin/editors/character/CharacterSelection.hx b/source/funkin/editors/character/CharacterSelection.hx index 1c928582..8c2000ea 100644 --- a/source/funkin/editors/character/CharacterSelection.hx +++ b/source/funkin/editors/character/CharacterSelection.hx @@ -1,5 +1,7 @@ package funkin.editors.character; +import funkin.options.type.OptionType; +import funkin.options.type.NewOption; import flixel.util.FlxColor; import funkin.game.Character; import funkin.backend.chart.Chart; @@ -16,12 +18,26 @@ class CharacterSelection extends EditorTreeMenu super.create(); var modsList:Array = Character.getList(true); - main = new OptionsScreen("Character Editor", "Select a character to edit", [ + + var list:Array = [ for (char in (modsList.length == 0 ? Character.getList(false) : modsList)) new IconOption(char, "Press ACCEPT to edit this character.", Character.getIconFromCharName(char), function() { FlxG.switchState(new CharacterEditor(char)); }) - ]); + ]; + + list.insert(0, new NewOption("New Character", "New Character", function() { + + })); + + main = new OptionsScreen("Character Editor", "Select a character to edit", list); + } + + override function createPost() { + super.createPost(); + + var idk:OptionsScreen = optionsTree.members.last(); + if (idk.members.length > 0) idk.changeSelection(1); } } \ No newline at end of file diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index 842f7510..d3d212e8 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -1,5 +1,6 @@ package funkin.editors.charter; +import funkin.options.type.NewOption; import funkin.backend.system.framerate.Framerate; import flixel.util.FlxColor; import funkin.menus.FreeplayState.FreeplaySonglist; @@ -18,15 +19,32 @@ class CharterSelection extends EditorTreeMenu { freeplayList = FreeplaySonglist.get(false); - main = new OptionsScreen("Chart Editor", "Select a song to modify the charts from.", [ + var list:Array = [ for(s in freeplayList.songs) new IconOption(s.name, "Press ACCEPT to choose a difficulty to edit.", s.icon, function() { - optionsTree.add(new OptionsScreen(s.name, "Select a difficulty to continue, or press 1 to add a new one.", [ + var list:Array = [ for(d in s.difficulties) new TextOption(d, "Press ACCEPT to edit the chart for the selected difficulty", function() { FlxG.switchState(new Charter(s.name, d)); }) - ])); + ]; + list.push(new NewOption("New Difficulty", "New Difficulty", function() { + + })); + optionsTree.add(new OptionsScreen(s.name, "Select a difficulty to continue, or press 1 to add a new one.", list)); }) - ]); + ]; + + list.insert(0, new NewOption("New Chart", "New Chart", function() { + + })); + + main = new OptionsScreen("Chart Editor", "Select a song to modify the charts from.", list); + } + + override function createPost() { + super.createPost(); + + var idk:OptionsScreen = optionsTree.members.last(); + if (idk.members.length > 0) idk.changeSelection(1); } public override function update(elapsed:Float) { diff --git a/source/funkin/options/type/NewOption.hx b/source/funkin/options/type/NewOption.hx new file mode 100644 index 00000000..bd7d1a14 --- /dev/null +++ b/source/funkin/options/type/NewOption.hx @@ -0,0 +1,18 @@ +package funkin.options.type; + +import flixel.util.FlxColor; +import funkin.game.HealthIcon; + +class NewOption extends TextOption { + public var iconSpr:FlxSprite; + + public function new(name:String, desc:String, callback:Void->Void) { + super(name, desc, callback); + + __text.color = FlxColor.LIME; + + iconSpr = new FlxSprite().loadGraphic(Paths.image("editors/new")); + iconSpr.setPosition(90 - iconSpr.width, (__text.height - iconSpr.height) / 2); + add(iconSpr); + } +} \ No newline at end of file