diff --git a/src/game-lib-a-component-a.js b/src/game-lib-a-component-a.js index 044c561..0ddff20 100644 --- a/src/game-lib-a-component-a.js +++ b/src/game-lib-a-component-a.js @@ -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)) { diff --git a/src/game-lib-d3-api-custom-code.js b/src/game-lib-api-custom-code.js similarity index 71% rename from src/game-lib-d3-api-custom-code.js rename to src/game-lib-api-custom-code.js index dee8436..9735e84 100644 --- a/src/game-lib-d3-api-custom-code.js +++ b/src/game-lib-api-custom-code.js @@ -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, diff --git a/src/game-lib-d3-custom-code.js b/src/game-lib-custom-code.js similarity index 68% rename from src/game-lib-d3-custom-code.js rename to src/game-lib-custom-code.js index 089efbb..ca12f39 100644 --- a/src/game-lib-d3-custom-code.js +++ b/src/game-lib-custom-code.js @@ -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); }; \ No newline at end of file diff --git a/src/game-lib-system-custom-code.js b/src/game-lib-system-custom-code.js index 23f0115..7ccdb7a 100644 --- a/src/game-lib-system-custom-code.js +++ b/src/game-lib-system-custom-code.js @@ -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];