diff --git a/source/funkin/backend/chart/EventsData.hx b/source/funkin/backend/chart/EventsData.hx index e9f5e79b..97eefd7f 100644 --- a/source/funkin/backend/chart/EventsData.hx +++ b/source/funkin/backend/chart/EventsData.hx @@ -100,7 +100,14 @@ class EventsData { var finalParams:Array = []; for (paramData in cast(data.params, Array)) { try { - finalParams.push({name: paramData.name, type: hscriptInterp.expr(hscriptParser.parseString(paramData.type)), defValue: paramData.defaultValue}); + finalParams.push({ + name: paramData.name, + type: hscriptInterp.expr(hscriptParser.parseString(paramData.type)), + defValue: paramData.defaultValue, + + x: paramData.x, + y: paramData.y + }); } catch (e) {trace('Error parsing event param ${paramData.name} - ${eventName}: $e'); finalParams.push(null);} } eventsParams.set(eventName, finalParams); @@ -120,6 +127,9 @@ typedef EventParamInfo = { var name:String; var type:EventParamType; var defValue:Dynamic; + + @:optional var x:Float; + @:optional var y:Float; } enum EventParamType { diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index 3c2ad340..b2feccca 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -144,11 +144,15 @@ class CharterEventScreen extends UISubstateWindow { } // add new elements - var y:Float = eventName.y + eventName.height + 10; + var _y:Float = eventName.y + eventName.height + 10; var params = EventsData.getEventParams(event.name); for(k=>param in params) { + var x = eventName.x + (param.x == null ? 0 : param.x); + var y = (param.y == null ? _y : param.y); + function addLabel() { - var label:UIText = new UIText(eventName.x, y, 0, param.name); + var label:UIText = new UIText(x, y, 0, param.name); + _y += label.height + 4; y += label.height + 4; paramsPanel.add(label); }; @@ -157,26 +161,26 @@ class CharterEventScreen extends UISubstateWindow { var lastAdded = switch(param.type) { case TString: addLabel(); - var textBox:UITextBox = new UITextBox(eventName.x, y, cast value); + var textBox:UITextBox = new UITextBox(x, y, cast value); paramsPanel.add(textBox); paramsFields.push(textBox); textBox; case TBool: - var checkbox = new UICheckbox(eventName.x, y, param.name, cast value); + var checkbox = new UICheckbox(x, y, param.name, cast value); paramsPanel.add(checkbox); paramsFields.push(checkbox); checkbox; case TInt(min, max, step): addLabel(); - var numericStepper = new UINumericStepper(eventName.x, y, cast value, CoolUtil.getDefault(step, 1), 0, min, max); + var numericStepper = new UINumericStepper(x, y, cast value, CoolUtil.getDefault(step, 1), 0, min, max); paramsPanel.add(numericStepper); paramsFields.push(numericStepper); numericStepper; case TFloat(min, max, step, precision): addLabel(); - var numericStepper = new UINumericStepper(eventName.x, y, cast value, CoolUtil.getDefault(step, 1), precision, min, max); + var numericStepper = new UINumericStepper(x, y, cast value, CoolUtil.getDefault(step, 1), precision, min, max); paramsPanel.add(numericStepper); paramsFields.push(numericStepper); numericStepper; case TStrumLine: addLabel(); - var dropdown = new UIDropDown(eventName.x, y, 320, 32, [ + var dropdown = new UIDropDown(x, y, 320, 32, [ for(k=>s in cast(FlxG.state, Charter).strumLines.members) 'Strumline #${k+1} (${s.strumLine.characters[0]})' ], cast value); @@ -184,12 +188,12 @@ class CharterEventScreen extends UISubstateWindow { dropdown; case TColorWheel: addLabel(); - var colorWheel = new UIColorwheel(eventName.x, y, CoolUtil.getColorFromDynamic(value)); + var colorWheel = new UIColorwheel(x, y, CoolUtil.getColorFromDynamic(value)); paramsPanel.add(colorWheel); paramsFields.push(colorWheel); colorWheel; case TDropDown(options): addLabel(); - var dropdown = new UIDropDown(eventName.x, y, 320, 32, options, Std.int(Math.abs(options.indexOf(cast value)))); + var dropdown = new UIDropDown(x, y, 320, 32, options, Std.int(Math.abs(options.indexOf(cast value)))); paramsPanel.add(dropdown); paramsFields.push(dropdown); dropdown; default: @@ -197,9 +201,9 @@ class CharterEventScreen extends UISubstateWindow { null; } if (lastAdded is UISliceSprite) - y += cast(lastAdded, UISliceSprite).bHeight + 4; + _y += cast(lastAdded, UISliceSprite).bHeight + 4; else if (lastAdded is FlxSprite) - y += cast(lastAdded, FlxSprite).height + 6; + _y += cast(lastAdded, FlxSprite).height + 6; } if(script != null && !(script is DummyScript)) {