update options done
parent
ce53198c98
commit
c4707a9f0d
|
@ -5,19 +5,24 @@ const Utils = require('r3-utils');
|
|||
/**
|
||||
|
||||
OPTIONS_START
|
||||
x=0
|
||||
y=1
|
||||
z=2
|
||||
register=true
|
||||
OPTIONS_END
|
||||
|
||||
INSTANCE_OPTIONS_MAPPING_START
|
||||
x=side.x
|
||||
y=side.y
|
||||
z=side.z
|
||||
INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
EXCLUDE_OPTIONS_UPDATE_START
|
||||
EXCLUDE_OPTIONS_UPDATE_END
|
||||
|
||||
EXCLUDE_OPTIONS_UPDATE_FROM_START
|
||||
EXCLUDE_OPTIONS_UPDATE_FROM_END
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
register
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
||||
|
@ -38,7 +43,19 @@ class AnotherClass extends R3Object {
|
|||
this.emit(Event.OBJECT_CREATED, this);
|
||||
|
||||
//OPTIONS_INIT_START
|
||||
//OPTIONS_INIT_END
|
||||
if (Utils.UndefinedOrNull(options.x)) {
|
||||
options.x = 0;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.y)) {
|
||||
options.y = 1;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.z)) {
|
||||
options.z = 2;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.register)) {
|
||||
options.register = true;
|
||||
}
|
||||
//OPTIONS_INIT_END
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
@ -58,6 +75,19 @@ class AnotherClass extends R3Object {
|
|||
//CREATE_INSTANCE_BEFORE_START
|
||||
super.createInstance();
|
||||
this.emit(Event.CREATE_INSTANCE, this);
|
||||
|
||||
if (this.runtime === 'graphics') {
|
||||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
'side.x': this.x,
|
||||
'side.y': this.y,
|
||||
'side.z': this.z
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
//CREATE_INSTANCE_BEFORE_END
|
||||
|
||||
//CUSTOM_CREATE_INSTANCE_START
|
||||
|
@ -71,14 +101,26 @@ class AnotherClass extends R3Object {
|
|||
//CREATE_INSTANCE_TEMPLATE_END
|
||||
|
||||
//UPDATE_INSTANCE_TEMPLATE_START
|
||||
updateInstance() {
|
||||
updateInstance(property) {
|
||||
|
||||
//UPDATE_INSTANCE_BEFORE_START
|
||||
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
|
||||
//UPDATE_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_INSTANCE_OPTIONS_START
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
if (property === 'x') {
|
||||
this.instance.side.x = this.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.instance.side.y = this.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.instance.side.z = this.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_START
|
||||
//CUSTOM_UPDATE_INSTANCE_END
|
||||
|
@ -91,14 +133,26 @@ class AnotherClass extends R3Object {
|
|||
//UPDATE_INSTANCE_TEMPLATE_END
|
||||
|
||||
//UPDATE_FROM_INSTANCE_TEMPLATE_START
|
||||
updateFromInstance() {
|
||||
updateFromInstance(property) {
|
||||
|
||||
//UPDATE_FROM_INSTANCE_BEFORE_START
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
|
||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
if (property === 'x') {
|
||||
this.x = this.instance.side.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.y = this.instance.side.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.z = this.instance.side.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||
|
|
|
@ -7,7 +7,7 @@ class R3 {
|
|||
}
|
||||
|
||||
static version() {
|
||||
return 'Sat Jun 19 2021 09:24:02 GMT+0000 (Coordinated Universal Time)';
|
||||
return 'Sat Jun 19 2021 11:37:50 GMT+0000 (Coordinated Universal Time)';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1772,7 +1772,7 @@ var R3 = /*#__PURE__*/function () {
|
|||
_createClass(R3, null, [{
|
||||
key: "version",
|
||||
value: function version() {
|
||||
return 'Sat Jun 19 2021 09:24:02 GMT+0000 (Coordinated Universal Time)';
|
||||
return 'Sat Jun 19 2021 11:37:50 GMT+0000 (Coordinated Universal Time)';
|
||||
}
|
||||
}]);
|
||||
|
||||
|
|
|
@ -5,19 +5,24 @@ const Utils = require('r3-utils');
|
|||
/**
|
||||
|
||||
OPTIONS_START
|
||||
x=0
|
||||
y=1
|
||||
z=2
|
||||
register=true
|
||||
OPTIONS_END
|
||||
|
||||
INSTANCE_OPTIONS_MAPPING_START
|
||||
x=side.x
|
||||
y=side.y
|
||||
z=side.z
|
||||
INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
EXCLUDE_OPTIONS_UPDATE_START
|
||||
EXCLUDE_OPTIONS_UPDATE_END
|
||||
|
||||
EXCLUDE_OPTIONS_UPDATE_FROM_START
|
||||
EXCLUDE_OPTIONS_UPDATE_FROM_END
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
register
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
||||
|
@ -38,7 +43,19 @@ class AnotherClass extends R3Object {
|
|||
this.emit(Event.OBJECT_CREATED, this);
|
||||
|
||||
//OPTIONS_INIT_START
|
||||
//OPTIONS_INIT_END
|
||||
if (Utils.UndefinedOrNull(options.x)) {
|
||||
options.x = 0;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.y)) {
|
||||
options.y = 1;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.z)) {
|
||||
options.z = 2;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.register)) {
|
||||
options.register = true;
|
||||
}
|
||||
//OPTIONS_INIT_END
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
@ -58,6 +75,19 @@ class AnotherClass extends R3Object {
|
|||
//CREATE_INSTANCE_BEFORE_START
|
||||
super.createInstance();
|
||||
this.emit(Event.CREATE_INSTANCE, this);
|
||||
|
||||
if (this.runtime === 'graphics') {
|
||||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
'side.x': this.x,
|
||||
'side.y': this.y,
|
||||
'side.z': this.z
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
//CREATE_INSTANCE_BEFORE_END
|
||||
|
||||
//CUSTOM_CREATE_INSTANCE_START
|
||||
|
@ -71,14 +101,26 @@ class AnotherClass extends R3Object {
|
|||
//CREATE_INSTANCE_TEMPLATE_END
|
||||
|
||||
//UPDATE_INSTANCE_TEMPLATE_START
|
||||
updateInstance() {
|
||||
updateInstance(property) {
|
||||
|
||||
//UPDATE_INSTANCE_BEFORE_START
|
||||
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
|
||||
//UPDATE_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_INSTANCE_OPTIONS_START
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
if (property === 'x') {
|
||||
this.instance.side.x = this.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.instance.side.y = this.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.instance.side.z = this.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_START
|
||||
//CUSTOM_UPDATE_INSTANCE_END
|
||||
|
@ -91,14 +133,26 @@ class AnotherClass extends R3Object {
|
|||
//UPDATE_INSTANCE_TEMPLATE_END
|
||||
|
||||
//UPDATE_FROM_INSTANCE_TEMPLATE_START
|
||||
updateFromInstance() {
|
||||
updateFromInstance(property) {
|
||||
|
||||
//UPDATE_FROM_INSTANCE_BEFORE_START
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
|
||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
if (property === 'x') {
|
||||
this.x = this.instance.side.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.y = this.instance.side.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.z = this.instance.side.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||
|
|
|
@ -1,2 +1,12 @@
|
|||
super.createInstance();
|
||||
this.emit(Event.CREATE_INSTANCE, this);
|
||||
this.emit(Event.CREATE_INSTANCE, this);
|
||||
|
||||
if (this.runtime === 'graphics') {
|
||||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
'INSTANCE_KEY': this.KEY
|
|
@ -13,11 +13,8 @@ const Utils = require('r3-utils');
|
|||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
EXCLUDE_OPTIONS_UPDATE_START
|
||||
EXCLUDE_OPTIONS_UPDATE_END
|
||||
|
||||
EXCLUDE_OPTIONS_UPDATE_FROM_START
|
||||
EXCLUDE_OPTIONS_UPDATE_FROM_END
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
updateFromInstance() {
|
||||
updateFromInstance(property) {
|
||||
|
||||
//UPDATE_FROM_INSTANCE_BEFORE_START
|
||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
if (property === 'KEY') {
|
||||
this.KEY = this.instance.INSTANCE_KEY;
|
||||
return;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
updateInstance() {
|
||||
updateInstance(property) {
|
||||
|
||||
//UPDATE_INSTANCE_BEFORE_START
|
||||
//UPDATE_INSTANCE_BEFORE_END
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
if (!Utils.UndefinedOrNull(this.instance.KEY)) {
|
||||
this.instance.KEY = VALUE;
|
||||
if (property === 'KEY') {
|
||||
this.instance.INSTANCE_KEY = this.KEY;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -35,11 +35,15 @@ foreach ($files as $file) {
|
|||
|
||||
$fn = fopen($file, "r");
|
||||
|
||||
$startCapture = false;
|
||||
|
||||
$saveLine = true;
|
||||
|
||||
$options = [];
|
||||
$instanceMappings = [];
|
||||
$excludeOptions = [];
|
||||
|
||||
$saveOption = false;
|
||||
$saveInstanceMappings = false;
|
||||
$saveExcludeOptions = false;
|
||||
|
||||
$lines = [];
|
||||
|
||||
|
@ -47,29 +51,59 @@ foreach ($files as $file) {
|
|||
|
||||
$line = fgets($fn);
|
||||
|
||||
if (
|
||||
preg_match('/OPTIONS_END/', $line)
|
||||
) {
|
||||
$startCapture = false;
|
||||
/**
|
||||
* if exiting an options definition block - stop saving that definition
|
||||
*/
|
||||
if (preg_match('/\bOPTIONS_END\b/', $line)) {
|
||||
$saveOption = false;
|
||||
}
|
||||
if (preg_match('/\bINSTANCE_OPTIONS_MAPPING_END\b/', $line)) {
|
||||
$saveInstanceMappings = false;
|
||||
}
|
||||
if (preg_match('/\bEXCLUDED_FROM_INSTANCE_OPTIONS_END\b/', $line)) {
|
||||
$saveExcludeOptions = false;
|
||||
}
|
||||
|
||||
if (
|
||||
preg_match('/OPTIONS_INIT_END/', $line)
|
||||
) {
|
||||
/**
|
||||
* if exiting an options implementation block - save the line for later
|
||||
*/
|
||||
if (preg_match('/\bOPTIONS_INIT_END\b/', $line)) {
|
||||
$saveLine = true;
|
||||
}
|
||||
if (preg_match('/\bCREATE_INSTANCE_OPTIONS_END\b/', $line)) {
|
||||
$saveLine = true;
|
||||
}
|
||||
if (preg_match('/\bUPDATE_INSTANCE_OPTIONS_END\b/', $line)) {
|
||||
$saveLine = true;
|
||||
}
|
||||
if (preg_match('/\bUPDATE_FROM_INSTANCE_OPTIONS_END\b/', $line)) {
|
||||
$saveLine = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Now save the line
|
||||
*/
|
||||
if ($saveLine) {
|
||||
array_push($lines, $line);
|
||||
}
|
||||
|
||||
if (
|
||||
preg_match('/OPTIONS_INIT_START/', $line)
|
||||
) {
|
||||
/**
|
||||
* if entering an options implementation block - do not save the line for later
|
||||
*/
|
||||
if (preg_match('/\bOPTIONS_INIT_START\b/', $line)) {
|
||||
$saveLine = false;
|
||||
}
|
||||
if (preg_match('/\bCREATE_INSTANCE_OPTIONS_START\b/', $line)) {
|
||||
$saveLine = false;
|
||||
}
|
||||
if (preg_match('/\bUPDATE_INSTANCE_OPTIONS_START\b/', $line)) {
|
||||
$saveLine = false;
|
||||
}
|
||||
if (preg_match('/\bUPDATE_FROM_INSTANCE_OPTIONS_START\b/', $line)) {
|
||||
$saveLine = false;
|
||||
}
|
||||
|
||||
if ($startCapture) {
|
||||
if ($saveOption) {
|
||||
|
||||
$line = trim($line);
|
||||
|
||||
|
@ -80,21 +114,49 @@ foreach ($files as $file) {
|
|||
}
|
||||
|
||||
$options[$key_value[0]] = $key_value[1];
|
||||
|
||||
}
|
||||
|
||||
if (
|
||||
preg_match('/OPTIONS_START/', $line)
|
||||
) {
|
||||
$startCapture = true;
|
||||
if ($saveInstanceMappings) {
|
||||
|
||||
$line = trim($line);
|
||||
|
||||
$key_value = preg_split('/=/', $line);
|
||||
|
||||
if ($key_value === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$instanceMappings[$key_value[0]] = $key_value[1];
|
||||
}
|
||||
|
||||
if ($saveExcludeOptions) {
|
||||
$line = trim($line);
|
||||
array_push($excludeOptions, $line);
|
||||
print_r($excludeOptions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If entering an options definition block - start saving that definition
|
||||
*/
|
||||
if (preg_match('/\bOPTIONS_START\b/', $line)) {
|
||||
$saveOption = true;
|
||||
}
|
||||
if (preg_match('/\bINSTANCE_OPTIONS_MAPPING_START\b/', $line)) {
|
||||
$saveInstanceMappings = true;
|
||||
}
|
||||
if (preg_match('/\bEXCLUDED_FROM_INSTANCE_OPTIONS_START\b/', $line)) {
|
||||
$saveExcludeOptions = true;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fn);
|
||||
|
||||
file_put_contents($file, $lines);
|
||||
|
||||
/**
|
||||
* Process the constructor options
|
||||
*/
|
||||
$template = file_get_contents('src/templates/options_init.template');
|
||||
|
||||
$newOptions = '';
|
||||
|
@ -108,49 +170,116 @@ foreach ($files as $file) {
|
|||
$contents = file_get_contents($file);
|
||||
|
||||
$contents = preg_replace(
|
||||
'/\/\/OPTIONS_INIT_START.*?\/\/OPTIONS_INIT_END/s',
|
||||
'/\/\/\bOPTIONS_INIT_START\b.*?\/\/\bOPTIONS_INIT_END\b/s',
|
||||
"//OPTIONS_INIT_START\n" . $newOptions . "\t\t//OPTIONS_INIT_END",
|
||||
$contents
|
||||
);
|
||||
|
||||
file_put_contents($file, $contents);
|
||||
|
||||
print_r($newOptions);
|
||||
/**
|
||||
* Process createInstance options
|
||||
*/
|
||||
$template = file_get_contents('src/templates/create_instance_options.template');
|
||||
|
||||
$newOptions = [];
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
|
||||
if (in_array($key, $excludeOptions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (array_key_exists($key, $instanceMappings)) {
|
||||
$value = $instanceMappings[$key];
|
||||
} else {
|
||||
$value = $key;
|
||||
}
|
||||
$updated = str_replace('INSTANCE_KEY', $value, $template);
|
||||
$updated = str_replace('KEY', $key, $updated);
|
||||
array_push($newOptions, $updated);
|
||||
}
|
||||
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
$contents = preg_replace(
|
||||
'/\/\/\bCREATE_INSTANCE_OPTIONS_START\b.*?\/\/\bCREATE_INSTANCE_OPTIONS_END\b/s',
|
||||
"//CREATE_INSTANCE_OPTIONS_START\n" . implode(",\n", $newOptions) . "\n\t\t\t\t\t//CREATE_INSTANCE_OPTIONS_END",
|
||||
$contents
|
||||
);
|
||||
|
||||
file_put_contents($file, $contents);
|
||||
|
||||
/**
|
||||
* Process updateInstance options
|
||||
*/
|
||||
$template = file_get_contents('src/templates/update_instance_options.template');
|
||||
|
||||
$newOptions = '';
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
|
||||
if (in_array($key, $excludeOptions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (array_key_exists($key, $instanceMappings)) {
|
||||
$value = $instanceMappings[$key];
|
||||
} else {
|
||||
$value = $key;
|
||||
}
|
||||
$updated = str_replace('INSTANCE_KEY', $value, $template);
|
||||
$updated = str_replace('KEY', $key, $updated);
|
||||
$newOptions .= $updated;
|
||||
}
|
||||
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
$contents = preg_replace(
|
||||
'/\/\/\bUPDATE_INSTANCE_OPTIONS_START\b.*?\/\/\bUPDATE_INSTANCE_OPTIONS_END\b/s',
|
||||
"//UPDATE_INSTANCE_OPTIONS_START\n" . $newOptions. "\t\t//UPDATE_INSTANCE_OPTIONS_END",
|
||||
$contents
|
||||
);
|
||||
|
||||
file_put_contents($file, $contents);
|
||||
|
||||
/**
|
||||
* Process updateFromInstance options
|
||||
*/
|
||||
$template = file_get_contents('src/templates/update_from_instance_options.template');
|
||||
|
||||
$newOptions = '';
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
|
||||
if (in_array($key, $excludeOptions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (array_key_exists($key, $instanceMappings)) {
|
||||
$value = $instanceMappings[$key];
|
||||
} else {
|
||||
$value = $key;
|
||||
}
|
||||
$updated = str_replace('INSTANCE_KEY', $value, $template);
|
||||
$updated = str_replace('KEY', $key, $updated);
|
||||
$newOptions .= $updated;
|
||||
}
|
||||
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
$contents = preg_replace(
|
||||
'/\/\/\bUPDATE_FROM_INSTANCE_OPTIONS_START\b.*?\/\/\bUPDATE_FROM_INSTANCE_OPTIONS_END\b/s',
|
||||
"//UPDATE_FROM_INSTANCE_OPTIONS_START\n" . $newOptions. "\t\t//UPDATE_FROM_INSTANCE_OPTIONS_END",
|
||||
$contents
|
||||
);
|
||||
|
||||
file_put_contents($file, $contents);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
exit(0);
|
||||
array_push($events, 'Event.START');
|
||||
array_push($events, 'Event.PAUSE');
|
||||
array_push($events, 'Event.RESTART');
|
||||
?>
|
||||
|
||||
sort($events);
|
||||
|
||||
$i = 1;
|
||||
|
||||
$eventList = '';
|
||||
|
||||
$eventFunction = "Event.GetEventName = function(eventId) {\n\n\tswitch(eventId) {\n";
|
||||
|
||||
foreach ($events as $event) {
|
||||
$eventList .= $event . " = " . "0x" . dechex($i) . ";\n";
|
||||
|
||||
$eventFunction .= "\t\tcase 0x" . dechex($i). " : return '" . strtolower(str_replace('Event.', '', $event)) . "';\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$eventList .= "Event.MAX_EVENTS = " . "0x" . dechex($i) . ";\n\n";
|
||||
|
||||
$eventFunction .= "\t\tdefault :\n\t\t\tthrow new Error('Event type not defined : ' + eventId);\n";
|
||||
$eventFunction .= "\t}\n\n";
|
||||
$eventFunction .= "};\n";
|
||||
|
||||
echo $eventList;
|
||||
echo $eventFunction;
|
||||
|
||||
file_put_contents('./src/r3/events-generated', $eventList . $eventFunction);
|
||||
|
||||
?>
|
Loading…
Reference in New Issue