This commit is contained in:
Ralty
2025-07-19 01:38:58 +07:00
parent 52184f0470
commit f95ac046d6
4 changed files with 19 additions and 64 deletions
@@ -8,8 +8,6 @@ import openfl.geom.Point;
import openfl.geom.Rectangle;
import openfl.display.BitmapData;
import funkin.game.Character;
import funkin.game.HealthIcon;
import haxe.xml.Access;
using funkin.backend.utils.BitmapUtil;
@@ -24,12 +22,6 @@ class CharacterInfoScreen extends UISubstateWindow {
public var character:Character;
public var iconColorPicker:UIIconColorPicker;
public var spriteTextBox:UITextBox;
public var iconTextBox:UITextBox;
public var iconSprite:HealthIcon;
public var gameOverCharTextBox:UITextBox;
public var antialiasingCheckbox:UICheckbox;
public var flipXCheckbox:UICheckbox;
public var iconColorWheel:UIColorwheel;
public var useDurationCheckbox:UICheckbox;
@@ -109,58 +101,17 @@ class CharacterInfoScreen extends UISubstateWindow {
closeButton.color = 0xFFFF0000;
}
function updateIcon(icon:String) {
if (iconSprite == null) add(iconSprite = new HealthIcon());
iconSprite.setIcon(icon);
var size = Std.int(150 * 0.5);
iconSprite.setUnstretchedGraphicSize(size, size, true);
iconSprite.updateHitbox();
iconSprite.setPosition(iconTextBox.x + iconTextBox.bWidth + 8, iconTextBox.y + (iconTextBox.bHeight / 2) - (iconSprite.height / 2));
iconSprite.scrollFactor.set(1, 1);
}
function saveCharacterInfo() {
public function saveCharacterInfo() {
UIUtil.confirmUISelections(this);
//for (stepper in [positionXStepper, positionYStepper, cameraXStepper, cameraYStepper, singTimeStepper, scaleStepper])
// @:privateAccess stepper.__onChange(stepper.label.text);
var xml = Xml.createElement("character");
xml.set("isPlayer", isPlayerCheckbox.checked ? "true" : "false");
xml.set("x", Std.string(positionXStepper.value));
xml.set("y", Std.string(positionYStepper.value));
xml.set("gameOverChar", gameOverCharTextBox.label.text);
xml.set("camx", Std.string(cameraXStepper.value));
xml.set("camy", Std.string(cameraYStepper.value));
xml.set("holdTime", Std.string(singTimeStepper.value));
xml.set("flipX", Std.string(flipXCheckbox.checked));
xml.set("icon", iconTextBox.label.text);
xml.set("scale", Std.string(scaleStepper.value));
xml.set("antialiasing", antialiasingCheckbox.checked ? "true" : "false");
xml.set("sprite", spriteTextBox.label.text);
if (iconColorWheel.colorChanged)
xml.set("color", iconColorWheel.curColor.toWebString());
for (val in customPropertiesButtonList.buttons.members)
xml.set(val.propertyText.label.text, val.valueText.label.text);
for (anim in character.animDatas)
{
var animXml:Xml = Xml.createElement('anim');
animXml.set("name", anim.name);
animXml.set("anim", anim.anim);
animXml.set("loop", Std.string(anim.loop));
animXml.set("fps", Std.string(anim.fps));
var offset:FlxPoint = character.getAnimOffset(anim.name);
animXml.set("x", Std.string(offset.x));
animXml.set("y", Std.string(offset.y));
offset.put();
if (anim.indices.length > 0)
animXml.set("indices", CoolUtil.formatNumberRange(anim.indices));
xml.addChild(animXml);
}
if (onSave != null) onSave(xml);
if (onSave != null) onSave({
icon: iconColorPicker.iconTextBox.label.text,
iconColor: iconColorWheel.curColor,
holdTime: useDurationCheckbox.checked ? durationStepper.value : -1,
customProperties: [
for (val in customPropertiesButtonList.buttons.members)
val.propertyText.label.text => val.valueText.label.text
]
});
}
}
@@ -58,8 +58,8 @@ class CharterStrumlineButton extends UISprite {
super.update(elapsed);
button.updateSpriteRect();
if (UIState.state.curContextMenu == null && UIState.state.isOverlapping(button, button.__rect) && button.visible) {
UIState.state.updateSpriteRect(button);
buttonScale.set(0.95, 0.95);
if (FlxG.mouse.justPressed && onClick != null) {
onClick();
@@ -110,7 +110,8 @@ class SongCreationScreen extends UISubstateWindow {
stepsPerBeatStepper = new UINumericStepper(beatsPerMeasureStepper.x + 30 + 24, beatsPerMeasureStepper.y, 4, 1, 0, 1, null, 54);
songDataGroup.add(stepsPerBeatStepper);
instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Flags.SOUND_EXT, function (res) {
instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Flags.SOUND_EXT, function (path, res) {
if (path == null || res == null) return;
var audioPlayer:UIAudioPlayer = new UIAudioPlayer(instExplorer.x + 8, instExplorer.y + 8, res);
instExplorer.members.push(audioPlayer);
instExplorer.uiElement = audioPlayer;
@@ -186,7 +187,8 @@ class SongCreationScreen extends UISubstateWindow {
var menuTitle:UIText;
importAudioGroup.add(menuTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Add Audios", 28));
importInstExplorer = new UIFileExplorer(menuTitle.x, menuTitle.y + menuTitle.height + 36, null, null, Flags.SOUND_EXT, function (res) {
importInstExplorer = new UIFileExplorer(menuTitle.x, menuTitle.y + menuTitle.height + 36, null, null, Flags.SOUND_EXT, function (path, res) {
if (path == null || res == null) return;
var audioPlayer:UIAudioPlayer = new UIAudioPlayer(importInstExplorer.x + 8, importInstExplorer.y + 8, res);
importInstExplorer.members.push(audioPlayer);
importInstExplorer.uiElement = audioPlayer;
@@ -196,7 +198,8 @@ class SongCreationScreen extends UISubstateWindow {
"Inst Audio File $* Required$",
[new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]);
importVoicesExplorer = new UIFileExplorer(importInstExplorer.x + 320 + 26, importInstExplorer.y, null, null, Flags.SOUND_EXT, function (res) {
importVoicesExplorer = new UIFileExplorer(importInstExplorer.x + 320 + 26, importInstExplorer.y, null, null, Flags.SOUND_EXT, function (path, res) {
if (path == null || res == null) return;
var audioPlayer:UIAudioPlayer = new UIAudioPlayer(importVoicesExplorer.x + 8, importVoicesExplorer.y + 8, res);
importVoicesExplorer.members.push(audioPlayer);
importVoicesExplorer.uiElement = audioPlayer;
@@ -212,7 +215,7 @@ class SongCreationScreen extends UISubstateWindow {
"Song file name $* Required$",
[new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]);
importChartFile = new UIFileExplorer(importIdTextBox.x, importIdTextBox.y + importIdTextBox.height + 56, null, null, "fnfc", function (_) importIdTextBox.label.text = new haxe.io.Path(importChartFile.filePath).file);
importChartFile = new UIFileExplorer(importIdTextBox.x, importIdTextBox.y + importIdTextBox.height + 56, null, null, "fnfc", function (_, _) importIdTextBox.label.text = new haxe.io.Path(importChartFile.filePath).file);
importDataGroup.add(importChartFile);
addLabelOn(importChartFile, "Data/Chart File").applyMarkup(
"Data/Chart File $* Required$",
@@ -352,4 +352,5 @@ typedef KeybindSettingData = {
typedef ControlsCategory = {
var name:String;
var settings:Array<KeybindSettingData>;
var ?devModeOnly:Bool;
}