From 16a48cbac72d5cbaeca79f7f51e86021dcc4d76e Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 27 Oct 2017 10:47:30 +0200 Subject: [PATCH] proper linked and loading flags --- src/game-lib-a-component-a.js | 9 ++++++--- src/game-lib-system-linking.js | 8 +------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/game-lib-a-component-a.js b/src/game-lib-a-component-a.js index 5214825..bd02d07 100644 --- a/src/game-lib-a-component-a.js +++ b/src/game-lib-a-component-a.js @@ -54,14 +54,14 @@ GameLib.Component = function( /** * Build ID to object should run through all sub components - - * if one is found which is not loaded, this component is not loaded fully + * if one is found which is not linked, this component is not linked fully */ this.buildIdToObject(); /** - * Don't try to create an instance of this object until it is fully loaded + * Don't try to create an instance of this object until it is fully linked */ - if (this.loaded) { + if (this.linked) { try { this.createInstance(); } catch (error) { @@ -89,6 +89,9 @@ GameLib.Component.prototype.createInstance = function() { console.log('create instance : '+ this.name); if (this.instance) { + + this.loaded = true; + GameLib.Event.EmitInstanceEvents(this); } diff --git a/src/game-lib-system-linking.js b/src/game-lib-system-linking.js index c00cdc3..cbaf3ac 100644 --- a/src/game-lib-system-linking.js +++ b/src/game-lib-system-linking.js @@ -477,14 +477,8 @@ GameLib.System.Linking.prototype.componentCreated = function(data) { /** * Resolve any dependencies to this component */ - var resolved = this.resolveDependencies(component); + this.resolveDependencies(component); - if (resolved) { - /** - * Some dependencies were resolved - we should check our list of other components with unresolved dependencies - * and try to resolve them - */ - } };