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 funkin.backend.system.Conductor;
|
||||||
import flixel.group.FlxGroup;
|
import flixel.group.FlxGroup;
|
||||||
import funkin.editors.charter.EventsData;
|
import funkin.editors.charter.EventsData;
|
||||||
|
import flixel.util.FlxColor;
|
||||||
|
|
||||||
class CharterEventScreen extends UISubstateWindow {
|
class CharterEventScreen extends UISubstateWindow {
|
||||||
public var cam:FlxCamera;
|
public var cam:FlxCamera;
|
||||||
@@ -147,6 +148,18 @@ class CharterEventScreen extends UISubstateWindow {
|
|||||||
y += dropdown.height + 30;
|
y += dropdown.height + 30;
|
||||||
paramsPanel.add(dropdown);
|
paramsPanel.add(dropdown);
|
||||||
paramsFields.push(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:
|
default:
|
||||||
// none
|
// none
|
||||||
paramsFields.push(null);
|
paramsFields.push(null);
|
||||||
@@ -201,6 +214,8 @@ class CharterEventScreen extends UISubstateWindow {
|
|||||||
cast(p, UITextBox).label.text;
|
cast(p, UITextBox).label.text;
|
||||||
else if (p is UICheckbox)
|
else if (p is UICheckbox)
|
||||||
cast(p, UICheckbox).checked;
|
cast(p, UICheckbox).checked;
|
||||||
|
else if (p is UIColorwheel)
|
||||||
|
cast(p, UIColorwheel).curColor;
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package funkin.editors.charter;
|
|||||||
import hscript.Parser;
|
import hscript.Parser;
|
||||||
import hscript.Interp;
|
import hscript.Interp;
|
||||||
import haxe.Json;
|
import haxe.Json;
|
||||||
import sys.io.File;
|
|
||||||
import openfl.Assets;
|
import openfl.Assets;
|
||||||
import haxe.io.Path;
|
import haxe.io.Path;
|
||||||
import funkin.backend.assets.Paths;
|
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("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("String", TString);
|
||||||
hscriptInterp.variables.set("StrumLine", TStrumLine);
|
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();
|
var hscriptParser:Parser = new Parser();
|
||||||
hscriptParser.allowJSON = hscriptParser.allowMetadata = false;
|
hscriptParser.allowJSON = hscriptParser.allowMetadata = false;
|
||||||
@@ -58,7 +59,7 @@ class EventsData {
|
|||||||
for (paramData in cast(data.params, Array<Dynamic>)) {
|
for (paramData in cast(data.params, Array<Dynamic>)) {
|
||||||
try {
|
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});
|
||||||
} 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);
|
eventsParams.set(eventName, finalParams);
|
||||||
} catch (e) {trace('Error parsing file $file: $e');}
|
} catch (e) {trace('Error parsing file $file: $e');}
|
||||||
@@ -85,4 +86,6 @@ enum EventParamType {
|
|||||||
TFloat(?min:Int, ?max:Int, ?step:Float, ?precision:Int);
|
TFloat(?min:Int, ?max:Int, ?step:Float, ?precision:Int);
|
||||||
TString;
|
TString;
|
||||||
TStrumLine;
|
TStrumLine;
|
||||||
|
TColorWheel;
|
||||||
|
TDropDown(?options:Array<String>);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user