rename custom code component
parent
ececa4428a
commit
503ed91bed
|
@ -377,7 +377,7 @@ GameLib.Component.GetComponentInfo = function(number) {
|
|||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
};
|
||||
case 0x16 : return {
|
||||
name : 'GameLib.D3.CustomCode',
|
||||
name : 'GameLib.CustomCode',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
};
|
||||
case 0x17 : return {
|
||||
|
@ -764,7 +764,7 @@ GameLib.Component.prototype.generateNewIds = function() {
|
|||
|
||||
this.buildIdToObject();
|
||||
|
||||
var codeComponents = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.CustomCode);
|
||||
var codeComponents = GameLib.EntityManager.Instance.queryComponents(GameLib.CustomCode);
|
||||
|
||||
for (var property in this.idToObject) {
|
||||
if (this.idToObject.hasOwnProperty(property)) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.CustomCode = function (
|
||||
GameLib.API.CustomCode = function (
|
||||
id,
|
||||
name,
|
||||
eventId,
|
||||
|
@ -41,17 +41,17 @@ GameLib.D3.API.CustomCode = function (
|
|||
|
||||
};
|
||||
|
||||
GameLib.D3.API.CustomCode.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.CustomCode.prototype.constructor = GameLib.D3.API.CustomCode;
|
||||
GameLib.API.CustomCode.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.API.CustomCode.prototype.constructor = GameLib.API.CustomCode;
|
||||
|
||||
/**
|
||||
* Object to GameLib.D3.API.CustomCode
|
||||
* Object to GameLib.API.CustomCode
|
||||
* @param objectComponent
|
||||
* @returns {GameLib.D3.API.CustomCode}
|
||||
* @returns {GameLib.API.CustomCode}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.CustomCode.FromObject = function(objectComponent) {
|
||||
return new GameLib.D3.API.CustomCode(
|
||||
GameLib.API.CustomCode.FromObject = function(objectComponent) {
|
||||
return new GameLib.API.CustomCode(
|
||||
objectComponent.id,
|
||||
objectComponent.name,
|
||||
objectComponent.eventId,
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* Creates a CustomCode object
|
||||
* @param apiCustomCode GameLib.D3.API.CustomCode
|
||||
* @param apiCustomCode GameLib.API.CustomCode
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.CustomCode = function(
|
||||
GameLib.CustomCode = function(
|
||||
apiCustomCode
|
||||
) {
|
||||
|
||||
|
@ -11,11 +11,11 @@ GameLib.D3.CustomCode = function(
|
|||
apiCustomCode = {};
|
||||
}
|
||||
|
||||
if (apiCustomCode instanceof GameLib.D3.CustomCode) {
|
||||
if (apiCustomCode instanceof GameLib.CustomCode) {
|
||||
return apiCustomCode;
|
||||
}
|
||||
|
||||
GameLib.D3.API.CustomCode.call(
|
||||
GameLib.API.CustomCode.call(
|
||||
this,
|
||||
apiCustomCode.id,
|
||||
apiCustomCode.name,
|
||||
|
@ -32,10 +32,10 @@ GameLib.D3.CustomCode = function(
|
|||
);
|
||||
};
|
||||
|
||||
GameLib.D3.CustomCode.prototype = Object.create(GameLib.D3.API.CustomCode.prototype);
|
||||
GameLib.D3.CustomCode.prototype.constructor = GameLib.D3.CustomCode;
|
||||
GameLib.CustomCode.prototype = Object.create(GameLib.API.CustomCode.prototype);
|
||||
GameLib.CustomCode.prototype.constructor = GameLib.CustomCode;
|
||||
|
||||
GameLib.D3.CustomCode.prototype.createInstance = function() {
|
||||
GameLib.CustomCode.prototype.createInstance = function() {
|
||||
|
||||
try {
|
||||
this.instance = new Function('data', this.code).bind(this);
|
||||
|
@ -53,7 +53,7 @@ GameLib.D3.CustomCode.prototype.createInstance = function() {
|
|||
/**
|
||||
* Updates the instance with the current state
|
||||
*/
|
||||
GameLib.D3.CustomCode.prototype.updateInstance = function() {
|
||||
GameLib.CustomCode.prototype.updateInstance = function() {
|
||||
|
||||
try {
|
||||
this.instance = new Function('data', this.code).bind(this);
|
||||
|
@ -76,12 +76,12 @@ GameLib.D3.CustomCode.prototype.updateInstance = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* Converts a GameLib.D3.CustomCode to a new GameLib.D3.API.CustomCode
|
||||
* @returns {GameLib.D3.API.CustomCode}
|
||||
* Converts a GameLib.CustomCode to a new GameLib.API.CustomCode
|
||||
* @returns {GameLib.API.CustomCode}
|
||||
*/
|
||||
GameLib.D3.CustomCode.prototype.toApiObject = function() {
|
||||
GameLib.CustomCode.prototype.toApiObject = function() {
|
||||
|
||||
return new GameLib.D3.API.CustomCode(
|
||||
return new GameLib.API.CustomCode(
|
||||
this.id,
|
||||
this.name,
|
||||
this.eventId,
|
||||
|
@ -92,19 +92,19 @@ GameLib.D3.CustomCode.prototype.toApiObject = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* Converts from an Object CustomCode to a GameLib.D3.CustomCode
|
||||
* Converts from an Object CustomCode to a GameLib.CustomCode
|
||||
* @param objectCustomCode Object
|
||||
* @returns {GameLib.D3.CustomCode}
|
||||
* @returns {GameLib.CustomCode}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.CustomCode.FromObject = function(objectCustomCode) {
|
||||
var apiCustomCode = GameLib.D3.API.CustomCode.FromObject(objectCustomCode);
|
||||
return new GameLib.D3.CustomCode(
|
||||
GameLib.CustomCode.FromObject = function(objectCustomCode) {
|
||||
var apiCustomCode = GameLib.API.CustomCode.FromObject(objectCustomCode);
|
||||
return new GameLib.CustomCode(
|
||||
apiCustomCode
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.CustomCode.prototype.launchEditor = function(){
|
||||
GameLib.CustomCode.prototype.launchEditor = function(){
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.GET_RUNTIME,
|
||||
|
@ -136,7 +136,7 @@ GameLib.D3.CustomCode.prototype.launchEditor = function(){
|
|||
}.bind(this))
|
||||
};
|
||||
|
||||
GameLib.D3.CustomCode.prototype.closeEditor = function(){
|
||||
GameLib.CustomCode.prototype.closeEditor = function(){
|
||||
var dom = this.editor.getWrapperElement();
|
||||
dom.parentElement.removeChild(dom);
|
||||
};
|
|
@ -31,7 +31,7 @@ GameLib.System.CustomCode.prototype.start = function() {
|
|||
|
||||
GameLib.System.prototype.start.call(this);
|
||||
|
||||
GameLib.EntityManager.Instance.queryComponents(GameLib.D3.CustomCode).map(
|
||||
GameLib.EntityManager.Instance.queryComponents(GameLib.CustomCode).map(
|
||||
function(component) {
|
||||
this.subscriptions[component.id] = GameLib.Event.Subscribe(
|
||||
component.eventId,
|
||||
|
@ -64,7 +64,7 @@ GameLib.System.CustomCode.prototype.start = function() {
|
|||
};
|
||||
|
||||
GameLib.System.CustomCode.prototype.instanceCreated = function(data) {
|
||||
if (data.component instanceof GameLib.D3.CustomCode) {
|
||||
if (data.component instanceof GameLib.CustomCode) {
|
||||
|
||||
if (this.subscriptions[data.component.id]) {
|
||||
console.warn('a component already existed');
|
||||
|
@ -79,7 +79,7 @@ GameLib.System.CustomCode.prototype.instanceCreated = function(data) {
|
|||
};
|
||||
|
||||
GameLib.System.CustomCode.prototype.removeComponent = function(data) {
|
||||
if (data.component instanceof GameLib.D3.CustomCode) {
|
||||
if (data.component instanceof GameLib.CustomCode) {
|
||||
if (this.subscriptions[data.component.id]) {
|
||||
this.subscriptions[data.component.id].remove();
|
||||
delete this.subscriptions[data.component.id];
|
||||
|
|
Loading…
Reference in New Issue