cool :)
parent
fd5eba2cc6
commit
31b2bc87e3
11
.r3_history
11
.r3_history
|
@ -1,8 +1,5 @@
|
||||||
r3 create VectorApplierAgain extends Event
|
r3 create Event normal
|
||||||
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 R3Object extends Event
|
r3 create R3Object extends Event
|
||||||
r3 create SomeTest extends Event
|
r3 create Utils normal
|
||||||
|
r3 create Component extends R3Object
|
||||||
|
r3 create Project extends R3Object
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
const Event = require('r3-event');
|
||||||
const Utils = require('r3-utils');
|
const Utils = require('r3-utils');
|
||||||
const Event = require('r3-event.js');
|
const R3Object = require('r3-r3-object.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
a=2.0
|
runtime='default'
|
||||||
b=3.0
|
|
||||||
something='hello'
|
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
|
@ -16,12 +15,12 @@ const Event = require('r3-event.js');
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
b
|
runtime
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class VectorApplierAgain extends Event {
|
class Component extends R3Object {
|
||||||
|
|
||||||
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -30,22 +29,16 @@ class VectorApplierAgain extends Event {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'VectorApplierAgain (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
if (Utils.UndefinedOrNull(options.a)) {
|
if (typeof options === 'undefined') {
|
||||||
options.a = 2.0;
|
options = {};
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.b)) {
|
if (Utils.UndefinedOrNull(options.runtime)) {
|
||||||
options.b = 3.0;
|
options.runtime = 'default';
|
||||||
}
|
|
||||||
if (Utils.UndefinedOrNull(options.something)) {
|
|
||||||
options.something = 'hello';
|
|
||||||
}
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
@ -55,6 +48,7 @@ class VectorApplierAgain extends Event {
|
||||||
Object.assign(this, options);
|
Object.assign(this, options);
|
||||||
|
|
||||||
//CUSTOM_BEFORE_INIT_START
|
//CUSTOM_BEFORE_INIT_START
|
||||||
|
this.emit(Event.COMPONENT_INITIALIZED, this);
|
||||||
//CUSTOM_BEFORE_INIT_END
|
//CUSTOM_BEFORE_INIT_END
|
||||||
|
|
||||||
this.emit(Event.OBJECT_INITIALIZED, this);
|
this.emit(Event.OBJECT_INITIALIZED, this);
|
||||||
|
@ -65,26 +59,21 @@ class VectorApplierAgain extends Event {
|
||||||
createInstance() {
|
createInstance() {
|
||||||
|
|
||||||
//CREATE_INSTANCE_BEFORE_START
|
//CREATE_INSTANCE_BEFORE_START
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
//CREATE_INSTANCE_BEFORE_END
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
//CREATE_INSTANCE_AFTER_START
|
//CREATE_INSTANCE_AFTER_START
|
||||||
|
this[this.runtime].createInstance(
|
||||||
|
this,
|
||||||
|
{
|
||||||
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
this.emit(Event.INSTANCE_CREATED, this);
|
this.emit(Event.INSTANCE_CREATED, this);
|
||||||
//CREATE_INSTANCE_AFTER_END
|
//CREATE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
|
@ -99,14 +88,6 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_INSTANCE_BEFORE_END
|
//UPDATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//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
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
//CUSTOM_UPDATE_INSTANCE_START
|
//CUSTOM_UPDATE_INSTANCE_START
|
||||||
|
@ -127,14 +108,6 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//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
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||||
|
@ -151,14 +124,21 @@ class VectorApplierAgain extends Event {
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
||||||
//DISPOSE_BEFORE_START
|
//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
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
//DISPOSE_AFTER_START
|
//DISPOSE_AFTER_START
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
||||||
//DISPOSE_AFTER_END
|
//DISPOSE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -168,15 +148,14 @@ class VectorApplierAgain extends Event {
|
||||||
disposeInstance() {
|
disposeInstance() {
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_START
|
//DISPOSE_INSTANCE_BEFORE_START
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_AFTER_START
|
//DISPOSE_INSTANCE_AFTER_START
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_AFTER_END
|
//DISPOSE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -190,4 +169,4 @@ class VectorApplierAgain extends Event {
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||||
|
|
||||||
module.exports = VectorApplierAgain;
|
module.exports = Component;
|
|
@ -1,4 +1,3 @@
|
||||||
const Event = require('r3-event');
|
|
||||||
const Utils = require('r3-utils');
|
const Utils = require('r3-utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,15 +5,6 @@ const Utils = require('r3-utils');
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
OPTIONS_END
|
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 {
|
class Event {
|
||||||
|
@ -22,16 +12,12 @@ class Event {
|
||||||
//CONSTRUCTOR_TEMPLATE_START
|
//CONSTRUCTOR_TEMPLATE_START
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
|
||||||
if (Utils.UndefinedOrNull(options)) {
|
|
||||||
options = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'Event (' + options.id + ')';
|
|
||||||
|
|
||||||
Event.Emit(Event.OBJECT_CREATED, this);
|
Event.Emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
|
if (typeof options === 'undefined') {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
|
@ -46,110 +32,6 @@ class Event {
|
||||||
}
|
}
|
||||||
//CONSTRUCTOR_TEMPLATE_END
|
//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
|
//CUSTOM_IMPLEMENTATION_START
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -317,15 +199,15 @@ class Event {
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||||
|
|
||||||
//EVENT_GENERATED_START
|
//EVENT_GENERATED_START
|
||||||
Event.CREATE_INSTANCE = 0x1;
|
Event.COMPONENT_INITIALIZED = 0x1;
|
||||||
Event.DISPOSE_INSTANCE = 0x2;
|
Event.CREATE_INSTANCE_BEFORE = 0x2;
|
||||||
Event.DISPOSE_OBJECT = 0x3;
|
Event.DISPOSE_INSTANCE = 0x3;
|
||||||
Event.GET_RUNTIME = 0x4;
|
Event.DISPOSE_OBJECT = 0x4;
|
||||||
Event.GET_WINDOW_SIZE = 0x5;
|
Event.GET_RUNTIME = 0x5;
|
||||||
Event.INSTANCE_CREATED = 0x6;
|
Event.GET_WINDOW_SIZE = 0x6;
|
||||||
Event.INSTANCE_DISPOSED = 0x7;
|
Event.INSTANCE_CREATED = 0x7;
|
||||||
Event.OBJECT_CREATED = 0x8;
|
Event.INSTANCE_DISPOSED = 0x8;
|
||||||
Event.OBJECT_DISPOSED = 0x9;
|
Event.OBJECT_CREATED = 0x9;
|
||||||
Event.OBJECT_INITIALIZED = 0xa;
|
Event.OBJECT_INITIALIZED = 0xa;
|
||||||
Event.PAUSE = 0xb;
|
Event.PAUSE = 0xb;
|
||||||
Event.RESTART = 0xc;
|
Event.RESTART = 0xc;
|
||||||
|
@ -339,15 +221,15 @@ Event.MAX_EVENTS = 0x12;
|
||||||
Event.GetEventName = function(eventId) {
|
Event.GetEventName = function(eventId) {
|
||||||
|
|
||||||
switch(eventId) {
|
switch(eventId) {
|
||||||
case 0x1 : return 'create_instance';
|
case 0x1 : return 'component_initialized';
|
||||||
case 0x2 : return 'dispose_instance';
|
case 0x2 : return 'create_instance_before';
|
||||||
case 0x3 : return 'dispose_object';
|
case 0x3 : return 'dispose_instance';
|
||||||
case 0x4 : return 'get_runtime';
|
case 0x4 : return 'dispose_object';
|
||||||
case 0x5 : return 'get_window_size';
|
case 0x5 : return 'get_runtime';
|
||||||
case 0x6 : return 'instance_created';
|
case 0x6 : return 'get_window_size';
|
||||||
case 0x7 : return 'instance_disposed';
|
case 0x7 : return 'instance_created';
|
||||||
case 0x8 : return 'object_created';
|
case 0x8 : return 'instance_disposed';
|
||||||
case 0x9 : return 'object_disposed';
|
case 0x9 : return 'object_created';
|
||||||
case 0xa : return 'object_initialized';
|
case 0xa : return 'object_initialized';
|
||||||
case 0xb : return 'pause';
|
case 0xb : return 'pause';
|
||||||
case 0xc : return 'restart';
|
case 0xc : return 'restart';
|
||||||
|
|
|
@ -5,28 +5,26 @@ const R3Object = require('r3-r3-object.js');
|
||||||
/**
|
/**
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
x=1
|
isPublic=true
|
||||||
y=2
|
applicationMode=Project.APPLICATION_MODE_EDIT
|
||||||
z=3
|
|
||||||
register=true
|
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
x=side.x
|
|
||||||
y=side.y
|
|
||||||
z=side.z
|
|
||||||
INSTANCE_OPTIONS_MAPPING_END
|
INSTANCE_OPTIONS_MAPPING_END
|
||||||
|
|
||||||
LINKED_OBJECTS_START
|
LINKED_OBJECTS_START
|
||||||
|
entities=[Entity]
|
||||||
|
controls=[Control]
|
||||||
|
images=[Image]
|
||||||
|
code=[CustomCode]
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
register
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class AnotherClass extends R3Object {
|
class Project extends R3Object {
|
||||||
|
|
||||||
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -35,25 +33,19 @@ class AnotherClass extends R3Object {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'AnotherClass (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
if (Utils.UndefinedOrNull(options.x)) {
|
if (typeof options === 'undefined') {
|
||||||
options.x = 1;
|
options = {};
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.y)) {
|
if (Utils.UndefinedOrNull(options.isPublic)) {
|
||||||
options.y = 2;
|
options.isPublic = true;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.z)) {
|
if (Utils.UndefinedOrNull(options.applicationMode)) {
|
||||||
options.z = 3;
|
options.applicationMode = Project.APPLICATION_MODE_EDIT;
|
||||||
}
|
|
||||||
if (Utils.UndefinedOrNull(options.register)) {
|
|
||||||
options.register = true;
|
|
||||||
}
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
@ -73,27 +65,23 @@ class AnotherClass extends R3Object {
|
||||||
createInstance() {
|
createInstance() {
|
||||||
|
|
||||||
//CREATE_INSTANCE_BEFORE_START
|
//CREATE_INSTANCE_BEFORE_START
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
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
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
//CREATE_INSTANCE_AFTER_START
|
//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);
|
this.emit(Event.INSTANCE_CREATED, this);
|
||||||
//CREATE_INSTANCE_AFTER_END
|
//CREATE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
|
@ -108,16 +96,12 @@ class AnotherClass extends R3Object {
|
||||||
//UPDATE_INSTANCE_BEFORE_END
|
//UPDATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//UPDATE_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'isPublic') {
|
||||||
this.instance.side.x = this.x;
|
this.instance.isPublic = this.isPublic;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'applicationMode') {
|
||||||
this.instance.side.y = this.y;
|
this.instance.applicationMode = this.applicationMode;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (property === 'z') {
|
|
||||||
this.instance.side.z = this.z;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//UPDATE_INSTANCE_OPTIONS_END
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
@ -140,17 +124,17 @@ class AnotherClass extends R3Object {
|
||||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'isPublic' || property === 'all') {
|
||||||
this.x = this.instance.side.x;
|
this.isPublic = this.instance.isPublic;
|
||||||
return;
|
if (property !== 'all') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'applicationMode' || property === 'all') {
|
||||||
this.y = this.instance.side.y;
|
this.applicationMode = this.instance.applicationMode;
|
||||||
return;
|
if (property !== 'all') {
|
||||||
}
|
return;
|
||||||
if (property === 'z') {
|
}
|
||||||
this.z = this.instance.side.z;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
@ -168,14 +152,21 @@ class AnotherClass extends R3Object {
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
||||||
//DISPOSE_BEFORE_START
|
//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
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
//DISPOSE_AFTER_START
|
//DISPOSE_AFTER_START
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
||||||
//DISPOSE_AFTER_END
|
//DISPOSE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -185,15 +176,14 @@ class AnotherClass extends R3Object {
|
||||||
disposeInstance() {
|
disposeInstance() {
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_START
|
//DISPOSE_INSTANCE_BEFORE_START
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_AFTER_START
|
//DISPOSE_INSTANCE_AFTER_START
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_AFTER_END
|
//DISPOSE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,6 +195,15 @@ class AnotherClass extends R3Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
//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
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||||
|
|
||||||
module.exports = AnotherClass;
|
module.exports = Project;
|
|
@ -4,6 +4,9 @@ const Event = require('r3-event.js');
|
||||||
/**
|
/**
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
|
id=Utils.RandomId(10)
|
||||||
|
name=this.constructor.name + '(' + options.id + ')'
|
||||||
|
register=true
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
|
@ -13,6 +16,9 @@ const Event = require('r3-event.js');
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
|
id
|
||||||
|
name
|
||||||
|
register
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -26,14 +32,23 @@ class R3Object extends Event {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'R3Object (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//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
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
|
@ -52,25 +67,21 @@ class R3Object extends Event {
|
||||||
createInstance() {
|
createInstance() {
|
||||||
|
|
||||||
//CREATE_INSTANCE_BEFORE_START
|
//CREATE_INSTANCE_BEFORE_START
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
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
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
//CREATE_INSTANCE_AFTER_START
|
//CREATE_INSTANCE_AFTER_START
|
||||||
|
this[this.runtime].createInstance(
|
||||||
|
this,
|
||||||
|
{
|
||||||
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
this.emit(Event.INSTANCE_CREATED, this);
|
this.emit(Event.INSTANCE_CREATED, this);
|
||||||
//CREATE_INSTANCE_AFTER_END
|
//CREATE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
|
@ -121,14 +132,21 @@ class R3Object extends Event {
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
||||||
//DISPOSE_BEFORE_START
|
//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
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
//DISPOSE_AFTER_START
|
//DISPOSE_AFTER_START
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
||||||
//DISPOSE_AFTER_END
|
//DISPOSE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -138,15 +156,14 @@ class R3Object extends Event {
|
||||||
disposeInstance() {
|
disposeInstance() {
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_START
|
//DISPOSE_INSTANCE_BEFORE_START
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_AFTER_START
|
//DISPOSE_INSTANCE_AFTER_START
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_AFTER_END
|
//DISPOSE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@ class R3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
static version() {
|
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)';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,12 +1,11 @@
|
||||||
|
const Event = require('r3-event');
|
||||||
const Utils = require('r3-utils');
|
const Utils = require('r3-utils');
|
||||||
const Event = require('r3-event.js');
|
const R3Object = require('r3-r3-object.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
a=2.0
|
runtime='default'
|
||||||
b=3.0
|
|
||||||
something='hello'
|
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
|
@ -16,12 +15,12 @@ const Event = require('r3-event.js');
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
b
|
runtime
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class VectorApplierAgain extends Event {
|
class Component extends R3Object {
|
||||||
|
|
||||||
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -30,22 +29,16 @@ class VectorApplierAgain extends Event {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'VectorApplierAgain (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
if (Utils.UndefinedOrNull(options.a)) {
|
if (typeof options === 'undefined') {
|
||||||
options.a = 2.0;
|
options = {};
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.b)) {
|
if (Utils.UndefinedOrNull(options.runtime)) {
|
||||||
options.b = 3.0;
|
options.runtime = 'default';
|
||||||
}
|
|
||||||
if (Utils.UndefinedOrNull(options.something)) {
|
|
||||||
options.something = 'hello';
|
|
||||||
}
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
@ -55,6 +48,7 @@ class VectorApplierAgain extends Event {
|
||||||
Object.assign(this, options);
|
Object.assign(this, options);
|
||||||
|
|
||||||
//CUSTOM_BEFORE_INIT_START
|
//CUSTOM_BEFORE_INIT_START
|
||||||
|
this.emit(Event.COMPONENT_INITIALIZED, this);
|
||||||
//CUSTOM_BEFORE_INIT_END
|
//CUSTOM_BEFORE_INIT_END
|
||||||
|
|
||||||
this.emit(Event.OBJECT_INITIALIZED, this);
|
this.emit(Event.OBJECT_INITIALIZED, this);
|
||||||
|
@ -65,26 +59,21 @@ class VectorApplierAgain extends Event {
|
||||||
createInstance() {
|
createInstance() {
|
||||||
|
|
||||||
//CREATE_INSTANCE_BEFORE_START
|
//CREATE_INSTANCE_BEFORE_START
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
//CREATE_INSTANCE_BEFORE_END
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
//CREATE_INSTANCE_AFTER_START
|
//CREATE_INSTANCE_AFTER_START
|
||||||
|
this[this.runtime].createInstance(
|
||||||
|
this,
|
||||||
|
{
|
||||||
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
this.emit(Event.INSTANCE_CREATED, this);
|
this.emit(Event.INSTANCE_CREATED, this);
|
||||||
//CREATE_INSTANCE_AFTER_END
|
//CREATE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
|
@ -99,14 +88,6 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_INSTANCE_BEFORE_END
|
//UPDATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//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
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
//CUSTOM_UPDATE_INSTANCE_START
|
//CUSTOM_UPDATE_INSTANCE_START
|
||||||
|
@ -127,14 +108,6 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//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
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||||
|
@ -151,14 +124,21 @@ class VectorApplierAgain extends Event {
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
||||||
//DISPOSE_BEFORE_START
|
//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
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
//DISPOSE_AFTER_START
|
//DISPOSE_AFTER_START
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
||||||
//DISPOSE_AFTER_END
|
//DISPOSE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -168,15 +148,14 @@ class VectorApplierAgain extends Event {
|
||||||
disposeInstance() {
|
disposeInstance() {
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_START
|
//DISPOSE_INSTANCE_BEFORE_START
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_AFTER_START
|
//DISPOSE_INSTANCE_AFTER_START
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_AFTER_END
|
//DISPOSE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -190,4 +169,4 @@ class VectorApplierAgain extends Event {
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||||
|
|
||||||
module.exports = VectorApplierAgain;
|
module.exports = Component;
|
|
@ -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;
|
|
|
@ -1,4 +1,3 @@
|
||||||
const Event = require('r3-event');
|
|
||||||
const Utils = require('r3-utils');
|
const Utils = require('r3-utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,15 +5,6 @@ const Utils = require('r3-utils');
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
OPTIONS_END
|
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 {
|
class Event {
|
||||||
|
@ -22,16 +12,12 @@ class Event {
|
||||||
//CONSTRUCTOR_TEMPLATE_START
|
//CONSTRUCTOR_TEMPLATE_START
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
|
||||||
if (Utils.UndefinedOrNull(options)) {
|
|
||||||
options = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'Event (' + options.id + ')';
|
|
||||||
|
|
||||||
Event.Emit(Event.OBJECT_CREATED, this);
|
Event.Emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
|
if (typeof options === 'undefined') {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
|
@ -46,110 +32,6 @@ class Event {
|
||||||
}
|
}
|
||||||
//CONSTRUCTOR_TEMPLATE_END
|
//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
|
//CUSTOM_IMPLEMENTATION_START
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -317,15 +199,15 @@ class Event {
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||||
|
|
||||||
//EVENT_GENERATED_START
|
//EVENT_GENERATED_START
|
||||||
Event.CREATE_INSTANCE = 0x1;
|
Event.COMPONENT_INITIALIZED = 0x1;
|
||||||
Event.DISPOSE_INSTANCE = 0x2;
|
Event.CREATE_INSTANCE_BEFORE = 0x2;
|
||||||
Event.DISPOSE_OBJECT = 0x3;
|
Event.DISPOSE_INSTANCE = 0x3;
|
||||||
Event.GET_RUNTIME = 0x4;
|
Event.DISPOSE_OBJECT = 0x4;
|
||||||
Event.GET_WINDOW_SIZE = 0x5;
|
Event.GET_RUNTIME = 0x5;
|
||||||
Event.INSTANCE_CREATED = 0x6;
|
Event.GET_WINDOW_SIZE = 0x6;
|
||||||
Event.INSTANCE_DISPOSED = 0x7;
|
Event.INSTANCE_CREATED = 0x7;
|
||||||
Event.OBJECT_CREATED = 0x8;
|
Event.INSTANCE_DISPOSED = 0x8;
|
||||||
Event.OBJECT_DISPOSED = 0x9;
|
Event.OBJECT_CREATED = 0x9;
|
||||||
Event.OBJECT_INITIALIZED = 0xa;
|
Event.OBJECT_INITIALIZED = 0xa;
|
||||||
Event.PAUSE = 0xb;
|
Event.PAUSE = 0xb;
|
||||||
Event.RESTART = 0xc;
|
Event.RESTART = 0xc;
|
||||||
|
@ -339,15 +221,15 @@ Event.MAX_EVENTS = 0x12;
|
||||||
Event.GetEventName = function(eventId) {
|
Event.GetEventName = function(eventId) {
|
||||||
|
|
||||||
switch(eventId) {
|
switch(eventId) {
|
||||||
case 0x1 : return 'create_instance';
|
case 0x1 : return 'component_initialized';
|
||||||
case 0x2 : return 'dispose_instance';
|
case 0x2 : return 'create_instance_before';
|
||||||
case 0x3 : return 'dispose_object';
|
case 0x3 : return 'dispose_instance';
|
||||||
case 0x4 : return 'get_runtime';
|
case 0x4 : return 'dispose_object';
|
||||||
case 0x5 : return 'get_window_size';
|
case 0x5 : return 'get_runtime';
|
||||||
case 0x6 : return 'instance_created';
|
case 0x6 : return 'get_window_size';
|
||||||
case 0x7 : return 'instance_disposed';
|
case 0x7 : return 'instance_created';
|
||||||
case 0x8 : return 'object_created';
|
case 0x8 : return 'instance_disposed';
|
||||||
case 0x9 : return 'object_disposed';
|
case 0x9 : return 'object_created';
|
||||||
case 0xa : return 'object_initialized';
|
case 0xa : return 'object_initialized';
|
||||||
case 0xb : return 'pause';
|
case 0xb : return 'pause';
|
||||||
case 0xc : return 'restart';
|
case 0xc : return 'restart';
|
||||||
|
|
|
@ -5,28 +5,26 @@ const R3Object = require('r3-r3-object.js');
|
||||||
/**
|
/**
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
x=1
|
isPublic=true
|
||||||
y=2
|
applicationMode=Project.APPLICATION_MODE_EDIT
|
||||||
z=3
|
|
||||||
register=true
|
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
x=side.x
|
|
||||||
y=side.y
|
|
||||||
z=side.z
|
|
||||||
INSTANCE_OPTIONS_MAPPING_END
|
INSTANCE_OPTIONS_MAPPING_END
|
||||||
|
|
||||||
LINKED_OBJECTS_START
|
LINKED_OBJECTS_START
|
||||||
|
entities=[Entity]
|
||||||
|
controls=[Control]
|
||||||
|
images=[Image]
|
||||||
|
code=[CustomCode]
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
register
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class AnotherClass extends R3Object {
|
class Project extends R3Object {
|
||||||
|
|
||||||
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
//CONSTRUCTOR_EXTENDS_TEMPLATE_START
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -35,25 +33,19 @@ class AnotherClass extends R3Object {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'AnotherClass (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
if (Utils.UndefinedOrNull(options.x)) {
|
if (typeof options === 'undefined') {
|
||||||
options.x = 1;
|
options = {};
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.y)) {
|
if (Utils.UndefinedOrNull(options.isPublic)) {
|
||||||
options.y = 2;
|
options.isPublic = true;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.z)) {
|
if (Utils.UndefinedOrNull(options.applicationMode)) {
|
||||||
options.z = 3;
|
options.applicationMode = Project.APPLICATION_MODE_EDIT;
|
||||||
}
|
|
||||||
if (Utils.UndefinedOrNull(options.register)) {
|
|
||||||
options.register = true;
|
|
||||||
}
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
@ -73,27 +65,23 @@ class AnotherClass extends R3Object {
|
||||||
createInstance() {
|
createInstance() {
|
||||||
|
|
||||||
//CREATE_INSTANCE_BEFORE_START
|
//CREATE_INSTANCE_BEFORE_START
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
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
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
//CREATE_INSTANCE_AFTER_START
|
//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);
|
this.emit(Event.INSTANCE_CREATED, this);
|
||||||
//CREATE_INSTANCE_AFTER_END
|
//CREATE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
|
@ -108,16 +96,12 @@ class AnotherClass extends R3Object {
|
||||||
//UPDATE_INSTANCE_BEFORE_END
|
//UPDATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//UPDATE_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'isPublic') {
|
||||||
this.instance.side.x = this.x;
|
this.instance.isPublic = this.isPublic;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'applicationMode') {
|
||||||
this.instance.side.y = this.y;
|
this.instance.applicationMode = this.applicationMode;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (property === 'z') {
|
|
||||||
this.instance.side.z = this.z;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//UPDATE_INSTANCE_OPTIONS_END
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
@ -140,17 +124,17 @@ class AnotherClass extends R3Object {
|
||||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'isPublic' || property === 'all') {
|
||||||
this.x = this.instance.side.x;
|
this.isPublic = this.instance.isPublic;
|
||||||
return;
|
if (property !== 'all') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'applicationMode' || property === 'all') {
|
||||||
this.y = this.instance.side.y;
|
this.applicationMode = this.instance.applicationMode;
|
||||||
return;
|
if (property !== 'all') {
|
||||||
}
|
return;
|
||||||
if (property === 'z') {
|
}
|
||||||
this.z = this.instance.side.z;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
@ -168,14 +152,21 @@ class AnotherClass extends R3Object {
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
||||||
//DISPOSE_BEFORE_START
|
//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
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
//DISPOSE_AFTER_START
|
//DISPOSE_AFTER_START
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
||||||
//DISPOSE_AFTER_END
|
//DISPOSE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -185,15 +176,14 @@ class AnotherClass extends R3Object {
|
||||||
disposeInstance() {
|
disposeInstance() {
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_START
|
//DISPOSE_INSTANCE_BEFORE_START
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_AFTER_START
|
//DISPOSE_INSTANCE_AFTER_START
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_AFTER_END
|
//DISPOSE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,6 +195,15 @@ class AnotherClass extends R3Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
//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
|
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||||
|
|
||||||
module.exports = AnotherClass;
|
module.exports = Project;
|
|
@ -4,6 +4,9 @@ const Event = require('r3-event.js');
|
||||||
/**
|
/**
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
|
id=Utils.RandomId(10)
|
||||||
|
name=this.constructor.name + '(' + options.id + ')'
|
||||||
|
register=true
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
|
@ -13,6 +16,9 @@ const Event = require('r3-event.js');
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
|
id
|
||||||
|
name
|
||||||
|
register
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -26,14 +32,23 @@ class R3Object extends Event {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'R3Object (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//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
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
|
@ -52,25 +67,21 @@ class R3Object extends Event {
|
||||||
createInstance() {
|
createInstance() {
|
||||||
|
|
||||||
//CREATE_INSTANCE_BEFORE_START
|
//CREATE_INSTANCE_BEFORE_START
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
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
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
//CREATE_INSTANCE_AFTER_START
|
//CREATE_INSTANCE_AFTER_START
|
||||||
|
this[this.runtime].createInstance(
|
||||||
|
this,
|
||||||
|
{
|
||||||
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
this.emit(Event.INSTANCE_CREATED, this);
|
this.emit(Event.INSTANCE_CREATED, this);
|
||||||
//CREATE_INSTANCE_AFTER_END
|
//CREATE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
|
@ -121,14 +132,21 @@ class R3Object extends Event {
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|
||||||
//DISPOSE_BEFORE_START
|
//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
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
//DISPOSE_AFTER_START
|
//DISPOSE_AFTER_START
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
||||||
//DISPOSE_AFTER_END
|
//DISPOSE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -138,15 +156,14 @@ class R3Object extends Event {
|
||||||
disposeInstance() {
|
disposeInstance() {
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_START
|
//DISPOSE_INSTANCE_BEFORE_START
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
//DISPOSE_INSTANCE_AFTER_START
|
//DISPOSE_INSTANCE_AFTER_START
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_AFTER_END
|
//DISPOSE_INSTANCE_AFTER_END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
2512
src/r3/r3-utils.js
2512
src/r3/r3-utils.js
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,5 @@
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
|
||||||
if (Utils.UndefinedOrNull(options)) {
|
|
||||||
options = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'CLASS_NAME (' + options.id + ')';
|
|
||||||
|
|
||||||
Event.Emit(Event.OBJECT_CREATED, this);
|
Event.Emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = Utils.RandomId(10);
|
|
||||||
options.name = 'CLASS_NAME (' + options.id + ')';
|
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
|
this[this.runtime].createInstance(
|
||||||
|
this,
|
||||||
|
{
|
||||||
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
this.emit(Event.INSTANCE_CREATED, this);
|
this.emit(Event.INSTANCE_CREATED, this);
|
|
@ -1,12 +1 @@
|
||||||
super.createInstance();
|
this.emit(Event.CREATE_INSTANCE_BEFORE, this);
|
||||||
this.emit(Event.CREATE_INSTANCE, this);
|
|
||||||
|
|
||||||
if (this.runtime === 'graphics') {
|
|
||||||
this.graphics.createInstance(
|
|
||||||
{
|
|
||||||
//CREATE_INSTANCE_OPTIONS_START
|
|
||||||
//CREATE_INSTANCE_OPTIONS_END
|
|
||||||
},
|
|
||||||
this
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1 +1 @@
|
||||||
'INSTANCE_KEY': this.KEY
|
'INSTANCE_KEY': this.KEY
|
|
@ -1 +1 @@
|
||||||
this.emit(Event.OBJECT_DISPOSED, this);
|
this.disposeInstance();
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
|
@ -1 +1 @@
|
||||||
this.emit(Event.INSTANCE_DISPOSED, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
@ -1,2 +1 @@
|
||||||
super.disposeInstance();
|
console.log('Disposing instance of ' + this.name);
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
|
|
@ -6,15 +6,6 @@ const Utils = require('r3-utils');
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
OPTIONS_END
|
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 {
|
class CLASS_NAME {
|
||||||
|
@ -22,21 +13,6 @@ class CLASS_NAME {
|
||||||
//CONSTRUCTOR_TEMPLATE_START
|
//CONSTRUCTOR_TEMPLATE_START
|
||||||
//CONSTRUCTOR_TEMPLATE_END
|
//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_START
|
||||||
//CUSTOM_IMPLEMENTATION_END
|
//CUSTOM_IMPLEMENTATION_END
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
if (typeof options === 'undefined') {
|
||||||
|
options = {};
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
if (property === 'KEY') {
|
if (property === 'KEY' || property === 'all') {
|
||||||
this.KEY = this.instance.INSTANCE_KEY;
|
this.KEY = this.instance.INSTANCE_KEY;
|
||||||
return;
|
if (property !== 'all') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,9 +157,10 @@ foreach ($files as $file) {
|
||||||
/**
|
/**
|
||||||
* Process the constructor options
|
* Process the constructor options
|
||||||
*/
|
*/
|
||||||
|
$header = file_get_contents('src/templates/options_init_header.template');
|
||||||
$template = file_get_contents('src/templates/options_init.template');
|
$template = file_get_contents('src/templates/options_init.template');
|
||||||
|
|
||||||
$newOptions = '';
|
$newOptions = $header;
|
||||||
|
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
$updated = str_replace('KEY', $key, $template);
|
$updated = str_replace('KEY', $key, $template);
|
||||||
|
@ -200,16 +201,18 @@ foreach ($files as $file) {
|
||||||
array_push($newOptions, $updated);
|
array_push($newOptions, $updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = file_get_contents($file);
|
if (sizeof($newOptions) > 0) {
|
||||||
|
|
||||||
$contents = preg_replace(
|
$contents = file_get_contents($file);
|
||||||
'/\/\/\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);
|
$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
|
* Process updateInstance options
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -161,6 +161,7 @@ foreach ($files as $file) {
|
||||||
|
|
||||||
echo "Restored file " . $file;
|
echo "Restored file " . $file;
|
||||||
|
|
||||||
|
unlink($saveFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue