conditional saving parameter for events
This commit is contained in:
@@ -18,17 +18,19 @@ class EventsData {
|
|||||||
],
|
],
|
||||||
"Camera Movement" => [
|
"Camera Movement" => [
|
||||||
{name: "Camera Target", type: TStrumLine, defValue: 0},
|
{name: "Camera Target", type: TStrumLine, defValue: 0},
|
||||||
{name: "Tween Movement?", type: TBool, defValue: true},
|
{name: "Tween Movement?", type: TBool, defValue: true, saveIfDefault: false},
|
||||||
{name: "Tween Time (Steps, IF NOT CLASSIC)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4},
|
{name: "Tween Time (Steps, IF NOT CLASSIC)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4, saveIfDefault: false},
|
||||||
{
|
{
|
||||||
name: "Tween Ease (ex: circ, quad, cube)",
|
name: "Tween Ease (ex: circ, quad, cube)",
|
||||||
type: TDropDown(['CLASSIC', 'linear', 'back', 'bounce', 'circ', 'cube', 'elastic', 'expo', 'quad', 'quart', 'quint', 'sine', 'smoothStep', 'smootherStep']),
|
type: TDropDown(['CLASSIC', 'linear', 'back', 'bounce', 'circ', 'cube', 'elastic', 'expo', 'quad', 'quart', 'quint', 'sine', 'smoothStep', 'smootherStep']),
|
||||||
defValue: "CLASSIC"
|
defValue: "CLASSIC",
|
||||||
|
saveIfDefault: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Tween Type (excluded if CLASSIC or linear, ex: InOut)",
|
name: "Tween Type (excluded if CLASSIC or linear, ex: InOut)",
|
||||||
type: TDropDown(['In', 'Out', 'InOut']),
|
type: TDropDown(['In', 'Out', 'InOut']),
|
||||||
defValue: "In"
|
defValue: "In",
|
||||||
|
saveIfDefault: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Add Camera Zoom" => [
|
"Add Camera Zoom" => [
|
||||||
@@ -168,6 +170,7 @@ typedef EventParamInfo = {
|
|||||||
var name:String;
|
var name:String;
|
||||||
var type:EventParamType;
|
var type:EventParamType;
|
||||||
var defValue:Dynamic;
|
var defValue:Dynamic;
|
||||||
|
var ?saveIfDefault:Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum EventParamType {
|
enum EventParamType {
|
||||||
|
|||||||
@@ -202,11 +202,11 @@ class CharterEventScreen extends UISubstateWindow {
|
|||||||
public function saveCurTab() {
|
public function saveCurTab() {
|
||||||
if (curEvent < 0) return;
|
if (curEvent < 0) return;
|
||||||
|
|
||||||
events[curEvent].params = [
|
var dataParams = EventsData.getEventParams(events[curEvent].name);
|
||||||
for(p in paramsFields) {
|
var params:Array<Dynamic> = [
|
||||||
|
for (i => p in paramsFields) {
|
||||||
if (p is UIDropDown) {
|
if (p is UIDropDown) {
|
||||||
var dataParams = EventsData.getEventParams(events[curEvent].name);
|
if (dataParams[i].type == TStrumLine) cast(p, UIDropDown).index;
|
||||||
if (dataParams[paramsFields.indexOf(p)].type == TStrumLine) cast(p, UIDropDown).index;
|
|
||||||
else cast(p, UIDropDown).label.text;
|
else cast(p, UIDropDown).label.text;
|
||||||
}
|
}
|
||||||
else if (p is UINumericStepper) {
|
else if (p is UINumericStepper) {
|
||||||
@@ -227,6 +227,14 @@ class CharterEventScreen extends UISubstateWindow {
|
|||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
while(dataParams.length > 0 && {
|
||||||
|
var index = params.length - 1;
|
||||||
|
var dataParam = dataParams[index];
|
||||||
|
dataParam.saveIfDefault == false && params[index] == dataParam.defValue;
|
||||||
|
}) params.pop();
|
||||||
|
|
||||||
|
events[curEvent].params = params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user