New button for selector menus (horrible code))

This commit is contained in:
NeeEoo
2023-08-07 23:23:47 +02:00
parent e7caf7e9bd
commit a3593fbf47
5 changed files with 72 additions and 9 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

@@ -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);
@@ -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<String> = Character.getList(true);
main = new OptionsScreen("Character Editor", "Select a character to edit", [
var list:Array<OptionType> = [
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);
}
}
@@ -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<OptionType> = [
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<OptionType> = [
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) {
+18
View File
@@ -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);
}
}