receive component

beta.r3js.org
-=yb4f310 2017-12-10 13:47:00 +01:00
parent 0bb9a01863
commit 23e6b4101b
9 changed files with 516 additions and 211 deletions

28
build/game-lib-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
// COMPILE TIME DEFINITIONS (Generated via gulp)
var __DATE__ = "Sun Dec 10 2017 12:56:56 GMT+0100 (CET)";
var __DATE__ = "Sun Dec 10 2017 13:45:44 GMT+0100 (CET)";
// END COMPILE TIME DEFINITIONS
/**
@ -186,9 +186,7 @@ GameLib.Event.GAME_RESUMED = 0x68;
GameLib.Event.CUSTOM_GAME_START = 0x69;
GameLib.Event.AUDIO_MUTED = 0x6a;
GameLib.Event.AUDIO_UNMUTED = 0x6b;
GameLib.Event.RECEIVE_DESTINATION_CHANGED = 0x6c;
/**
* Returns string name of event ID
@ -306,6 +304,7 @@ GameLib.Event.GetEventName = function(number) {
case 0x69 : return 'custom_game_start';
case 0x6a : return 'audio_muted';
case 0x6b : return 'audio_unmuted';
case 0x6c : return 'receive_destination_changed';
break;
}
@ -540,6 +539,81 @@ GameLib.Utils.StripImageExtension = function(imagePath) {
return imagePath.replace(/(\.png$|\.gif$|\.jpeg$|\.jpg$)/,'')
};
GameLib.Utils.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.Utils.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;
};
GameLib.Utils.ObjectPropertiesAsBoolean = function(object) {
return Object.keys(object).reduce(
function(result, propertyId) {
if (typeof object[propertyId] === 'function') {
return result;
}
result[propertyId] = false;
// if (object[propertyId] instanceof GameLib.Vector2) {
// GameLib.Utils.BuildVectorSource(result, propertyId, 2);
// }
//
// if (object[propertyId] instanceof GameLib.Vector3) {
// GameLib.Utils.BuildVectorSource(result, propertyId, 3);
// }
//
// if (object[propertyId] instanceof GameLib.Vector4) {
// GameLib.Utils.BuildVectorSource(result, propertyId, 4);
// }
//
// if (object[propertyId] instanceof GameLib.Quaternion) {
// GameLib.Utils.BuildQuaternionSource(result, propertyId);
// }
return result;
}.bind(this),
{}
);
};
/**
* Returns id of object with the name if it exists in the array, otherwise null
* @param name
@ -1505,7 +1579,7 @@ GameLib.Component.prototype.toString = function() {
return this.id;
};
//GameLib.Component.PATH_FOLLOWING = 0x1;
GameLib.Component.RECEIVE = 0x1;
GameLib.Component.MATERIAL = 0x2;
GameLib.Component.RENDERER = 0x3;
//GameLib.Component.LOOK_AT = 0x4;
@ -1611,7 +1685,12 @@ GameLib.Component.GetCompentTypes = function(constructor) {
*/
GameLib.Component.GetComponentInfo = function(number) {
switch(number) {
case 0x1 : return null;
case 0x1 : return {
name : 'GameLib.Receive',
runtime : GameLib.Component.SOCKET_RUNTIME,
constructor : GameLib.Receive,
apiConstructor : GameLib.API.Receive
};
case 0x2 : return {
name : 'GameLib.D3.Material',
runtime : GameLib.Component.GRAPHICS_RUNTIME,
@ -4126,8 +4205,8 @@ GameLib.API.Quaternion.Points.prototype.toOrigin = function () {
* @param id
* @param name
* @param receiveType
* @param source
* @param sourceProperties
* @param destination
* @param destinationProperties
* @param roomId
* @param peerId
* @param serverIp
@ -4139,8 +4218,8 @@ GameLib.API.Receive = function(
id,
name,
receiveType,
source,
sourceProperties,
destination,
destinationProperties,
roomId,
peerId,
serverIp,
@ -4158,20 +4237,20 @@ GameLib.API.Receive = function(
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(castType)) {
castType = GameLib.API.Receive.CAST_TYPE_ROOM;
if (GameLib.Utils.UndefinedOrNull(receiveType)) {
receiveType = GameLib.API.Receive.RECEIVE_TYPE_ROOM;
}
this.castType = castType;
this.receiveType = receiveType;
if (GameLib.Utils.UndefinedOrNull(source)) {
source = null;
if (GameLib.Utils.UndefinedOrNull(destination)) {
destination = null;
}
this.source = source;
this.destination = destination;
if (GameLib.Utils.UndefinedOrNull(sourceProperties)) {
sourceProperties = null;
if (GameLib.Utils.UndefinedOrNull(destinationProperties)) {
destinationProperties = null;
}
this.sourceProperties = sourceProperties;
this.destinationProperties = destinationProperties;
if (GameLib.Utils.UndefinedOrNull(roomId)) {
roomId = 'default';
@ -4195,7 +4274,7 @@ GameLib.API.Receive = function(
GameLib.API.Component.call(
this,
GameLib.Component.CAST,
GameLib.Component.RECEIVE,
parentEntity
);
};
@ -4203,8 +4282,8 @@ GameLib.API.Receive = function(
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;
GameLib.API.Receive.RECEIVE_TYPE_ROOM = 0x1;
GameLib.API.Receive.RECEIVE_TYPE_PEER = 0x2;
/**
@ -4218,8 +4297,8 @@ GameLib.API.Receive.FromObject = function(objectReceive) {
objectReceive.id,
objectReceive.name,
objectReceive.castType,
objectReceive.source,
objectReceive.sourceProperties,
objectReceive.destination,
objectReceive.destinationProperties,
objectReceive.roomId,
objectReceive.peerId,
objectReceive.serverIp,
@ -4897,84 +4976,13 @@ GameLib.Cast.prototype.createInstance = function() {
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
*/
GameLib.Cast.prototype.updateInstance = function(property) {
if (property === 'source') {
if (this.source !== null) {
this.sourceProperties = Object.keys(this.source).reduce(
function(result, propertyId) {
if (typeof this.source[propertyId] === 'function') {
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),
{}
)
this.sourceProperties = GameLib.Utils.ObjectPropertiesAsBoolean(this.source);
} else {
this.sourceProperties = {};
}
@ -24902,6 +24910,125 @@ GameLib.Quaternion.prototype.setFrom = function(quaternion) {
GameLib.Quaternion.prototype.copy = function(quaternion) {
console.log('todo');
};
/**
* Creates a Receive object
* @param socket GameLib.Socket
* @param apiReceive GameLib.API.Receive
* @constructor
*/
GameLib.Receive = function(
socket,
apiReceive
) {
this.socket = socket;
this.socket.isNotWebSocketThrow();
if (GameLib.Utils.UndefinedOrNull(apiReceive)) {
apiReceive = {};
}
if (apiReceive instanceof GameLib.Receive) {
return apiReceive;
}
GameLib.API.Receive.call(
this,
apiReceive.id,
apiReceive.name,
apiReceive.receiveType,
apiReceive.destination,
apiReceive.destinationProperties,
apiReceive.roomId,
apiReceive.peerId,
apiReceive.serverIp,
apiReceive.port,
apiReceive.parentEntity
);
this.connected = false;
GameLib.Component.call(
this,
{
destination : GameLib.Component
}
);
};
GameLib.Receive.prototype = Object.create(GameLib.API.Receive.prototype);
GameLib.Receive.prototype.constructor = GameLib.Receive;
GameLib.Receive.prototype.createInstance = function() {
this.instance = true;
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.Receive.prototype.updateInstance = function(property) {
if (property === 'destination') {
if (this.destination !== null) {
this.destinationProperties = GameLib.Utils.ObjectPropertiesAsBoolean(this.destination);
} else {
this.destinationProperties = {};
}
GameLib.Event.Emit(
GameLib.Event.RECEIVE_DESTINATION_CHANGED,
{
component:this
}
)
}
if (property === 'destinationProperties') {
console.log(this.destinationProperties);
}
};
/**
* Converts a GameLib.Receive to a new GameLib.API.Receive
* @returns {GameLib.API.Receive}
*/
GameLib.Receive.prototype.toApiObject = function() {
return new GameLib.API.Receive(
this.id,
this.name,
this.receiveType,
GameLib.Utils.IdOrNull(this.destination),
this.destinationProperties,
this.roomId,
this.peerId,
this.serverIp,
this.port,
GameLib.Utils.IdOrNull(this.parentEntity)
);
};
/**
* Converts from an Object Receive to a GameLib.Receive
* @param sockets GameLib.SocketsRuntime
* @param objectReceive Object
* @returns {GameLib.Receive}
* @constructor
*/
GameLib.Receive.FromObject = function(sockets, objectReceive) {
var apiReceive = GameLib.API.Receive.FromObject(objectReceive);
return new GameLib.Receive(
sockets,
apiReceive
);
};
/**
* Sockets
* @param id
@ -27017,6 +27144,12 @@ GameLib.System.GUI.prototype.start = function() {
GameLib.Event.CAST_SOURCE_CHANGED,
this.castSourceChanged
);
this.destinationChangedSubscription = this.subscribe(
GameLib.Event.RECEIVE_DESTINATION_CHANGED,
this.receiveDestinationChanged
);
};
GameLib.System.GUI.prototype.onChange = function(property, subProperty, affected) {
@ -27444,7 +27577,10 @@ GameLib.System.GUI.prototype.buildObjectControl = function(folder, componentTemp
return;
}
if (property === 'sourceProperties') {
if (
property === 'sourceProperties' ||
property === 'destinationProperties'
) {
Object.keys(object).map(
function(propertyId) {
folder.add(
@ -27454,8 +27590,8 @@ GameLib.System.GUI.prototype.buildObjectControl = function(folder, componentTemp
function(value) {
componentTemplate.affected.map(
function(component){
component.sourceProperties[propertyId] = value;
component.updateInstance('sourceProperties');
component[property][propertyId] = value;
component.updateInstance(property);
}
);
}
@ -27604,6 +27740,17 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
}
)
);
} else if (property === 'receiveType') {
controllers.push(
folder.add(
object,
property,
{
'room': GameLib.API.Receive.RECEIVE_TYPE_ROOM,
'peer': GameLib.API.Cast.RECEIVE_TYPE_PEER
}
)
);
} else if (property === 'opacityType') {
controllers.push(
folder.add(
@ -28719,6 +28866,10 @@ GameLib.System.GUI.prototype.castSourceChanged = function(data) {
this.buildGUI(null);
};
GameLib.System.GUI.prototype.receiveDestinationChanged = function(data) {
this.buildGUI(null);
};
GameLib.System.GUI.prototype.stop = function() {
GameLib.System.prototype.stop.call(this);
@ -28745,6 +28896,8 @@ GameLib.System.GUI.prototype.stop = function() {
this.sourceChangedSubscription.remove();
this.destinationChangedSubscription.remove();
this.guis = [];
};

View File

@ -122,9 +122,7 @@ GameLib.Event.GAME_RESUMED = 0x68;
GameLib.Event.CUSTOM_GAME_START = 0x69;
GameLib.Event.AUDIO_MUTED = 0x6a;
GameLib.Event.AUDIO_UNMUTED = 0x6b;
GameLib.Event.RECEIVE_DESTINATION_CHANGED = 0x6c;
/**
* Returns string name of event ID
@ -242,6 +240,7 @@ GameLib.Event.GetEventName = function(number) {
case 0x69 : return 'custom_game_start';
case 0x6a : return 'audio_muted';
case 0x6b : return 'audio_unmuted';
case 0x6c : return 'receive_destination_changed';
break;
}

View File

@ -9,6 +9,81 @@ GameLib.Utils.StripImageExtension = function(imagePath) {
return imagePath.replace(/(\.png$|\.gif$|\.jpeg$|\.jpg$)/,'')
};
GameLib.Utils.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.Utils.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;
};
GameLib.Utils.ObjectPropertiesAsBoolean = function(object) {
return Object.keys(object).reduce(
function(result, propertyId) {
if (typeof object[propertyId] === 'function') {
return result;
}
result[propertyId] = false;
// if (object[propertyId] instanceof GameLib.Vector2) {
// GameLib.Utils.BuildVectorSource(result, propertyId, 2);
// }
//
// if (object[propertyId] instanceof GameLib.Vector3) {
// GameLib.Utils.BuildVectorSource(result, propertyId, 3);
// }
//
// if (object[propertyId] instanceof GameLib.Vector4) {
// GameLib.Utils.BuildVectorSource(result, propertyId, 4);
// }
//
// if (object[propertyId] instanceof GameLib.Quaternion) {
// GameLib.Utils.BuildQuaternionSource(result, propertyId);
// }
return result;
}.bind(this),
{}
);
};
/**
* Returns id of object with the name if it exists in the array, otherwise null
* @param name

View File

@ -204,7 +204,7 @@ GameLib.Component.prototype.toString = function() {
return this.id;
};
//GameLib.Component.PATH_FOLLOWING = 0x1;
GameLib.Component.RECEIVE = 0x1;
GameLib.Component.MATERIAL = 0x2;
GameLib.Component.RENDERER = 0x3;
//GameLib.Component.LOOK_AT = 0x4;
@ -310,7 +310,12 @@ GameLib.Component.GetCompentTypes = function(constructor) {
*/
GameLib.Component.GetComponentInfo = function(number) {
switch(number) {
case 0x1 : return null;
case 0x1 : return {
name : 'GameLib.Receive',
runtime : GameLib.Component.SOCKET_RUNTIME,
constructor : GameLib.Receive,
apiConstructor : GameLib.API.Receive
};
case 0x2 : return {
name : 'GameLib.D3.Material',
runtime : GameLib.Component.GRAPHICS_RUNTIME,

View File

@ -3,8 +3,8 @@
* @param id
* @param name
* @param receiveType
* @param source
* @param sourceProperties
* @param destination
* @param destinationProperties
* @param roomId
* @param peerId
* @param serverIp
@ -16,8 +16,8 @@ GameLib.API.Receive = function(
id,
name,
receiveType,
source,
sourceProperties,
destination,
destinationProperties,
roomId,
peerId,
serverIp,
@ -35,20 +35,20 @@ GameLib.API.Receive = function(
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(castType)) {
castType = GameLib.API.Receive.CAST_TYPE_ROOM;
if (GameLib.Utils.UndefinedOrNull(receiveType)) {
receiveType = GameLib.API.Receive.RECEIVE_TYPE_ROOM;
}
this.castType = castType;
this.receiveType = receiveType;
if (GameLib.Utils.UndefinedOrNull(source)) {
source = null;
if (GameLib.Utils.UndefinedOrNull(destination)) {
destination = null;
}
this.source = source;
this.destination = destination;
if (GameLib.Utils.UndefinedOrNull(sourceProperties)) {
sourceProperties = null;
if (GameLib.Utils.UndefinedOrNull(destinationProperties)) {
destinationProperties = null;
}
this.sourceProperties = sourceProperties;
this.destinationProperties = destinationProperties;
if (GameLib.Utils.UndefinedOrNull(roomId)) {
roomId = 'default';
@ -72,7 +72,7 @@ GameLib.API.Receive = function(
GameLib.API.Component.call(
this,
GameLib.Component.CAST,
GameLib.Component.RECEIVE,
parentEntity
);
};
@ -80,8 +80,8 @@ GameLib.API.Receive = function(
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;
GameLib.API.Receive.RECEIVE_TYPE_ROOM = 0x1;
GameLib.API.Receive.RECEIVE_TYPE_PEER = 0x2;
/**
@ -95,8 +95,8 @@ GameLib.API.Receive.FromObject = function(objectReceive) {
objectReceive.id,
objectReceive.name,
objectReceive.castType,
objectReceive.source,
objectReceive.sourceProperties,
objectReceive.destination,
objectReceive.destinationProperties,
objectReceive.roomId,
objectReceive.peerId,
objectReceive.serverIp,

View File

@ -55,84 +55,13 @@ GameLib.Cast.prototype.createInstance = function() {
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
*/
GameLib.Cast.prototype.updateInstance = function(property) {
if (property === 'source') {
if (this.source !== null) {
this.sourceProperties = Object.keys(this.source).reduce(
function(result, propertyId) {
if (typeof this.source[propertyId] === 'function') {
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),
{}
)
this.sourceProperties = GameLib.Utils.ObjectPropertiesAsBoolean(this.source);
} else {
this.sourceProperties = {};
}

118
src/game-lib-receive.js Normal file
View File

@ -0,0 +1,118 @@
/**
* Creates a Receive object
* @param socket GameLib.Socket
* @param apiReceive GameLib.API.Receive
* @constructor
*/
GameLib.Receive = function(
socket,
apiReceive
) {
this.socket = socket;
this.socket.isNotWebSocketThrow();
if (GameLib.Utils.UndefinedOrNull(apiReceive)) {
apiReceive = {};
}
if (apiReceive instanceof GameLib.Receive) {
return apiReceive;
}
GameLib.API.Receive.call(
this,
apiReceive.id,
apiReceive.name,
apiReceive.receiveType,
apiReceive.destination,
apiReceive.destinationProperties,
apiReceive.roomId,
apiReceive.peerId,
apiReceive.serverIp,
apiReceive.port,
apiReceive.parentEntity
);
this.connected = false;
GameLib.Component.call(
this,
{
destination : GameLib.Component
}
);
};
GameLib.Receive.prototype = Object.create(GameLib.API.Receive.prototype);
GameLib.Receive.prototype.constructor = GameLib.Receive;
GameLib.Receive.prototype.createInstance = function() {
this.instance = true;
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.Receive.prototype.updateInstance = function(property) {
if (property === 'destination') {
if (this.destination !== null) {
this.destinationProperties = GameLib.Utils.ObjectPropertiesAsBoolean(this.destination);
} else {
this.destinationProperties = {};
}
GameLib.Event.Emit(
GameLib.Event.RECEIVE_DESTINATION_CHANGED,
{
component:this
}
)
}
if (property === 'destinationProperties') {
console.log(this.destinationProperties);
}
};
/**
* Converts a GameLib.Receive to a new GameLib.API.Receive
* @returns {GameLib.API.Receive}
*/
GameLib.Receive.prototype.toApiObject = function() {
return new GameLib.API.Receive(
this.id,
this.name,
this.receiveType,
GameLib.Utils.IdOrNull(this.destination),
this.destinationProperties,
this.roomId,
this.peerId,
this.serverIp,
this.port,
GameLib.Utils.IdOrNull(this.parentEntity)
);
};
/**
* Converts from an Object Receive to a GameLib.Receive
* @param sockets GameLib.SocketsRuntime
* @param objectReceive Object
* @returns {GameLib.Receive}
* @constructor
*/
GameLib.Receive.FromObject = function(sockets, objectReceive) {
var apiReceive = GameLib.API.Receive.FromObject(objectReceive);
return new GameLib.Receive(
sockets,
apiReceive
);
};

View File

@ -192,6 +192,12 @@ GameLib.System.GUI.prototype.start = function() {
GameLib.Event.CAST_SOURCE_CHANGED,
this.castSourceChanged
);
this.destinationChangedSubscription = this.subscribe(
GameLib.Event.RECEIVE_DESTINATION_CHANGED,
this.receiveDestinationChanged
);
};
GameLib.System.GUI.prototype.onChange = function(property, subProperty, affected) {
@ -619,7 +625,10 @@ GameLib.System.GUI.prototype.buildObjectControl = function(folder, componentTemp
return;
}
if (property === 'sourceProperties') {
if (
property === 'sourceProperties' ||
property === 'destinationProperties'
) {
Object.keys(object).map(
function(propertyId) {
folder.add(
@ -629,8 +638,8 @@ GameLib.System.GUI.prototype.buildObjectControl = function(folder, componentTemp
function(value) {
componentTemplate.affected.map(
function(component){
component.sourceProperties[propertyId] = value;
component.updateInstance('sourceProperties');
component[property][propertyId] = value;
component.updateInstance(property);
}
);
}
@ -779,6 +788,17 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
}
)
);
} else if (property === 'receiveType') {
controllers.push(
folder.add(
object,
property,
{
'room': GameLib.API.Receive.RECEIVE_TYPE_ROOM,
'peer': GameLib.API.Cast.RECEIVE_TYPE_PEER
}
)
);
} else if (property === 'opacityType') {
controllers.push(
folder.add(
@ -1894,6 +1914,10 @@ GameLib.System.GUI.prototype.castSourceChanged = function(data) {
this.buildGUI(null);
};
GameLib.System.GUI.prototype.receiveDestinationChanged = function(data) {
this.buildGUI(null);
};
GameLib.System.GUI.prototype.stop = function() {
GameLib.System.prototype.stop.call(this);
@ -1920,6 +1944,8 @@ GameLib.System.GUI.prototype.stop = function() {
this.sourceChangedSubscription.remove();
this.destinationChangedSubscription.remove();
this.guis = [];
};