fix other components
parent
a1099c0784
commit
534dd4ceb0
|
@ -40,4 +40,4 @@ r3 create RuntimeImage runtime_base ./r3-runtime/
|
|||
r3 create RuntimeWebImage runtime_extends RuntimeImage ./r3-runtime/
|
||||
r3 create RuntimeNodeJSImage runtime_extends RuntimeImage ./r3-runtime/
|
||||
r3 create Runtime base ./r3-runtime/
|
||||
r3 create ComponentCode component_extends Component
|
||||
r3 create ComponentCode component_extends Component ./r3-component/
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
slider.canvas = null;
|
||||
slider.canvas = canvas;
|
||||
slider.images = [];
|
||||
slider.images = [image];
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class R3 {
|
||||
static version = '3.0.69';
|
||||
static compileDate = '2021 Sep 23 - 20:23:57 pm';
|
||||
static version = '3.0.73';
|
||||
static compileDate = '2021 Sep 24 - 07:04:55 am';
|
||||
}
|
||||
|
||||
class Runtime {
|
||||
|
@ -3484,18 +3484,220 @@ class Component extends R3Object {
|
|||
|
||||
}
|
||||
|
||||
Component.DOM = 0x0;
|
||||
Component.CANVAS = 0x1;
|
||||
Component.GRAPHICS = 0x2;
|
||||
Component.IMAGE = 0x3;
|
||||
Component.MATERIAL = 0x4;
|
||||
Component.MESH = 0x5;
|
||||
Component.TEXTURE = 0x6;
|
||||
Component.INPUT = 0x7;
|
||||
Component.TOUCH = 0x8;
|
||||
Component.CODE = 0x9;
|
||||
Component.CODE = 0x0;
|
||||
Component.DOM = 0x1;
|
||||
Component.CANVAS = 0x2;
|
||||
Component.GRAPHICS = 0x3;
|
||||
Component.IMAGE = 0x4;
|
||||
Component.MATERIAL = 0x5;
|
||||
Component.MESH = 0x6;
|
||||
Component.TEXTURE = 0x7;
|
||||
Component.INPUT = 0x8;
|
||||
Component.TOUCH = 0x9;
|
||||
Component.MAX_COMPONENT = 0xa;
|
||||
|
||||
/**
|
||||
|
||||
Class R3.Event.Object.Component.Code
|
||||
[Inherited from Event]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
- async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Async()' passing it the arguments
|
||||
|
||||
- emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Emit()' passing it the arguments
|
||||
|
||||
- subscribe(eventId, callback)
|
||||
Simply calls 'Subscribe()' passing it the arguments
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
- Async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as
|
||||
arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the
|
||||
error as argument.
|
||||
|
||||
- Emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after
|
||||
the event result is obtained, passing it the result. If an exception occurs during execution, the
|
||||
clientErrorCallback is called with the error as argument.
|
||||
|
||||
- Subscribe(eventId, callback)
|
||||
Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised
|
||||
|
||||
[Inherited from R3Object]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
|
||||
identifies it everywhere (client and server side))
|
||||
- name (Default value 'Object ' + options.id - Each Object has a name)
|
||||
- parent (Default value null - All objects could have a parent)
|
||||
- children (Default value [] - All objects could have some children)
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
<no inherited methods>
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Inherited from Component]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
<no inherited methods>
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Belonging to ComponentCode]
|
||||
|
||||
Properties:
|
||||
|
||||
<no properties>
|
||||
|
||||
Static Properties:
|
||||
|
||||
<no static properties>
|
||||
|
||||
Methods:
|
||||
|
||||
<no methods>
|
||||
|
||||
Static Methods:
|
||||
|
||||
<no static methods>
|
||||
|
||||
**/
|
||||
|
||||
class ComponentCode extends Component {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
if (typeof options === 'undefined') {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.maxDepth === 'undefined') {
|
||||
options.maxDepth = 0;
|
||||
}
|
||||
|
||||
if (typeof options.callDepth === 'undefined') {
|
||||
options.callDepth = 0;
|
||||
} else {
|
||||
options.callDepth++;
|
||||
}
|
||||
|
||||
options.maxDepth = options.callDepth;
|
||||
|
||||
/**
|
||||
* initialized - A boolean which indicates whether or not this component has initialized
|
||||
*/
|
||||
if (typeof options.initialized === 'undefined') {
|
||||
options.initialized = false;
|
||||
}
|
||||
/**
|
||||
* instance - Holds the current instance of this object as determined (built) by the runtime object.
|
||||
*/
|
||||
if (typeof options.instance === 'undefined') {
|
||||
options.instance = null;
|
||||
}
|
||||
/**
|
||||
* initializeDepth - The amount of times this component passed through initialize() functions
|
||||
*/
|
||||
if (typeof options.initializeDepth === 'undefined') {
|
||||
options.initializeDepth = 0;
|
||||
}
|
||||
|
||||
super(options);
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
if (options.callDepth === 0) {
|
||||
this.initialize();
|
||||
} else {
|
||||
options.callDepth--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize()
|
||||
* - Notifies all systems listening that this component initialized.
|
||||
*/
|
||||
initialize() {
|
||||
|
||||
super.initialize();
|
||||
|
||||
if (this.initializeDepth === this.maxDepth) {
|
||||
|
||||
if (this instanceof R3.Component) {
|
||||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
} else {
|
||||
this.initializeDepth++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updateInstance()
|
||||
* - Updates this object by copying the values of the current object into it's instance object.
|
||||
* @param property
|
||||
*/
|
||||
updateInstance(property) {
|
||||
|
||||
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
|
||||
|
||||
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updateFromInstance()
|
||||
* - Updates this object by copying the values of its instance into the current object.
|
||||
* @param property
|
||||
*/
|
||||
updateFromInstance(property) {
|
||||
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
|
||||
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Class R3.Event.Object.Component.DOM
|
||||
|
@ -3670,7 +3872,7 @@ class ComponentDOM extends Component {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -3949,7 +4151,7 @@ class ComponentCanvas extends ComponentDOM {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -4239,7 +4441,7 @@ class ComponentGraphics extends Component {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -4568,7 +4770,7 @@ class ComponentImage extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -5014,7 +5216,7 @@ class ComponentMaterial extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -5234,7 +5436,7 @@ class ComponentMesh extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -5454,7 +5656,7 @@ class ComponentTexture extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -5658,7 +5860,7 @@ class ComponentInput extends Component {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -5878,209 +6080,7 @@ class ComponentTouch extends ComponentInput {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
} else {
|
||||
this.initializeDepth++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updateInstance()
|
||||
* - Updates this object by copying the values of the current object into it's instance object.
|
||||
* @param property
|
||||
*/
|
||||
updateInstance(property) {
|
||||
|
||||
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
|
||||
|
||||
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updateFromInstance()
|
||||
* - Updates this object by copying the values of its instance into the current object.
|
||||
* @param property
|
||||
*/
|
||||
updateFromInstance(property) {
|
||||
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
|
||||
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Class R3.Event.Object.Component.Code
|
||||
[Inherited from Event]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
- async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Async()' passing it the arguments
|
||||
|
||||
- emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Emit()' passing it the arguments
|
||||
|
||||
- subscribe(eventId, callback)
|
||||
Simply calls 'Subscribe()' passing it the arguments
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
- Async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as
|
||||
arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the
|
||||
error as argument.
|
||||
|
||||
- Emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after
|
||||
the event result is obtained, passing it the result. If an exception occurs during execution, the
|
||||
clientErrorCallback is called with the error as argument.
|
||||
|
||||
- Subscribe(eventId, callback)
|
||||
Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised
|
||||
|
||||
[Inherited from R3Object]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
|
||||
identifies it everywhere (client and server side))
|
||||
- name (Default value 'Object ' + options.id - Each Object has a name)
|
||||
- parent (Default value null - All objects could have a parent)
|
||||
- children (Default value [] - All objects could have some children)
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
<no inherited methods>
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Inherited from Component]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
<no inherited methods>
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Belonging to ComponentCode]
|
||||
|
||||
Properties:
|
||||
|
||||
<no properties>
|
||||
|
||||
Static Properties:
|
||||
|
||||
<no static properties>
|
||||
|
||||
Methods:
|
||||
|
||||
<no methods>
|
||||
|
||||
Static Methods:
|
||||
|
||||
<no static methods>
|
||||
|
||||
**/
|
||||
|
||||
class ComponentCode extends Component {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
if (typeof options === 'undefined') {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.maxDepth === 'undefined') {
|
||||
options.maxDepth = 0;
|
||||
}
|
||||
|
||||
if (typeof options.callDepth === 'undefined') {
|
||||
options.callDepth = 0;
|
||||
} else {
|
||||
options.callDepth++;
|
||||
}
|
||||
|
||||
options.maxDepth = options.callDepth;
|
||||
|
||||
/**
|
||||
* initialized - A boolean which indicates whether or not this component has initialized
|
||||
*/
|
||||
if (typeof options.initialized === 'undefined') {
|
||||
options.initialized = false;
|
||||
}
|
||||
/**
|
||||
* instance - Holds the current instance of this object as determined (built) by the runtime object.
|
||||
*/
|
||||
if (typeof options.instance === 'undefined') {
|
||||
options.instance = null;
|
||||
}
|
||||
/**
|
||||
* initializeDepth - The amount of times this component passed through initialize() functions
|
||||
*/
|
||||
if (typeof options.initializeDepth === 'undefined') {
|
||||
options.initializeDepth = 0;
|
||||
}
|
||||
|
||||
super(options);
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
if (options.callDepth === 0) {
|
||||
this.initialize();
|
||||
} else {
|
||||
options.callDepth--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize()
|
||||
* - Notifies all systems listening that this component initialized.
|
||||
*/
|
||||
initialize() {
|
||||
|
||||
super.initialize();
|
||||
|
||||
if (this.initializeDepth === this.maxDepth) {
|
||||
|
||||
if (this instanceof R3.Component) {
|
||||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -6227,7 +6227,7 @@ class Project extends R3Object {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
@ -6608,39 +6608,6 @@ class Utils {
|
|||
result[name].w = false;
|
||||
};
|
||||
|
||||
static ObjectPropertiesAsBoolean(object) {
|
||||
return Object.keys(object).reduce(
|
||||
function(result, propertyId) {
|
||||
|
||||
if (typeof object[propertyId] === 'function') {
|
||||
return result;
|
||||
}
|
||||
|
||||
result[propertyId] = false;
|
||||
|
||||
// if (object[propertyId] instanceof R3.Vector2) {
|
||||
// Utils.BuildVectorSource(result, propertyId, 2);
|
||||
// }
|
||||
//
|
||||
// if (object[propertyId] instanceof R3.Vector3) {
|
||||
// Utils.BuildVectorSource(result, propertyId, 3);
|
||||
// }
|
||||
//
|
||||
// if (object[propertyId] instanceof R3.Vector4) {
|
||||
// Utils.BuildVectorSource(result, propertyId, 4);
|
||||
// }
|
||||
//
|
||||
// if (object[propertyId] instanceof R3.Quaternion) {
|
||||
// Utils.BuildQuaternionSource(result, propertyId);
|
||||
// }
|
||||
|
||||
return result;
|
||||
|
||||
}.bind(this),
|
||||
{}
|
||||
);
|
||||
};
|
||||
|
||||
static GetRuntime() {
|
||||
|
||||
let result = null;
|
||||
|
@ -6714,14 +6681,6 @@ class Utils {
|
|||
);
|
||||
};
|
||||
|
||||
static LoadIdsFromArrayToIdObject(array, idToObject) {
|
||||
|
||||
};
|
||||
|
||||
static LoadIdsFromObjectToIdObject(object, idToObject) {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets random int exclusive of maximum but inclusive of minimum
|
||||
* @param min
|
||||
|
@ -6898,26 +6857,6 @@ class Utils {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Links an object to its parent through idToObject array
|
||||
* @param propertyString
|
||||
* @param idToObject
|
||||
* @param parentObject
|
||||
* @param id
|
||||
* @constructor
|
||||
*/
|
||||
static Link(propertyString, idToObject, parentObject, id) {
|
||||
|
||||
if (!Utils.UndefinedOrNull(parentObject[propertyString])) {
|
||||
|
||||
if (!idToObject.hasOwnProperty(id)) {
|
||||
console.warn('Linking failed for object:' + parentObject.name);
|
||||
}
|
||||
|
||||
parentObject[propertyString] = idToObject[id];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a random ID
|
||||
* @returns {string}
|
||||
|
@ -7490,6 +7429,7 @@ System.Render = SystemRender;
|
|||
System.Runtime = SystemRuntime;
|
||||
System.Socket = SystemSocket;
|
||||
System.Storage = SystemStorage;
|
||||
Component.Code = ComponentCode;
|
||||
Component.DOM = ComponentDOM;
|
||||
Component.DOM.Canvas = ComponentCanvas;
|
||||
Component.Graphics = ComponentGraphics;
|
||||
|
@ -7499,7 +7439,6 @@ Component.Graphics.Mesh = ComponentMesh;
|
|||
Component.Graphics.Texture = ComponentTexture;
|
||||
Component.Input = ComponentInput;
|
||||
Component.Input.Touch = ComponentTouch;
|
||||
Component.Code = ComponentCode;
|
||||
Runtime.Coder = RuntimeCoder;
|
||||
Runtime.Coder.CodeMirror = RuntimeCodeMirror;
|
||||
Runtime.DOM = RuntimeDOM;
|
||||
|
@ -7525,13 +7464,13 @@ R3.Object = R3Object;
|
|||
R3.Entity = Entity;
|
||||
R3.Component = Component;
|
||||
R3.Project = Project;
|
||||
R3.Code = Component.Code;
|
||||
R3.Canvas = Component.DOM.Canvas;
|
||||
R3.Image = Component.Graphics.Image;
|
||||
R3.Material = Component.Graphics.Material;
|
||||
R3.Mesh = Component.Graphics.Mesh;
|
||||
R3.Texture = Component.Graphics.Texture;
|
||||
R3.Touch = Component.Input.Touch;
|
||||
R3.Code = Component.Code;
|
||||
|
||||
console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);
|
||||
R3.System.DOM.Start();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "r3",
|
||||
"version" : "3.0.69",
|
||||
"version" : "3.0.73",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,333 +0,0 @@
|
|||
const Event = require('./r3-event');
|
||||
const Utils = require('./r3-utils');
|
||||
const Component = require('./r3-component.js');
|
||||
|
||||
/**
|
||||
|
||||
GENERATED_INHERITED_START
|
||||
|
||||
Class R3.Event.Object.Component.Code
|
||||
[Inherited from Event]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
- async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Async()' passing it the arguments
|
||||
|
||||
- emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Simply calls 'Emit()' passing it the arguments
|
||||
|
||||
- subscribe(eventId, callback)
|
||||
Simply calls 'Subscribe()' passing it the arguments
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
- Async(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as
|
||||
arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the
|
||||
error as argument.
|
||||
|
||||
- Emit(eventId, data, clientCallback, clientErrorCallback)
|
||||
Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after
|
||||
the event result is obtained, passing it the result. If an exception occurs during execution, the
|
||||
clientErrorCallback is called with the error as argument.
|
||||
|
||||
- Subscribe(eventId, callback)
|
||||
Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised
|
||||
|
||||
[Inherited from R3Object]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
|
||||
identifies it everywhere (client and server side))
|
||||
- name (Default value 'Object ' + options.id - Each Object has a name)
|
||||
- parent (Default value null - All objects could have a parent)
|
||||
- children (Default value [] - All objects could have some children)
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
<no inherited methods>
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Inherited from Component]
|
||||
|
||||
Inherited Properties:
|
||||
|
||||
<no inherited properties>
|
||||
|
||||
Inherited Static Properties:
|
||||
|
||||
<no inherited static properties>
|
||||
|
||||
Inherited Methods:
|
||||
|
||||
<no inherited methods>
|
||||
|
||||
Inherited Static Methods:
|
||||
|
||||
<no inherited static methods>
|
||||
|
||||
[Belonging to ComponentCode]
|
||||
|
||||
Properties:
|
||||
|
||||
<no properties>
|
||||
|
||||
Static Properties:
|
||||
|
||||
<no static properties>
|
||||
|
||||
Methods:
|
||||
|
||||
<no methods>
|
||||
|
||||
Static Methods:
|
||||
|
||||
<no static methods>
|
||||
|
||||
GENERATED_INHERITED_END
|
||||
|
||||
TEMPLATE_OPTIONS_START
|
||||
initialized=false - A boolean which indicates whether or not this component has initialized
|
||||
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
|
||||
initializeDepth=0 - The amount of times this component passed through initialize() functions
|
||||
TEMPLATE_OPTIONS_END
|
||||
|
||||
CUSTOM_OPTIONS_START
|
||||
CUSTOM_OPTIONS_END
|
||||
|
||||
TEMPLATE_STATIC_OPTIONS_START
|
||||
TEMPLATE_STATIC_OPTIONS_END
|
||||
|
||||
CUSTOM_STATIC_OPTIONS_START
|
||||
CUSTOM_STATIC_OPTIONS_END
|
||||
|
||||
TEMPLATE_INSTANCE_OPTIONS_MAPPING_START
|
||||
TEMPLATE_INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
CUSTOM_INSTANCE_OPTIONS_MAPPING_START
|
||||
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
instance
|
||||
initializeDepth
|
||||
initialized
|
||||
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
TEMPLATE_METHODS_START
|
||||
initialize() - Notifies all systems listening that this component initialized.
|
||||
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
|
||||
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
|
||||
TEMPLATE_METHODS_END
|
||||
|
||||
CUSTOM_METHODS_START
|
||||
CUSTOM_METHODS_END
|
||||
|
||||
TEMPLATE_STATIC_METHODS_START
|
||||
TEMPLATE_STATIC_METHODS_END
|
||||
|
||||
CUSTOM_STATIC_METHODS_START
|
||||
CUSTOM_STATIC_METHODS_END
|
||||
|
||||
**/
|
||||
|
||||
class ComponentCode extends Component {
|
||||
|
||||
//GENERATED_CONSTRUCTOR_START
|
||||
constructor(options) {
|
||||
|
||||
if (typeof options === 'undefined') {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.maxDepth === 'undefined') {
|
||||
options.maxDepth = 0;
|
||||
}
|
||||
|
||||
if (typeof options.callDepth === 'undefined') {
|
||||
options.callDepth = 0;
|
||||
} else {
|
||||
options.callDepth++;
|
||||
}
|
||||
|
||||
options.maxDepth = options.callDepth;
|
||||
|
||||
//GENERATED_TEMPLATE_OPTIONS_INIT_START
|
||||
/**
|
||||
* initialized - A boolean which indicates whether or not this component has initialized
|
||||
*/
|
||||
if (typeof options.initialized === 'undefined') {
|
||||
options.initialized = false;
|
||||
}
|
||||
/**
|
||||
* instance - Holds the current instance of this object as determined (built) by the runtime object.
|
||||
*/
|
||||
if (typeof options.instance === 'undefined') {
|
||||
options.instance = null;
|
||||
}
|
||||
/**
|
||||
* initializeDepth - The amount of times this component passed through initialize() functions
|
||||
*/
|
||||
if (typeof options.initializeDepth === 'undefined') {
|
||||
options.initializeDepth = 0;
|
||||
}
|
||||
//GENERATED_TEMPLATE_OPTIONS_INIT_END
|
||||
|
||||
super(options);
|
||||
|
||||
//GENERATED_OPTIONS_INIT_START
|
||||
//GENERATED_OPTIONS_INIT_END
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
//CUSTOM_BEFORE_INIT_START
|
||||
//CUSTOM_BEFORE_INIT_END
|
||||
|
||||
if (options.callDepth === 0) {
|
||||
this.initialize();
|
||||
} else {
|
||||
options.callDepth--;
|
||||
}
|
||||
|
||||
//CUSTOM_AFTER_INIT_START
|
||||
//CUSTOM_AFTER_INIT_END
|
||||
}
|
||||
//GENERATED_CONSTRUCTOR_END
|
||||
|
||||
//GENERATED_TEMPLATE_METHODS_START
|
||||
|
||||
/**
|
||||
* initialize()
|
||||
* - Notifies all systems listening that this component initialized.
|
||||
*/
|
||||
initialize() {
|
||||
|
||||
//GENERATED_INITIALIZE_METHOD_START
|
||||
super.initialize();
|
||||
//GENERATED_INITIALIZE_METHOD_END
|
||||
|
||||
//CUSTOM_INITIALIZE_METHOD_START
|
||||
//CUSTOM_INITIALIZE_METHOD_END
|
||||
|
||||
//GENERATED_INITIALIZE_METHOD_AFTER_START
|
||||
if (this.initializeDepth === this.maxDepth) {
|
||||
|
||||
if (this instanceof R3.Component) {
|
||||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
} else {
|
||||
this.initializeDepth++;
|
||||
}
|
||||
//GENERATED_INITIALIZE_METHOD_AFTER_END
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updateInstance()
|
||||
* - Updates this object by copying the values of the current object into it's instance object.
|
||||
* @param property
|
||||
*/
|
||||
updateInstance(property) {
|
||||
|
||||
//GENERATED_UPDATE_INSTANCE_METHOD_START
|
||||
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
|
||||
|
||||
//GENERATED_UPDATE_INSTANCE_OPTIONS_START
|
||||
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
|
||||
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
|
||||
//GENERATED_UPDATE_INSTANCE_METHOD_END
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_METHOD_START
|
||||
//CUSTOM_UPDATE_INSTANCE_METHOD_END
|
||||
|
||||
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
|
||||
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updateFromInstance()
|
||||
* - Updates this object by copying the values of its instance into the current object.
|
||||
* @param property
|
||||
*/
|
||||
updateFromInstance(property) {
|
||||
|
||||
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_START
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
|
||||
|
||||
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
|
||||
|
||||
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_END
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
|
||||
|
||||
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
|
||||
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
|
||||
|
||||
}
|
||||
//GENERATED_TEMPLATE_METHODS_END
|
||||
|
||||
//GENERATED_METHODS_START
|
||||
//GENERATED_METHODS_END
|
||||
|
||||
//GENERATED_TEMPLATE_STATIC_METHODS_START
|
||||
//GENERATED_TEMPLATE_STATIC_METHODS_END
|
||||
|
||||
//GENERATED_STATIC_METHODS_START
|
||||
//GENERATED_STATIC_METHODS_END
|
||||
|
||||
//CUSTOM_IMPLEMENTATION_START
|
||||
//CUSTOM_IMPLEMENTATION_END
|
||||
}
|
||||
|
||||
//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START
|
||||
//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END
|
||||
|
||||
//GENERATED_STATIC_OPTIONS_INIT_START
|
||||
//GENERATED_STATIC_OPTIONS_INIT_END
|
||||
|
||||
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||
|
||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||
|
||||
module.exports = ComponentCode;
|
|
@ -1,5 +1,6 @@
|
|||
//GENERATED_IMPORTS_START
|
||||
const Component = require('./r3-component.js');
|
||||
const ComponentCode = require('./r3-component-code.js');
|
||||
const ComponentDOM = require('./r3-component-d-o-m.js');
|
||||
const ComponentCanvas = require('./r3-component-canvas.js');
|
||||
const ComponentGraphics = require('./r3-component-graphics.js');
|
||||
|
@ -9,10 +10,10 @@ const ComponentMesh = require('./r3-component-mesh.js');
|
|||
const ComponentTexture = require('./r3-component-texture.js');
|
||||
const ComponentInput = require('./r3-component-input.js');
|
||||
const ComponentTouch = require('./r3-component-touch.js');
|
||||
const ComponentCode = require('.-code.js');
|
||||
//GENERATED_IMPORTS_END
|
||||
|
||||
//GENERATED_INDEX_BODY_START
|
||||
Component.Code = ComponentCode;
|
||||
Component.DOM = ComponentDOM;
|
||||
Component.DOM.Canvas = ComponentCanvas;
|
||||
Component.Graphics = ComponentGraphics;
|
||||
|
@ -22,7 +23,6 @@ Component.Graphics.Mesh = ComponentMesh;
|
|||
Component.Graphics.Texture = ComponentTexture;
|
||||
Component.Input = ComponentInput;
|
||||
Component.Input.Touch = ComponentTouch;
|
||||
Component.Code = ComponentCode;
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
||||
//GENERATED_EXPORTS_START
|
||||
|
|
|
@ -289,7 +289,7 @@ class ComponentCanvas extends ComponentDOM {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ class ComponentDOM extends Component {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ class ComponentGraphics extends Component {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ class ComponentImage extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ class ComponentInput extends Component {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class ComponentMaterial extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class ComponentMesh extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class ComponentTexture extends ComponentGraphics {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class ComponentTouch extends ComponentInput {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -322,16 +322,16 @@ class Component extends R3Object {
|
|||
//GENERATED_STATIC_OPTIONS_INIT_END
|
||||
|
||||
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
|
||||
Component.DOM = 0x0;
|
||||
Component.CANVAS = 0x1;
|
||||
Component.GRAPHICS = 0x2;
|
||||
Component.IMAGE = 0x3;
|
||||
Component.MATERIAL = 0x4;
|
||||
Component.MESH = 0x5;
|
||||
Component.TEXTURE = 0x6;
|
||||
Component.INPUT = 0x7;
|
||||
Component.TOUCH = 0x8;
|
||||
Component.CODE = 0x9;
|
||||
Component.CODE = 0x0;
|
||||
Component.DOM = 0x1;
|
||||
Component.CANVAS = 0x2;
|
||||
Component.GRAPHICS = 0x3;
|
||||
Component.IMAGE = 0x4;
|
||||
Component.MATERIAL = 0x5;
|
||||
Component.MESH = 0x6;
|
||||
Component.TEXTURE = 0x7;
|
||||
Component.INPUT = 0x8;
|
||||
Component.TOUCH = 0x9;
|
||||
Component.MAX_COMPONENT = 0xa;
|
||||
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ class Project extends R3Object {
|
|||
this.createInstance();
|
||||
}
|
||||
|
||||
if (this instanceof R3.Entity && this.initialized) {
|
||||
if (this instanceof R3.Entity && this.initialized && !this.started) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class R3 {
|
||||
static version = '3.0.69';
|
||||
static compileDate = '2021 Sep 23 - 20:23:57 pm';
|
||||
static version = '3.0.73';
|
||||
static compileDate = '2021 Sep 24 - 07:04:55 am';
|
||||
}
|
||||
|
||||
//GENERATED_IMPORTS_START
|
||||
|
@ -23,13 +23,13 @@ R3.Object = R3Object;
|
|||
R3.Entity = Entity;
|
||||
R3.Component = Component;
|
||||
R3.Project = Project;
|
||||
R3.Code = Component.Code;
|
||||
R3.Canvas = Component.DOM.Canvas;
|
||||
R3.Image = Component.Graphics.Image;
|
||||
R3.Material = Component.Graphics.Material;
|
||||
R3.Mesh = Component.Graphics.Mesh;
|
||||
R3.Texture = Component.Graphics.Texture;
|
||||
R3.Touch = Component.Input.Touch;
|
||||
R3.Code = Component.Code;
|
||||
//GENERATED_DEFINES_END
|
||||
|
||||
//CUSTOM_CONVENIENT_DEFINES_START
|
||||
|
|
|
@ -431,39 +431,6 @@ class Utils {
|
|||
result[name].w = false;
|
||||
};
|
||||
|
||||
static ObjectPropertiesAsBoolean(object) {
|
||||
return Object.keys(object).reduce(
|
||||
function(result, propertyId) {
|
||||
|
||||
if (typeof object[propertyId] === 'function') {
|
||||
return result;
|
||||
}
|
||||
|
||||
result[propertyId] = false;
|
||||
|
||||
// if (object[propertyId] instanceof R3.Vector2) {
|
||||
// Utils.BuildVectorSource(result, propertyId, 2);
|
||||
// }
|
||||
//
|
||||
// if (object[propertyId] instanceof R3.Vector3) {
|
||||
// Utils.BuildVectorSource(result, propertyId, 3);
|
||||
// }
|
||||
//
|
||||
// if (object[propertyId] instanceof R3.Vector4) {
|
||||
// Utils.BuildVectorSource(result, propertyId, 4);
|
||||
// }
|
||||
//
|
||||
// if (object[propertyId] instanceof R3.Quaternion) {
|
||||
// Utils.BuildQuaternionSource(result, propertyId);
|
||||
// }
|
||||
|
||||
return result;
|
||||
|
||||
}.bind(this),
|
||||
{}
|
||||
);
|
||||
};
|
||||
|
||||
static GetRuntime() {
|
||||
|
||||
let result = null;
|
||||
|
@ -538,15 +505,6 @@ class Utils {
|
|||
);
|
||||
};
|
||||
|
||||
static LoadIdsFromArrayToIdObject(array, idToObject) {
|
||||
|
||||
};
|
||||
|
||||
static LoadIdsFromObjectToIdObject(object, idToObject) {
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets random int exclusive of maximum but inclusive of minimum
|
||||
* @param min
|
||||
|
@ -723,26 +681,6 @@ class Utils {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Links an object to its parent through idToObject array
|
||||
* @param propertyString
|
||||
* @param idToObject
|
||||
* @param parentObject
|
||||
* @param id
|
||||
* @constructor
|
||||
*/
|
||||
static Link(propertyString, idToObject, parentObject, id) {
|
||||
|
||||
if (!Utils.UndefinedOrNull(parentObject[propertyString])) {
|
||||
|
||||
if (!idToObject.hasOwnProperty(id)) {
|
||||
console.warn('Linking failed for object:' + parentObject.name);
|
||||
}
|
||||
|
||||
parentObject[propertyString] = idToObject[id];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a random ID
|
||||
* @returns {string}
|
||||
|
|
Loading…
Reference in New Issue