current state
parent
aef4286386
commit
0bb9a01863
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||||
var __DATE__ = "Tue Dec 05 2017 21:13:00 GMT+0100 (CET)";
|
var __DATE__ = "Sun Dec 10 2017 12:56:56 GMT+0100 (CET)";
|
||||||
// END COMPILE TIME DEFINITIONS
|
// END COMPILE TIME DEFINITIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,7 +168,7 @@ GameLib.Event.FONT_NOT_FOUND = 0x56;
|
||||||
GameLib.Event.STOP_ALL_AUDIO = 0x57;
|
GameLib.Event.STOP_ALL_AUDIO = 0x57;
|
||||||
GameLib.Event.REGISTER_DEPENDENCIES = 0x58;
|
GameLib.Event.REGISTER_DEPENDENCIES = 0x58;
|
||||||
GameLib.Event.GAME_LOADED = 0x59;
|
GameLib.Event.GAME_LOADED = 0x59;
|
||||||
//GameLib.Event.GAME_RESTART = 0x5a;
|
GameLib.Event.COMPONENT_UPDATE = 0x5a;
|
||||||
GameLib.Event.LOAD_PROGRESS = 0x5b;
|
GameLib.Event.LOAD_PROGRESS = 0x5b;
|
||||||
GameLib.Event.ENTITY_LOADED = 0x5c;
|
GameLib.Event.ENTITY_LOADED = 0x5c;
|
||||||
GameLib.Event.MOUSE_DOWN = 0x5d;
|
GameLib.Event.MOUSE_DOWN = 0x5d;
|
||||||
|
@ -288,7 +288,7 @@ GameLib.Event.GetEventName = function(number) {
|
||||||
case 0x57 : return 'stop_all_audio';
|
case 0x57 : return 'stop_all_audio';
|
||||||
case 0x58 : return 'register_dependencies';
|
case 0x58 : return 'register_dependencies';
|
||||||
case 0x59 : return 'game_loaded';
|
case 0x59 : return 'game_loaded';
|
||||||
case 0x5a : return 'unused';//'game_restart';
|
case 0x5a : return 'component_update';
|
||||||
case 0x5b : return 'load_progress';
|
case 0x5b : return 'load_progress';
|
||||||
case 0x5c : return 'entity_loaded';
|
case 0x5c : return 'entity_loaded';
|
||||||
case 0x5d : return 'mouse_down';
|
case 0x5d : return 'mouse_down';
|
||||||
|
@ -2639,7 +2639,7 @@ GameLib.API.Canvas.FromObject = function(objectCanvas) {
|
||||||
* @param source
|
* @param source
|
||||||
* @param sourceProperties
|
* @param sourceProperties
|
||||||
* @param roomId
|
* @param roomId
|
||||||
* @param peer
|
* @param peerId
|
||||||
* @param serverIp
|
* @param serverIp
|
||||||
* @param port
|
* @param port
|
||||||
* @param parentEntity
|
* @param parentEntity
|
||||||
|
@ -2652,7 +2652,7 @@ GameLib.API.Cast = function(
|
||||||
source,
|
source,
|
||||||
sourceProperties,
|
sourceProperties,
|
||||||
roomId,
|
roomId,
|
||||||
peer,
|
peerId,
|
||||||
serverIp,
|
serverIp,
|
||||||
port,
|
port,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
@ -2669,7 +2669,7 @@ GameLib.API.Cast = function(
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(castType)) {
|
if (GameLib.Utils.UndefinedOrNull(castType)) {
|
||||||
castType = GameLib.Cast.CAST_TYPE_ROOM;
|
castType = GameLib.API.Cast.CAST_TYPE_ROOM;
|
||||||
}
|
}
|
||||||
this.castType = castType;
|
this.castType = castType;
|
||||||
|
|
||||||
|
@ -2688,10 +2688,10 @@ GameLib.API.Cast = function(
|
||||||
}
|
}
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(peer)) {
|
if (GameLib.Utils.UndefinedOrNull(peerId)) {
|
||||||
peer = null;
|
peerId = null;
|
||||||
}
|
}
|
||||||
this.peer = peer;
|
this.peerId = peerId;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
|
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
|
||||||
serverIp = '127.0.0.1';
|
serverIp = '127.0.0.1';
|
||||||
|
@ -2733,7 +2733,7 @@ GameLib.API.Cast.FromObject = function(objectCast) {
|
||||||
objectCast.source,
|
objectCast.source,
|
||||||
objectCast.sourceProperties,
|
objectCast.sourceProperties,
|
||||||
objectCast.roomId,
|
objectCast.roomId,
|
||||||
objectCast.peer,
|
objectCast.peerId,
|
||||||
objectCast.serverIp,
|
objectCast.serverIp,
|
||||||
objectCast.port,
|
objectCast.port,
|
||||||
objectCast.parentEntity
|
objectCast.parentEntity
|
||||||
|
@ -4121,6 +4121,114 @@ GameLib.API.Quaternion.Points.prototype.toOrigin = function () {
|
||||||
this.vectors[i].translate(distanceFromOrigin);
|
this.vectors[i].translate(distanceFromOrigin);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Raw Receive API object - should always correspond with the Receive Schema
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param receiveType
|
||||||
|
* @param source
|
||||||
|
* @param sourceProperties
|
||||||
|
* @param roomId
|
||||||
|
* @param peerId
|
||||||
|
* @param serverIp
|
||||||
|
* @param port
|
||||||
|
* @param parentEntity
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.API.Receive = function(
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
receiveType,
|
||||||
|
source,
|
||||||
|
sourceProperties,
|
||||||
|
roomId,
|
||||||
|
peerId,
|
||||||
|
serverIp,
|
||||||
|
port,
|
||||||
|
parentEntity
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||||
|
id = GameLib.Utils.RandomId();
|
||||||
|
}
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||||
|
name = 'Receive (' + this.id + ')';
|
||||||
|
}
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(castType)) {
|
||||||
|
castType = GameLib.API.Receive.CAST_TYPE_ROOM;
|
||||||
|
}
|
||||||
|
this.castType = castType;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(source)) {
|
||||||
|
source = null;
|
||||||
|
}
|
||||||
|
this.source = source;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(sourceProperties)) {
|
||||||
|
sourceProperties = null;
|
||||||
|
}
|
||||||
|
this.sourceProperties = sourceProperties;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(roomId)) {
|
||||||
|
roomId = 'default';
|
||||||
|
}
|
||||||
|
this.roomId = roomId;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(peerId)) {
|
||||||
|
peerId = null;
|
||||||
|
}
|
||||||
|
this.peerId = peerId;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
|
||||||
|
serverIp = '127.0.0.1';
|
||||||
|
}
|
||||||
|
this.serverIp = serverIp;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(port)) {
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
|
this.port = port;
|
||||||
|
|
||||||
|
GameLib.API.Component.call(
|
||||||
|
this,
|
||||||
|
GameLib.Component.CAST,
|
||||||
|
parentEntity
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.API.Receive.prototype = Object.create(GameLib.Component.prototype);
|
||||||
|
GameLib.API.Receive.prototype.constructor = GameLib.API.Receive;
|
||||||
|
|
||||||
|
GameLib.API.Receive.CAST_TYPE_ROOM = 0x1;
|
||||||
|
GameLib.API.Receive.CAST_TYPE_PEER = 0x2;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an API Receive from an Object Receive
|
||||||
|
* @param objectReceive
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.API.Receive.FromObject = function(objectReceive) {
|
||||||
|
|
||||||
|
return new GameLib.API.Receive(
|
||||||
|
objectReceive.id,
|
||||||
|
objectReceive.name,
|
||||||
|
objectReceive.castType,
|
||||||
|
objectReceive.source,
|
||||||
|
objectReceive.sourceProperties,
|
||||||
|
objectReceive.roomId,
|
||||||
|
objectReceive.peerId,
|
||||||
|
objectReceive.serverIp,
|
||||||
|
objectReceive.port,
|
||||||
|
objectReceive.parentEntity
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raw Stats API object - should always correspond with the Stats Schema
|
* Raw Stats API object - should always correspond with the Stats Schema
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -4762,7 +4870,7 @@ GameLib.Cast = function(
|
||||||
apiCast.source,
|
apiCast.source,
|
||||||
apiCast.sourceProperties,
|
apiCast.sourceProperties,
|
||||||
apiCast.roomId,
|
apiCast.roomId,
|
||||||
apiCast.peer,
|
apiCast.peerId,
|
||||||
apiCast.serverIp,
|
apiCast.serverIp,
|
||||||
apiCast.port,
|
apiCast.port,
|
||||||
apiCast.parentEntity
|
apiCast.parentEntity
|
||||||
|
@ -4773,8 +4881,7 @@ GameLib.Cast = function(
|
||||||
GameLib.Component.call(
|
GameLib.Component.call(
|
||||||
this,
|
this,
|
||||||
{
|
{
|
||||||
source : GameLib.Component,
|
source : GameLib.Component
|
||||||
peer : GameLib.Component
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4790,6 +4897,48 @@ GameLib.Cast.prototype.createInstance = function() {
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.Cast.prototype.buildVectorSource = function(result, name, dimension) {
|
||||||
|
|
||||||
|
if (dimension === 2) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dimension === 3) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
result[name].y = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dimension === 4) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
result[name].z = false;
|
||||||
|
result[name].w = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('unknown dimension : ' + dimension);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.Cast.prototype.buildQuaternionSource = function(result, name) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].axis = {};
|
||||||
|
result[name].axis.x = false;
|
||||||
|
result[name].axis.y = false;
|
||||||
|
result[name].axis.z = false;
|
||||||
|
result[name].angle = false;
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
result[name].z = false;
|
||||||
|
result[name].w = false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the instance with the current state
|
* Updates the instance with the current state
|
||||||
*/
|
*/
|
||||||
|
@ -4799,11 +4948,30 @@ GameLib.Cast.prototype.updateInstance = function(property) {
|
||||||
this.sourceProperties = Object.keys(this.source).reduce(
|
this.sourceProperties = Object.keys(this.source).reduce(
|
||||||
function(result, propertyId) {
|
function(result, propertyId) {
|
||||||
|
|
||||||
if (typeof this.source[propertyId] !== 'function') {
|
if (typeof this.source[propertyId] === 'function') {
|
||||||
result[propertyId] = false;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result[propertyId] = false;
|
||||||
|
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Vector2) {
|
||||||
|
// this.buildVectorSource(result, propertyId, 2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Vector3) {
|
||||||
|
// this.buildVectorSource(result, propertyId, 3);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Vector4) {
|
||||||
|
// this.buildVectorSource(result, propertyId, 4);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Quaternion) {
|
||||||
|
// this.buildQuaternionSource(result, propertyId);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
|
@ -4837,7 +5005,7 @@ GameLib.Cast.prototype.toApiObject = function() {
|
||||||
GameLib.Utils.IdOrNull(this.source),
|
GameLib.Utils.IdOrNull(this.source),
|
||||||
this.sourceProperties,
|
this.sourceProperties,
|
||||||
this.roomId,
|
this.roomId,
|
||||||
GameLib.Utils.IdOrNull(this.peer),
|
this.peerId,
|
||||||
this.serverIp,
|
this.serverIp,
|
||||||
this.port,
|
this.port,
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||||
|
@ -22709,10 +22877,12 @@ GameLib.D3.Texture.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'wrapS') {
|
if (property === 'wrapS') {
|
||||||
this.instance.wrapS = this.wrapS;
|
this.instance.wrapS = this.wrapS;
|
||||||
|
this.instance.needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'wrapT') {
|
if (property === 'wrapT') {
|
||||||
this.instance.wrapT = this.wrapT;
|
this.instance.wrapT = this.wrapT;
|
||||||
|
this.instance.needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'animated') {
|
if (property === 'animated') {
|
||||||
|
@ -23289,6 +23459,23 @@ GameLib.EntityManager.prototype.findComponentById = function(id) {
|
||||||
return this.idRegister[id];
|
return this.idRegister[id];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.EntityManager.prototype.findComponentByName = function(name) {
|
||||||
|
|
||||||
|
return Object.keys(this.idRegister).reduce(
|
||||||
|
function(result, componentId) {
|
||||||
|
|
||||||
|
if (this.idRegister[componentId].name === name) {
|
||||||
|
result = this.idRegister[componentId];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}.bind(this),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
GameLib.EntityManager.prototype.findHelperByObject = function(object) {
|
GameLib.EntityManager.prototype.findHelperByObject = function(object) {
|
||||||
|
|
||||||
if (typeof this.register[GameLib.Component.HELPER] === 'undefined') {
|
if (typeof this.register[GameLib.Component.HELPER] === 'undefined') {
|
||||||
|
@ -26885,7 +27072,7 @@ GameLib.System.GUI.prototype.controller = function(folder, object, property, sub
|
||||||
) {
|
) {
|
||||||
min = -1000;
|
min = -1000;
|
||||||
max = 1000;
|
max = 1000;
|
||||||
step = 0.00001;
|
step = 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
var handle = folder.add(
|
var handle = folder.add(
|
||||||
|
@ -27258,9 +27445,6 @@ GameLib.System.GUI.prototype.buildObjectControl = function(folder, componentTemp
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'sourceProperties') {
|
if (property === 'sourceProperties') {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Object.keys(object).map(
|
Object.keys(object).map(
|
||||||
function(propertyId) {
|
function(propertyId) {
|
||||||
folder.add(
|
folder.add(
|
||||||
|
@ -27288,7 +27472,7 @@ GameLib.System.GUI.prototype.buildSelectControl = function(folder, componentTemp
|
||||||
*/
|
*/
|
||||||
var constructors = null;
|
var constructors = null;
|
||||||
|
|
||||||
if (componentTemplate.template.linkedObjects[property]) {
|
if (componentTemplate.template.linkedObjects && componentTemplate.template.linkedObjects[property]) {
|
||||||
constructors = componentTemplate.template.linkedObjects[property];
|
constructors = componentTemplate.template.linkedObjects[property];
|
||||||
} else {
|
} else {
|
||||||
if (componentTemplate.template[property]) {
|
if (componentTemplate.template[property]) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ GameLib.Event.FONT_NOT_FOUND = 0x56;
|
||||||
GameLib.Event.STOP_ALL_AUDIO = 0x57;
|
GameLib.Event.STOP_ALL_AUDIO = 0x57;
|
||||||
GameLib.Event.REGISTER_DEPENDENCIES = 0x58;
|
GameLib.Event.REGISTER_DEPENDENCIES = 0x58;
|
||||||
GameLib.Event.GAME_LOADED = 0x59;
|
GameLib.Event.GAME_LOADED = 0x59;
|
||||||
//GameLib.Event.GAME_RESTART = 0x5a;
|
GameLib.Event.COMPONENT_UPDATE = 0x5a;
|
||||||
GameLib.Event.LOAD_PROGRESS = 0x5b;
|
GameLib.Event.LOAD_PROGRESS = 0x5b;
|
||||||
GameLib.Event.ENTITY_LOADED = 0x5c;
|
GameLib.Event.ENTITY_LOADED = 0x5c;
|
||||||
GameLib.Event.MOUSE_DOWN = 0x5d;
|
GameLib.Event.MOUSE_DOWN = 0x5d;
|
||||||
|
@ -224,7 +224,7 @@ GameLib.Event.GetEventName = function(number) {
|
||||||
case 0x57 : return 'stop_all_audio';
|
case 0x57 : return 'stop_all_audio';
|
||||||
case 0x58 : return 'register_dependencies';
|
case 0x58 : return 'register_dependencies';
|
||||||
case 0x59 : return 'game_loaded';
|
case 0x59 : return 'game_loaded';
|
||||||
case 0x5a : return 'unused';//'game_restart';
|
case 0x5a : return 'component_update';
|
||||||
case 0x5b : return 'load_progress';
|
case 0x5b : return 'load_progress';
|
||||||
case 0x5c : return 'entity_loaded';
|
case 0x5c : return 'entity_loaded';
|
||||||
case 0x5d : return 'mouse_down';
|
case 0x5d : return 'mouse_down';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @param source
|
* @param source
|
||||||
* @param sourceProperties
|
* @param sourceProperties
|
||||||
* @param roomId
|
* @param roomId
|
||||||
* @param peer
|
* @param peerId
|
||||||
* @param serverIp
|
* @param serverIp
|
||||||
* @param port
|
* @param port
|
||||||
* @param parentEntity
|
* @param parentEntity
|
||||||
|
@ -19,7 +19,7 @@ GameLib.API.Cast = function(
|
||||||
source,
|
source,
|
||||||
sourceProperties,
|
sourceProperties,
|
||||||
roomId,
|
roomId,
|
||||||
peer,
|
peerId,
|
||||||
serverIp,
|
serverIp,
|
||||||
port,
|
port,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
@ -36,7 +36,7 @@ GameLib.API.Cast = function(
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(castType)) {
|
if (GameLib.Utils.UndefinedOrNull(castType)) {
|
||||||
castType = GameLib.Cast.CAST_TYPE_ROOM;
|
castType = GameLib.API.Cast.CAST_TYPE_ROOM;
|
||||||
}
|
}
|
||||||
this.castType = castType;
|
this.castType = castType;
|
||||||
|
|
||||||
|
@ -55,10 +55,10 @@ GameLib.API.Cast = function(
|
||||||
}
|
}
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(peer)) {
|
if (GameLib.Utils.UndefinedOrNull(peerId)) {
|
||||||
peer = null;
|
peerId = null;
|
||||||
}
|
}
|
||||||
this.peer = peer;
|
this.peerId = peerId;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
|
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
|
||||||
serverIp = '127.0.0.1';
|
serverIp = '127.0.0.1';
|
||||||
|
@ -100,7 +100,7 @@ GameLib.API.Cast.FromObject = function(objectCast) {
|
||||||
objectCast.source,
|
objectCast.source,
|
||||||
objectCast.sourceProperties,
|
objectCast.sourceProperties,
|
||||||
objectCast.roomId,
|
objectCast.roomId,
|
||||||
objectCast.peer,
|
objectCast.peerId,
|
||||||
objectCast.serverIp,
|
objectCast.serverIp,
|
||||||
objectCast.port,
|
objectCast.port,
|
||||||
objectCast.parentEntity
|
objectCast.parentEntity
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
/**
|
||||||
|
* Raw Receive API object - should always correspond with the Receive Schema
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param receiveType
|
||||||
|
* @param source
|
||||||
|
* @param sourceProperties
|
||||||
|
* @param roomId
|
||||||
|
* @param peerId
|
||||||
|
* @param serverIp
|
||||||
|
* @param port
|
||||||
|
* @param parentEntity
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.API.Receive = function(
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
receiveType,
|
||||||
|
source,
|
||||||
|
sourceProperties,
|
||||||
|
roomId,
|
||||||
|
peerId,
|
||||||
|
serverIp,
|
||||||
|
port,
|
||||||
|
parentEntity
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||||
|
id = GameLib.Utils.RandomId();
|
||||||
|
}
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||||
|
name = 'Receive (' + this.id + ')';
|
||||||
|
}
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(castType)) {
|
||||||
|
castType = GameLib.API.Receive.CAST_TYPE_ROOM;
|
||||||
|
}
|
||||||
|
this.castType = castType;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(source)) {
|
||||||
|
source = null;
|
||||||
|
}
|
||||||
|
this.source = source;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(sourceProperties)) {
|
||||||
|
sourceProperties = null;
|
||||||
|
}
|
||||||
|
this.sourceProperties = sourceProperties;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(roomId)) {
|
||||||
|
roomId = 'default';
|
||||||
|
}
|
||||||
|
this.roomId = roomId;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(peerId)) {
|
||||||
|
peerId = null;
|
||||||
|
}
|
||||||
|
this.peerId = peerId;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
|
||||||
|
serverIp = '127.0.0.1';
|
||||||
|
}
|
||||||
|
this.serverIp = serverIp;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(port)) {
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
|
this.port = port;
|
||||||
|
|
||||||
|
GameLib.API.Component.call(
|
||||||
|
this,
|
||||||
|
GameLib.Component.CAST,
|
||||||
|
parentEntity
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.API.Receive.prototype = Object.create(GameLib.Component.prototype);
|
||||||
|
GameLib.API.Receive.prototype.constructor = GameLib.API.Receive;
|
||||||
|
|
||||||
|
GameLib.API.Receive.CAST_TYPE_ROOM = 0x1;
|
||||||
|
GameLib.API.Receive.CAST_TYPE_PEER = 0x2;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an API Receive from an Object Receive
|
||||||
|
* @param objectReceive
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.API.Receive.FromObject = function(objectReceive) {
|
||||||
|
|
||||||
|
return new GameLib.API.Receive(
|
||||||
|
objectReceive.id,
|
||||||
|
objectReceive.name,
|
||||||
|
objectReceive.castType,
|
||||||
|
objectReceive.source,
|
||||||
|
objectReceive.sourceProperties,
|
||||||
|
objectReceive.roomId,
|
||||||
|
objectReceive.peerId,
|
||||||
|
objectReceive.serverIp,
|
||||||
|
objectReceive.port,
|
||||||
|
objectReceive.parentEntity
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
|
@ -28,7 +28,7 @@ GameLib.Cast = function(
|
||||||
apiCast.source,
|
apiCast.source,
|
||||||
apiCast.sourceProperties,
|
apiCast.sourceProperties,
|
||||||
apiCast.roomId,
|
apiCast.roomId,
|
||||||
apiCast.peer,
|
apiCast.peerId,
|
||||||
apiCast.serverIp,
|
apiCast.serverIp,
|
||||||
apiCast.port,
|
apiCast.port,
|
||||||
apiCast.parentEntity
|
apiCast.parentEntity
|
||||||
|
@ -39,8 +39,7 @@ GameLib.Cast = function(
|
||||||
GameLib.Component.call(
|
GameLib.Component.call(
|
||||||
this,
|
this,
|
||||||
{
|
{
|
||||||
source : GameLib.Component,
|
source : GameLib.Component
|
||||||
peer : GameLib.Component
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -56,6 +55,48 @@ GameLib.Cast.prototype.createInstance = function() {
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.Cast.prototype.buildVectorSource = function(result, name, dimension) {
|
||||||
|
|
||||||
|
if (dimension === 2) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dimension === 3) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
result[name].y = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dimension === 4) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
result[name].z = false;
|
||||||
|
result[name].w = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('unknown dimension : ' + dimension);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.Cast.prototype.buildQuaternionSource = function(result, name) {
|
||||||
|
result[name] = {};
|
||||||
|
result[name].axis = {};
|
||||||
|
result[name].axis.x = false;
|
||||||
|
result[name].axis.y = false;
|
||||||
|
result[name].axis.z = false;
|
||||||
|
result[name].angle = false;
|
||||||
|
result[name].x = false;
|
||||||
|
result[name].y = false;
|
||||||
|
result[name].z = false;
|
||||||
|
result[name].w = false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the instance with the current state
|
* Updates the instance with the current state
|
||||||
*/
|
*/
|
||||||
|
@ -65,11 +106,30 @@ GameLib.Cast.prototype.updateInstance = function(property) {
|
||||||
this.sourceProperties = Object.keys(this.source).reduce(
|
this.sourceProperties = Object.keys(this.source).reduce(
|
||||||
function(result, propertyId) {
|
function(result, propertyId) {
|
||||||
|
|
||||||
if (typeof this.source[propertyId] !== 'function') {
|
if (typeof this.source[propertyId] === 'function') {
|
||||||
result[propertyId] = false;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result[propertyId] = false;
|
||||||
|
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Vector2) {
|
||||||
|
// this.buildVectorSource(result, propertyId, 2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Vector3) {
|
||||||
|
// this.buildVectorSource(result, propertyId, 3);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Vector4) {
|
||||||
|
// this.buildVectorSource(result, propertyId, 4);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (this.source[propertyId] instanceof GameLib.Quaternion) {
|
||||||
|
// this.buildQuaternionSource(result, propertyId);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
|
@ -103,7 +163,7 @@ GameLib.Cast.prototype.toApiObject = function() {
|
||||||
GameLib.Utils.IdOrNull(this.source),
|
GameLib.Utils.IdOrNull(this.source),
|
||||||
this.sourceProperties,
|
this.sourceProperties,
|
||||||
this.roomId,
|
this.roomId,
|
||||||
GameLib.Utils.IdOrNull(this.peer),
|
this.peerId,
|
||||||
this.serverIp,
|
this.serverIp,
|
||||||
this.port,
|
this.port,
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||||
|
|
|
@ -307,10 +307,12 @@ GameLib.D3.Texture.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'wrapS') {
|
if (property === 'wrapS') {
|
||||||
this.instance.wrapS = this.wrapS;
|
this.instance.wrapS = this.wrapS;
|
||||||
|
this.instance.needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'wrapT') {
|
if (property === 'wrapT') {
|
||||||
this.instance.wrapT = this.wrapT;
|
this.instance.wrapT = this.wrapT;
|
||||||
|
this.instance.needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'animated') {
|
if (property === 'animated') {
|
||||||
|
|
|
@ -191,6 +191,23 @@ GameLib.EntityManager.prototype.findComponentById = function(id) {
|
||||||
return this.idRegister[id];
|
return this.idRegister[id];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.EntityManager.prototype.findComponentByName = function(name) {
|
||||||
|
|
||||||
|
return Object.keys(this.idRegister).reduce(
|
||||||
|
function(result, componentId) {
|
||||||
|
|
||||||
|
if (this.idRegister[componentId].name === name) {
|
||||||
|
result = this.idRegister[componentId];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}.bind(this),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
GameLib.EntityManager.prototype.findHelperByObject = function(object) {
|
GameLib.EntityManager.prototype.findHelperByObject = function(object) {
|
||||||
|
|
||||||
if (typeof this.register[GameLib.Component.HELPER] === 'undefined') {
|
if (typeof this.register[GameLib.Component.HELPER] === 'undefined') {
|
||||||
|
|
|
@ -247,7 +247,7 @@ GameLib.System.GUI.prototype.controller = function(folder, object, property, sub
|
||||||
) {
|
) {
|
||||||
min = -1000;
|
min = -1000;
|
||||||
max = 1000;
|
max = 1000;
|
||||||
step = 0.00001;
|
step = 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
var handle = folder.add(
|
var handle = folder.add(
|
||||||
|
@ -620,9 +620,6 @@ GameLib.System.GUI.prototype.buildObjectControl = function(folder, componentTemp
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'sourceProperties') {
|
if (property === 'sourceProperties') {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Object.keys(object).map(
|
Object.keys(object).map(
|
||||||
function(propertyId) {
|
function(propertyId) {
|
||||||
folder.add(
|
folder.add(
|
||||||
|
@ -650,7 +647,7 @@ GameLib.System.GUI.prototype.buildSelectControl = function(folder, componentTemp
|
||||||
*/
|
*/
|
||||||
var constructors = null;
|
var constructors = null;
|
||||||
|
|
||||||
if (componentTemplate.template.linkedObjects[property]) {
|
if (componentTemplate.template.linkedObjects && componentTemplate.template.linkedObjects[property]) {
|
||||||
constructors = componentTemplate.template.linkedObjects[property];
|
constructors = componentTemplate.template.linkedObjects[property];
|
||||||
} else {
|
} else {
|
||||||
if (componentTemplate.template[property]) {
|
if (componentTemplate.template[property]) {
|
||||||
|
|
Loading…
Reference in New Issue