load and outstanding progress
parent
f419657ac6
commit
9ad44012ce
|
@ -105,6 +105,7 @@ GameLib.Event.FONT_INSTANCE_CREATED = 0x57;
|
|||
GameLib.Event.REGISTER_DEPENDENCIES = 0x58;
|
||||
GameLib.Event.GAME_LOADED = 0x59;
|
||||
GameLib.Event.GAME_RESTART = 0x5a;
|
||||
GameLib.Event.LOAD_PROGRESS = 0x5b;
|
||||
|
||||
/**
|
||||
* Returns string name of event ID
|
||||
|
@ -205,6 +206,7 @@ GameLib.Event.GetEventName = function(number) {
|
|||
case 0x58 : return 'register_dependencies';
|
||||
case 0x59 : return 'game_loaded';
|
||||
case 0x5a : return 'game_restart';
|
||||
case 0x5b : return 'load_progress';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -579,6 +579,14 @@ GameLib.System.Storage.prototype.loadComponent = function(apiUrl, toProcess, inc
|
|||
|
||||
var toProcess = GameLib.Utils.Difference(loaded.map(function(component){return component.id}), loading);
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.LOAD_PROGRESS,
|
||||
{
|
||||
loaded : loaded.length,
|
||||
toProcess : toProcess.length
|
||||
}
|
||||
);
|
||||
|
||||
if (toProcess.length === 0) {
|
||||
|
||||
if (clientCallback) {
|
||||
|
|
Loading…
Reference in New Issue