master
Theunis J. Botha 2021-06-20 20:46:13 +02:00
parent fd5eba2cc6
commit 31b2bc87e3
28 changed files with 3179 additions and 3185 deletions

View File

@ -1,8 +1,5 @@
r3 create VectorApplierAgain extends Event
r3 create AnotherClass extends R3Object
r3 create OneMore extends R3Object
r3 create AgainMore extends R3Object
r3 create AgainMoreAgain extends R3Object
r3 create Event normal
r3 create Event normal
r3 create R3Object extends Event
r3 create SomeTest extends Event
r3 create Utils normal
r3 create Component extends R3Object
r3 create Project extends R3Object

View File

@ -1,12 +1,11 @@
const Event = require('r3-event');
const Utils = require('r3-utils');
const Event = require('r3-event.js');
const R3Object = require('r3-r3-object.js');
/**
OPTIONS_START
a=2.0
b=3.0
something='hello'
runtime='default'
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
@ -16,12 +15,12 @@ const Event = require('r3-event.js');
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
b
runtime
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class VectorApplierAgain extends Event {
class Component extends R3Object {
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
constructor(options) {
@ -30,22 +29,16 @@ class VectorApplierAgain extends Event {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'VectorApplierAgain (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (Utils.UndefinedOrNull(options.a)) {
options.a = 2.0;
if (typeof options === 'undefined') {
options = {};
}
if (Utils.UndefinedOrNull(options.b)) {
options.b = 3.0;
}
if (Utils.UndefinedOrNull(options.something)) {
options.something = 'hello';
if (Utils.UndefinedOrNull(options.runtime)) {
options.runtime = 'default';
}
//OPTIONS_INIT_END
@ -55,6 +48,7 @@ class VectorApplierAgain extends Event {
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
this.emit(Event.COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_INIT_END
this.emit(Event.OBJECT_INITIALIZED, this);
@ -65,26 +59,21 @@ class VectorApplierAgain extends Event {
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
'a': this.a,
'something': this.something
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
@ -99,14 +88,6 @@ class VectorApplierAgain extends Event {
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
if (property === 'a') {
this.instance.a = this.a;
return;
}
if (property === 'something') {
this.instance.something = this.something;
return;
}
//UPDATE_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_INSTANCE_START
@ -127,14 +108,6 @@ class VectorApplierAgain extends Event {
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'a') {
this.a = this.instance.a;
return;
}
if (property === 'something') {
this.something = this.instance.something;
return;
}
//UPDATE_FROM_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_FROM_INSTANCE_START
@ -151,14 +124,21 @@ class VectorApplierAgain extends Event {
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();
//DISPOSE_AFTER_END
}
@ -168,15 +148,14 @@ class VectorApplierAgain extends Event {
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_AFTER_END
}
@ -190,4 +169,4 @@ class VectorApplierAgain extends Event {
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = VectorApplierAgain;
module.exports = Component;

View File

@ -1,4 +1,3 @@
const Event = require('r3-event');
const Utils = require('r3-utils');
/**
@ -6,15 +5,6 @@ const Utils = require('r3-utils');
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class Event {
@ -22,16 +12,12 @@ class Event {
//CONSTRUCTOR_TEMPLATE_START
constructor(options) {
if (Utils.UndefinedOrNull(options)) {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'Event (' + options.id + ')';
Event.Emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (typeof options === 'undefined') {
options = {};
}
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
@ -46,110 +32,6 @@ class Event {
}
//CONSTRUCTOR_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
}
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
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
//CUSTOM_UPDATE_INSTANCE_START
//CUSTOM_UPDATE_INSTANCE_END
//UPDATE_INSTANCE_AFTER_START
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
//UPDATE_INSTANCE_AFTER_END
}
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
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
//CUSTOM_UPDATE_FROM_INSTANCE_START
//CUSTOM_UPDATE_FROM_INSTANCE_END
//UPDATE_FROM_INSTANCE_AFTER_START
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
//UPDATE_FROM_INSTANCE_AFTER_END
}
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
//DISPOSE_AFTER_END
}
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
//DISPOSE_INSTANCE_AFTER_END
}
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
/**
@ -317,15 +199,15 @@ class Event {
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//EVENT_GENERATED_START
Event.CREATE_INSTANCE = 0x1;
Event.DISPOSE_INSTANCE = 0x2;
Event.DISPOSE_OBJECT = 0x3;
Event.GET_RUNTIME = 0x4;
Event.GET_WINDOW_SIZE = 0x5;
Event.INSTANCE_CREATED = 0x6;
Event.INSTANCE_DISPOSED = 0x7;
Event.OBJECT_CREATED = 0x8;
Event.OBJECT_DISPOSED = 0x9;
Event.COMPONENT_INITIALIZED = 0x1;
Event.CREATE_INSTANCE_BEFORE = 0x2;
Event.DISPOSE_INSTANCE = 0x3;
Event.DISPOSE_OBJECT = 0x4;
Event.GET_RUNTIME = 0x5;
Event.GET_WINDOW_SIZE = 0x6;
Event.INSTANCE_CREATED = 0x7;
Event.INSTANCE_DISPOSED = 0x8;
Event.OBJECT_CREATED = 0x9;
Event.OBJECT_INITIALIZED = 0xa;
Event.PAUSE = 0xb;
Event.RESTART = 0xc;
@ -339,15 +221,15 @@ Event.MAX_EVENTS = 0x12;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'create_instance';
case 0x2 : return 'dispose_instance';
case 0x3 : return 'dispose_object';
case 0x4 : return 'get_runtime';
case 0x5 : return 'get_window_size';
case 0x6 : return 'instance_created';
case 0x7 : return 'instance_disposed';
case 0x8 : return 'object_created';
case 0x9 : return 'object_disposed';
case 0x1 : return 'component_initialized';
case 0x2 : return 'create_instance_before';
case 0x3 : return 'dispose_instance';
case 0x4 : return 'dispose_object';
case 0x5 : return 'get_runtime';
case 0x6 : return 'get_window_size';
case 0x7 : return 'instance_created';
case 0x8 : return 'instance_disposed';
case 0x9 : return 'object_created';
case 0xa : return 'object_initialized';
case 0xb : return 'pause';
case 0xc : return 'restart';

View File

@ -5,28 +5,26 @@ const R3Object = require('r3-r3-object.js');
/**
OPTIONS_START
x=1
y=2
z=3
register=true
isPublic=true
applicationMode=Project.APPLICATION_MODE_EDIT
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
x=side.x
y=side.y
z=side.z
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
entities=[Entity]
controls=[Control]
images=[Image]
code=[CustomCode]
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
register
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class AnotherClass extends R3Object {
class Project extends R3Object {
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
constructor(options) {
@ -35,25 +33,19 @@ class AnotherClass extends R3Object {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'AnotherClass (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (Utils.UndefinedOrNull(options.x)) {
options.x = 1;
if (typeof options === 'undefined') {
options = {};
}
if (Utils.UndefinedOrNull(options.y)) {
options.y = 2;
if (Utils.UndefinedOrNull(options.isPublic)) {
options.isPublic = true;
}
if (Utils.UndefinedOrNull(options.z)) {
options.z = 3;
}
if (Utils.UndefinedOrNull(options.register)) {
options.register = true;
if (Utils.UndefinedOrNull(options.applicationMode)) {
options.applicationMode = Project.APPLICATION_MODE_EDIT;
}
//OPTIONS_INIT_END
@ -73,27 +65,23 @@ class AnotherClass extends R3Object {
createInstance() {
//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
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
'isPublic': this.isPublic,
'applicationMode': this.applicationMode
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
@ -108,16 +96,12 @@ class AnotherClass extends R3Object {
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
if (property === 'x') {
this.instance.side.x = this.x;
if (property === 'isPublic') {
this.instance.isPublic = this.isPublic;
return;
}
if (property === 'y') {
this.instance.side.y = this.y;
return;
}
if (property === 'z') {
this.instance.side.z = this.z;
if (property === 'applicationMode') {
this.instance.applicationMode = this.applicationMode;
return;
}
//UPDATE_INSTANCE_OPTIONS_END
@ -140,17 +124,17 @@ class AnotherClass extends R3Object {
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'x') {
this.x = this.instance.side.x;
return;
if (property === 'isPublic' || property === 'all') {
this.isPublic = this.instance.isPublic;
if (property !== 'all') {
return;
}
}
if (property === 'y') {
this.y = this.instance.side.y;
return;
}
if (property === 'z') {
this.z = this.instance.side.z;
return;
if (property === 'applicationMode' || property === 'all') {
this.applicationMode = this.instance.applicationMode;
if (property !== 'all') {
return;
}
}
//UPDATE_FROM_INSTANCE_OPTIONS_END
@ -168,14 +152,21 @@ class AnotherClass extends R3Object {
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();
//DISPOSE_AFTER_END
}
@ -185,15 +176,14 @@ class AnotherClass extends R3Object {
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_AFTER_END
}
@ -205,6 +195,15 @@ class AnotherClass extends R3Object {
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
Project.CAMERA_INDEX_EDIT = 0x0;
Project.CAMERA_INDEX_RUN = 0x1;
Project.APPLICATION_MODE_EDIT = Project.CAMERA_INDEX_EDIT;
Project.APPLICATION_MODE_RUN = Project.CAMERA_INDEX_RUN;
Project.RENDERER_INDEX_MAIN = 0x0;
Project.RENDER_TARGET_INDEX_NONE = -0x1;
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = AnotherClass;
module.exports = Project;

View File

@ -4,6 +4,9 @@ const Event = require('r3-event.js');
/**
OPTIONS_START
id=Utils.RandomId(10)
name=this.constructor.name + '(' + options.id + ')'
register=true
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
@ -13,6 +16,9 @@ const Event = require('r3-event.js');
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
id
name
register
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
@ -26,14 +32,23 @@ class R3Object extends Event {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'R3Object (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (typeof options === 'undefined') {
options = {};
}
if (Utils.UndefinedOrNull(options.id)) {
options.id = Utils.RandomId(10);
}
if (Utils.UndefinedOrNull(options.name)) {
options.name = this.constructor.name + '(' + options.id + ')';
}
if (Utils.UndefinedOrNull(options.register)) {
options.register = true;
}
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
@ -52,25 +67,21 @@ class R3Object extends Event {
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
@ -121,14 +132,21 @@ class R3Object extends Event {
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();
//DISPOSE_AFTER_END
}
@ -138,15 +156,14 @@ class R3Object extends Event {
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_AFTER_END
}

2512
dist/r3-node/r3-utils.js vendored

File diff suppressed because it is too large Load Diff

2
dist/r3-node/r3.js vendored
View File

@ -7,7 +7,7 @@ class R3 {
}
static version() {
return 'Sun Jun 20 2021 11:02:42 GMT+0000 (Coordinated Universal Time)';
return 'Sun Jun 20 2021 18:45:42 GMT+0000 (Coordinated Universal Time)';
}
}

323
dist/r3.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,11 @@
const Event = require('r3-event');
const Utils = require('r3-utils');
const Event = require('r3-event.js');
const R3Object = require('r3-r3-object.js');
/**
OPTIONS_START
a=2.0
b=3.0
something='hello'
runtime='default'
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
@ -16,12 +15,12 @@ const Event = require('r3-event.js');
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
b
runtime
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class VectorApplierAgain extends Event {
class Component extends R3Object {
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
constructor(options) {
@ -30,22 +29,16 @@ class VectorApplierAgain extends Event {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'VectorApplierAgain (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (Utils.UndefinedOrNull(options.a)) {
options.a = 2.0;
if (typeof options === 'undefined') {
options = {};
}
if (Utils.UndefinedOrNull(options.b)) {
options.b = 3.0;
}
if (Utils.UndefinedOrNull(options.something)) {
options.something = 'hello';
if (Utils.UndefinedOrNull(options.runtime)) {
options.runtime = 'default';
}
//OPTIONS_INIT_END
@ -55,6 +48,7 @@ class VectorApplierAgain extends Event {
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
this.emit(Event.COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_INIT_END
this.emit(Event.OBJECT_INITIALIZED, this);
@ -65,26 +59,21 @@ class VectorApplierAgain extends Event {
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
'a': this.a,
'something': this.something
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
@ -99,14 +88,6 @@ class VectorApplierAgain extends Event {
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
if (property === 'a') {
this.instance.a = this.a;
return;
}
if (property === 'something') {
this.instance.something = this.something;
return;
}
//UPDATE_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_INSTANCE_START
@ -127,14 +108,6 @@ class VectorApplierAgain extends Event {
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'a') {
this.a = this.instance.a;
return;
}
if (property === 'something') {
this.something = this.instance.something;
return;
}
//UPDATE_FROM_INSTANCE_OPTIONS_END
//CUSTOM_UPDATE_FROM_INSTANCE_START
@ -151,14 +124,21 @@ class VectorApplierAgain extends Event {
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();
//DISPOSE_AFTER_END
}
@ -168,15 +148,14 @@ class VectorApplierAgain extends Event {
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_AFTER_END
}
@ -190,4 +169,4 @@ class VectorApplierAgain extends Event {
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = VectorApplierAgain;
module.exports = Component;

View File

@ -1,60 +0,0 @@
const Utils = require('./r3-utils');
class Event {
constructor(options) {
console.log('Event created');
}
}
//EVENT_GENERATED_START
Event.CREATE_INSTANCE = 0x1;
Event.DISPOSE_INSTANCE = 0x2;
Event.DISPOSE_OBJECT = 0x3;
Event.GET_RUNTIME = 0x4;
Event.GET_WINDOW_SIZE = 0x5;
Event.INSTANCE_CREATED = 0x6;
Event.INSTANCE_DISPOSED = 0x7;
Event.OBJECT_CREATED = 0x8;
Event.OBJECT_DISPOSED = 0x9;
Event.OBJECT_INITIALIZED = 0xa;
Event.PAUSE = 0xb;
Event.RESTART = 0xc;
Event.START = 0xd;
Event.UPDATE_FROM_INSTANCE_AFTER = 0xe;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0xf;
Event.UPDATE_INSTANCE_AFTER = 0x10;
Event.UPDATE_INSTANCE_BEFORE = 0x11;
Event.MAX_EVENTS = 0x12;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'create_instance';
case 0x2 : return 'dispose_instance';
case 0x3 : return 'dispose_object';
case 0x4 : return 'get_runtime';
case 0x5 : return 'get_window_size';
case 0x6 : return 'instance_created';
case 0x7 : return 'instance_disposed';
case 0x8 : return 'object_created';
case 0x9 : return 'object_disposed';
case 0xa : return 'object_initialized';
case 0xb : return 'pause';
case 0xc : return 'restart';
case 0xd : return 'start';
case 0xe : return 'update_from_instance_after';
case 0xf : return 'update_from_instance_before';
case 0x10 : return 'update_instance_after';
case 0x11 : return 'update_instance_before';
default :
throw new Error('Event type not defined : ' + eventId);
}
};
//EVENT_GENERATED_END
module.exports = Event;

View File

@ -1,4 +1,3 @@
const Event = require('r3-event');
const Utils = require('r3-utils');
/**
@ -6,15 +5,6 @@ const Utils = require('r3-utils');
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class Event {
@ -22,16 +12,12 @@ class Event {
//CONSTRUCTOR_TEMPLATE_START
constructor(options) {
if (Utils.UndefinedOrNull(options)) {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'Event (' + options.id + ')';
Event.Emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (typeof options === 'undefined') {
options = {};
}
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
@ -46,110 +32,6 @@ class Event {
}
//CONSTRUCTOR_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
}
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
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
//CUSTOM_UPDATE_INSTANCE_START
//CUSTOM_UPDATE_INSTANCE_END
//UPDATE_INSTANCE_AFTER_START
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
//UPDATE_INSTANCE_AFTER_END
}
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
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
//CUSTOM_UPDATE_FROM_INSTANCE_START
//CUSTOM_UPDATE_FROM_INSTANCE_END
//UPDATE_FROM_INSTANCE_AFTER_START
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
//UPDATE_FROM_INSTANCE_AFTER_END
}
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
//DISPOSE_AFTER_END
}
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
//DISPOSE_INSTANCE_AFTER_END
}
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
/**
@ -317,15 +199,15 @@ class Event {
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//EVENT_GENERATED_START
Event.CREATE_INSTANCE = 0x1;
Event.DISPOSE_INSTANCE = 0x2;
Event.DISPOSE_OBJECT = 0x3;
Event.GET_RUNTIME = 0x4;
Event.GET_WINDOW_SIZE = 0x5;
Event.INSTANCE_CREATED = 0x6;
Event.INSTANCE_DISPOSED = 0x7;
Event.OBJECT_CREATED = 0x8;
Event.OBJECT_DISPOSED = 0x9;
Event.COMPONENT_INITIALIZED = 0x1;
Event.CREATE_INSTANCE_BEFORE = 0x2;
Event.DISPOSE_INSTANCE = 0x3;
Event.DISPOSE_OBJECT = 0x4;
Event.GET_RUNTIME = 0x5;
Event.GET_WINDOW_SIZE = 0x6;
Event.INSTANCE_CREATED = 0x7;
Event.INSTANCE_DISPOSED = 0x8;
Event.OBJECT_CREATED = 0x9;
Event.OBJECT_INITIALIZED = 0xa;
Event.PAUSE = 0xb;
Event.RESTART = 0xc;
@ -339,15 +221,15 @@ Event.MAX_EVENTS = 0x12;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'create_instance';
case 0x2 : return 'dispose_instance';
case 0x3 : return 'dispose_object';
case 0x4 : return 'get_runtime';
case 0x5 : return 'get_window_size';
case 0x6 : return 'instance_created';
case 0x7 : return 'instance_disposed';
case 0x8 : return 'object_created';
case 0x9 : return 'object_disposed';
case 0x1 : return 'component_initialized';
case 0x2 : return 'create_instance_before';
case 0x3 : return 'dispose_instance';
case 0x4 : return 'dispose_object';
case 0x5 : return 'get_runtime';
case 0x6 : return 'get_window_size';
case 0x7 : return 'instance_created';
case 0x8 : return 'instance_disposed';
case 0x9 : return 'object_created';
case 0xa : return 'object_initialized';
case 0xb : return 'pause';
case 0xc : return 'restart';

View File

@ -5,28 +5,26 @@ const R3Object = require('r3-r3-object.js');
/**
OPTIONS_START
x=1
y=2
z=3
register=true
isPublic=true
applicationMode=Project.APPLICATION_MODE_EDIT
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
x=side.x
y=side.y
z=side.z
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
entities=[Entity]
controls=[Control]
images=[Image]
code=[CustomCode]
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
register
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class AnotherClass extends R3Object {
class Project extends R3Object {
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
constructor(options) {
@ -35,25 +33,19 @@ class AnotherClass extends R3Object {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'AnotherClass (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (Utils.UndefinedOrNull(options.x)) {
options.x = 1;
if (typeof options === 'undefined') {
options = {};
}
if (Utils.UndefinedOrNull(options.y)) {
options.y = 2;
if (Utils.UndefinedOrNull(options.isPublic)) {
options.isPublic = true;
}
if (Utils.UndefinedOrNull(options.z)) {
options.z = 3;
}
if (Utils.UndefinedOrNull(options.register)) {
options.register = true;
if (Utils.UndefinedOrNull(options.applicationMode)) {
options.applicationMode = Project.APPLICATION_MODE_EDIT;
}
//OPTIONS_INIT_END
@ -73,27 +65,23 @@ class AnotherClass extends R3Object {
createInstance() {
//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
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
'isPublic': this.isPublic,
'applicationMode': this.applicationMode
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
@ -108,16 +96,12 @@ class AnotherClass extends R3Object {
//UPDATE_INSTANCE_BEFORE_END
//UPDATE_INSTANCE_OPTIONS_START
if (property === 'x') {
this.instance.side.x = this.x;
if (property === 'isPublic') {
this.instance.isPublic = this.isPublic;
return;
}
if (property === 'y') {
this.instance.side.y = this.y;
return;
}
if (property === 'z') {
this.instance.side.z = this.z;
if (property === 'applicationMode') {
this.instance.applicationMode = this.applicationMode;
return;
}
//UPDATE_INSTANCE_OPTIONS_END
@ -140,17 +124,17 @@ class AnotherClass extends R3Object {
//UPDATE_FROM_INSTANCE_BEFORE_END
//UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'x') {
this.x = this.instance.side.x;
return;
if (property === 'isPublic' || property === 'all') {
this.isPublic = this.instance.isPublic;
if (property !== 'all') {
return;
}
}
if (property === 'y') {
this.y = this.instance.side.y;
return;
}
if (property === 'z') {
this.z = this.instance.side.z;
return;
if (property === 'applicationMode' || property === 'all') {
this.applicationMode = this.instance.applicationMode;
if (property !== 'all') {
return;
}
}
//UPDATE_FROM_INSTANCE_OPTIONS_END
@ -168,14 +152,21 @@ class AnotherClass extends R3Object {
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();
//DISPOSE_AFTER_END
}
@ -185,15 +176,14 @@ class AnotherClass extends R3Object {
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_AFTER_END
}
@ -205,6 +195,15 @@ class AnotherClass extends R3Object {
}
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
Project.CAMERA_INDEX_EDIT = 0x0;
Project.CAMERA_INDEX_RUN = 0x1;
Project.APPLICATION_MODE_EDIT = Project.CAMERA_INDEX_EDIT;
Project.APPLICATION_MODE_RUN = Project.CAMERA_INDEX_RUN;
Project.RENDERER_INDEX_MAIN = 0x0;
Project.RENDER_TARGET_INDEX_NONE = -0x1;
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = AnotherClass;
module.exports = Project;

View File

@ -4,6 +4,9 @@ const Event = require('r3-event.js');
/**
OPTIONS_START
id=Utils.RandomId(10)
name=this.constructor.name + '(' + options.id + ')'
register=true
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
@ -13,6 +16,9 @@ const Event = require('r3-event.js');
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
id
name
register
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
@ -26,14 +32,23 @@ class R3Object extends Event {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'R3Object (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START
if (typeof options === 'undefined') {
options = {};
}
if (Utils.UndefinedOrNull(options.id)) {
options.id = Utils.RandomId(10);
}
if (Utils.UndefinedOrNull(options.name)) {
options.name = this.constructor.name + '(' + options.id + ')';
}
if (Utils.UndefinedOrNull(options.register)) {
options.register = true;
}
//OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
@ -52,25 +67,21 @@ class R3Object extends Event {
createInstance() {
//CREATE_INSTANCE_BEFORE_START
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
//CREATE_INSTANCE_BEFORE_END
//CUSTOM_CREATE_INSTANCE_START
//CUSTOM_CREATE_INSTANCE_END
//CREATE_INSTANCE_AFTER_START
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);
//CREATE_INSTANCE_AFTER_END
@ -121,14 +132,21 @@ class R3Object extends Event {
dispose() {
//DISPOSE_BEFORE_START
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);
//DISPOSE_BEFORE_END
//CUSTOM_DISPOSE_START
//CUSTOM_DISPOSE_END
//DISPOSE_AFTER_START
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();
//DISPOSE_AFTER_END
}
@ -138,15 +156,14 @@ class R3Object extends Event {
disposeInstance() {
//DISPOSE_INSTANCE_BEFORE_START
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);
//DISPOSE_INSTANCE_BEFORE_END
//CUSTOM_DISPOSE_INSTANCE_START
//CUSTOM_DISPOSE_INSTANCE_END
//DISPOSE_INSTANCE_AFTER_START
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);
//DISPOSE_INSTANCE_AFTER_END
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,5 @@
constructor(options) {
if (Utils.UndefinedOrNull(options)) {
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'CLASS_NAME (' + options.id + ')';
Event.Emit(Event.OBJECT_CREATED, this);
//OPTIONS_INIT_START

View File

@ -4,9 +4,6 @@
options = {};
}
options.id = Utils.RandomId(10);
options.name = 'CLASS_NAME (' + options.id + ')';
super(options);
this.emit(Event.OBJECT_CREATED, this);

View File

@ -1 +1,9 @@
this[this.runtime].createInstance(
this,
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
}
)
this.emit(Event.INSTANCE_CREATED, this);

View File

@ -1,12 +1 @@
super.createInstance();
this.emit(Event.CREATE_INSTANCE, this);
if (this.runtime === 'graphics') {
this.graphics.createInstance(
{
//CREATE_INSTANCE_OPTIONS_START
//CREATE_INSTANCE_OPTIONS_END
},
this
)
}
this.emit(Event.CREATE_INSTANCE_BEFORE, this);

View File

@ -1 +1 @@
'INSTANCE_KEY': this.KEY
'INSTANCE_KEY': this.KEY

View File

@ -1 +1 @@
this.emit(Event.OBJECT_DISPOSED, this);
this.disposeInstance();

View File

@ -1 +1,8 @@
this.emit(Event.DISPOSE_OBJECT, this);
this.subscribe(
Event.INSTANCE_DISPOSED,
function(object) {
if (object === this) {
this.emit(Event.DISPOSE_OBJECT, this);
}
}
);

View File

@ -1 +1 @@
this.emit(Event.INSTANCE_DISPOSED, this);
this.emit(Event.DISPOSE_INSTANCE, this);

View File

@ -1,2 +1 @@
super.disposeInstance();
this.emit(Event.DISPOSE_INSTANCE, this);
console.log('Disposing instance of ' + this.name);

View File

@ -6,15 +6,6 @@ const Utils = require('r3-utils');
OPTIONS_START
OPTIONS_END
INSTANCE_OPTIONS_MAPPING_START
INSTANCE_OPTIONS_MAPPING_END
LINKED_OBJECTS_START
LINKED_OBJECTS_END
EXCLUDED_FROM_INSTANCE_OPTIONS_START
EXCLUDED_FROM_INSTANCE_OPTIONS_END
**/
class CLASS_NAME {
@ -22,21 +13,6 @@ class CLASS_NAME {
//CONSTRUCTOR_TEMPLATE_START
//CONSTRUCTOR_TEMPLATE_END
//CREATE_INSTANCE_TEMPLATE_START
//CREATE_INSTANCE_TEMPLATE_END
//UPDATE_INSTANCE_TEMPLATE_START
//UPDATE_INSTANCE_TEMPLATE_END
//UPDATE_FROM_INSTANCE_TEMPLATE_START
//UPDATE_FROM_INSTANCE_TEMPLATE_END
//DISPOSE_TEMPLATE_START
//DISPOSE_TEMPLATE_END
//DISPOSE_INSTANCE_TEMPLATE_START
//DISPOSE_INSTANCE_TEMPLATE_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END

View File

@ -0,0 +1,3 @@
if (typeof options === 'undefined') {
options = {};
}

View File

@ -1,4 +1,6 @@
if (property === 'KEY') {
if (property === 'KEY' || property === 'all') {
this.KEY = this.instance.INSTANCE_KEY;
return;
if (property !== 'all') {
return;
}
}

View File

@ -157,9 +157,10 @@ foreach ($files as $file) {
/**
* Process the constructor options
*/
$header = file_get_contents('src/templates/options_init_header.template');
$template = file_get_contents('src/templates/options_init.template');
$newOptions = '';
$newOptions = $header;
foreach ($options as $key => $value) {
$updated = str_replace('KEY', $key, $template);
@ -200,16 +201,18 @@ foreach ($files as $file) {
array_push($newOptions, $updated);
}
$contents = file_get_contents($file);
if (sizeof($newOptions) > 0) {
$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
);
$contents = file_get_contents($file);
file_put_contents($file, $contents);
$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//CREATE_INSTANCE_OPTIONS_END",
$contents
);
file_put_contents($file, $contents);
}
/**
* Process updateInstance options
*/

View File

@ -161,6 +161,7 @@ foreach ($files as $file) {
echo "Restored file " . $file;
unlink($saveFile);
}
}