color wheel and dropdown event params
This commit is contained in:
@@ -3,6 +3,7 @@ package funkin.editors.charter;
|
||||
import funkin.backend.system.Conductor;
|
||||
import flixel.group.FlxGroup;
|
||||
import funkin.editors.charter.EventsData;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class CharterEventScreen extends UISubstateWindow {
|
||||
public var cam:FlxCamera;
|
||||
@@ -147,6 +148,18 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
y += dropdown.height + 30;
|
||||
paramsPanel.add(dropdown);
|
||||
paramsFields.push(dropdown);
|
||||
case TColorWheel:
|
||||
addLabel();
|
||||
var colorWheel = new UIColorwheel(eventName.x, y, FlxColor.fromString(value));
|
||||
y += colorWheel.height + 122;
|
||||
paramsPanel.add(colorWheel);
|
||||
paramsFields.push(colorWheel);
|
||||
case TDropDown(options):
|
||||
addLabel();
|
||||
var dropdown = new UIDropDown(eventName.x, y, 320, 32, options, cast value);
|
||||
y += dropdown.height + 30;
|
||||
paramsPanel.add(dropdown);
|
||||
paramsFields.push(dropdown);
|
||||
default:
|
||||
// none
|
||||
paramsFields.push(null);
|
||||
@@ -201,6 +214,8 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
cast(p, UITextBox).label.text;
|
||||
else if (p is UICheckbox)
|
||||
cast(p, UICheckbox).checked;
|
||||
else if (p is UIColorwheel)
|
||||
cast(p, UIColorwheel).curColor;
|
||||
else
|
||||
null;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package funkin.editors.charter;
|
||||
import hscript.Parser;
|
||||
import hscript.Interp;
|
||||
import haxe.Json;
|
||||
import sys.io.File;
|
||||
import openfl.Assets;
|
||||
import haxe.io.Path;
|
||||
import funkin.backend.assets.Paths;
|
||||
@@ -36,6 +35,8 @@ class EventsData {
|
||||
hscriptInterp.variables.set("Float", function (?min:Int, ?max:Int, ?step:Float, ?precision:Int):EventParamType {return TFloat(min, max, step, precision);});
|
||||
hscriptInterp.variables.set("String", TString);
|
||||
hscriptInterp.variables.set("StrumLine", TStrumLine);
|
||||
hscriptInterp.variables.set("ColorWheel", TColorWheel);
|
||||
hscriptInterp.variables.set("DropDown", Reflect.makeVarArgs((args) -> {return args.length > 0 ? TDropDown([for (arg in args) Std.string(arg)]) : TDropDown(["null"]);}));
|
||||
|
||||
var hscriptParser:Parser = new Parser();
|
||||
hscriptParser.allowJSON = hscriptParser.allowMetadata = false;
|
||||
@@ -58,7 +59,7 @@ class EventsData {
|
||||
for (paramData in cast(data.params, Array<Dynamic>)) {
|
||||
try {
|
||||
finalParams.push({name: paramData.name, type: hscriptInterp.expr(hscriptParser.parseString(paramData.type)), defValue: paramData.defaultValue});
|
||||
} catch (e) {trace('Error parsing event param ${paramData.name} - ${eventName}: $e');}
|
||||
} catch (e) {trace('Error parsing event param ${paramData.name} - ${eventName}: $e'); finalParams.push(null);}
|
||||
}
|
||||
eventsParams.set(eventName, finalParams);
|
||||
} catch (e) {trace('Error parsing file $file: $e');}
|
||||
@@ -85,4 +86,6 @@ enum EventParamType {
|
||||
TFloat(?min:Int, ?max:Int, ?step:Float, ?precision:Int);
|
||||
TString;
|
||||
TStrumLine;
|
||||
TColorWheel;
|
||||
TDropDown(?options:Array<String>);
|
||||
}
|
||||
Reference in New Issue
Block a user