Merge Options XML crash fix PR
This commit is contained in:
@@ -151,6 +151,11 @@ class OptionsMenu extends TreeMenu {
|
||||
var options:Array<FlxSprite> = [];
|
||||
|
||||
for(node in xml.elements) {
|
||||
switch(node.name) {
|
||||
case "separator":
|
||||
options.push(new Separator(node.has.height ? Std.parseFloat(node.att.height) : null));
|
||||
}
|
||||
|
||||
if (!node.has.name) {
|
||||
Logs.warn("An option node requires a name attribute.");
|
||||
continue;
|
||||
@@ -165,7 +170,6 @@ class OptionsMenu extends TreeMenu {
|
||||
continue;
|
||||
}
|
||||
options.push(new Checkbox(name, desc, node.att.id, null, FlxG.save.data));
|
||||
|
||||
case "number":
|
||||
if (!node.has.id) {
|
||||
Logs.warn("A number option requires an \"id\" for option saving.");
|
||||
@@ -195,7 +199,7 @@ class OptionsMenu extends TreeMenu {
|
||||
continue;
|
||||
}
|
||||
var v:Dynamic = Std.parseFloat(node.att.value);
|
||||
options.push(new RadioButton(screen, name, desc, node.att.id, v != null ? v : node.att.value, null, FlxG.save.data, node.att.forId));
|
||||
options.push(new RadioButton(screen, name, desc, node.att.id, v != null ? v : node.att.value, null, FlxG.save.data, node.has.forId ? node.att.forId : null));
|
||||
case 'slider':
|
||||
if (!node.has.id) {
|
||||
Logs.warn("A slider option requires an \"id\" for option saving.");
|
||||
@@ -204,10 +208,6 @@ class OptionsMenu extends TreeMenu {
|
||||
var step = node.has.change ? Std.parseFloat(node.att.change) : (node.has.step ? Std.parseFloat(node.att.step) : null);
|
||||
var segments = node.has.segments ? Std.parseInt(node.att.segments) : 5;
|
||||
options.push(new SliderOption(name, desc, Std.parseFloat(node.att.min), Std.parseFloat(node.att.max), step, segments, node.att.id, Std.parseInt(node.att.barWidth), null, FlxG.save.data));
|
||||
|
||||
case 'separator':
|
||||
options.push(new Separator(Std.parseInt(node.att.height)));
|
||||
|
||||
case "menu":
|
||||
options.push(new TextOption(name, desc, ' >', () -> {
|
||||
var screen = new TreeMenuScreen(name, desc);
|
||||
|
||||
@@ -6,7 +6,7 @@ import flixel.FlxBasic;
|
||||
|
||||
class Separator extends FlxSprite {
|
||||
var separatorHeight:Float;
|
||||
public function new(height = 67) {
|
||||
public function new(height = 67.0) {
|
||||
super();
|
||||
separatorHeight = height;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user