| 2307 |
})(E); |
})(E); |
| 2308 |
var LoadingScene = (function (_super) { |
var LoadingScene = (function (_super) { |
| 2309 |
__extends(LoadingScene, _super); |
__extends(LoadingScene, _super); |
| 2310 |
function LoadingScene(game, resource, noShape) { |
function LoadingScene(game, resource) { |
| 2311 |
_super.call(this, game); |
_super.call(this, game); |
| 2312 |
|
this.game = game; |
| 2313 |
this.resource = resource; |
this.resource = resource; |
| 2314 |
this.resource.loaded.handle(this, this.complete); |
this.resource.loaded.handle(this, this.complete); |
| 2315 |
this.resource.added.handle(this, this.added); |
this.resource.added.handle(this, this.added); |
| 2316 |
this.requestCount = this.resource.requests.length; |
this.requestCount = this.resource.requests.length; |
| 2317 |
this.finished = new Trigger(); |
this.finished = new Trigger(); |
| 2318 |
if(!noShape) { |
this.init(); |
|
this.shape = new Shape(game.width, 32); |
|
|
this.shape.moveTo(0, game.height / 2 - 16); |
|
|
this.shapeP = new Shape(1, 32, ShapeStyle.Fill); |
|
|
this.shapeP.moveTo(0, game.height / 2 - 16); |
|
|
this.append(this.shape); |
|
|
this.append(this.shapeP); |
|
|
} |
|
| 2319 |
} |
} |
| 2320 |
LoadingScene.prototype.complete = function (cnt) { |
LoadingScene.prototype.init = function () { |
| 2321 |
var per = (this.requestCount - cnt) / this.requestCount; |
this.shape = new Shape(this.game.width, 32); |
| 2322 |
|
this.shape.moveTo(0, this.game.height / 2 - 16); |
| 2323 |
|
this.shapeP = new Shape(1, 32, ShapeStyle.Fill); |
| 2324 |
|
this.shapeP.moveTo(0, this.game.height / 2 - 16); |
| 2325 |
|
this.append(this.shape); |
| 2326 |
|
this.append(this.shapeP); |
| 2327 |
|
}; |
| 2328 |
|
LoadingScene.prototype.animate = function (per) { |
| 2329 |
this.shapeP.width = this.game.width * per; |
this.shapeP.width = this.game.width * per; |
| 2330 |
this.shapeP.updated(); |
this.shapeP.updated(); |
| 2331 |
|
}; |
| 2332 |
|
LoadingScene.prototype.complete = function (cnt) { |
| 2333 |
|
var per = (this.requestCount - cnt) / this.requestCount; |
| 2334 |
|
this.animate(per); |
| 2335 |
if(per == 1) { |
if(per == 1) { |
| 2336 |
this.resource.loaded.remove(this, this.complete); |
this.resource.loaded.remove(this, this.complete); |
| 2337 |
this.resource.added.remove(this, this.added); |
this.resource.added.remove(this, this.added); |
| 2759 |
this.width = width; |
this.width = width; |
| 2760 |
this.height = height; |
this.height = height; |
| 2761 |
this.targetFps = 0; |
this.targetFps = 0; |
| 2762 |
this.autoLoading = true; |
this.loadingSceneClass = LoadingScene; |
| 2763 |
this.loaded = new Trigger(); |
this.loaded = new Trigger(); |
| 2764 |
this.update = new Trigger(); |
this.update = new Trigger(); |
| 2765 |
this.pointDown = new Trigger(); |
this.pointDown = new Trigger(); |
| 3088 |
this.resource.load(i, ary[i]); |
this.resource.load(i, ary[i]); |
| 3089 |
} |
} |
| 3090 |
} |
} |
| 3091 |
if(this.autoLoading) { |
if(this.loadingSceneClass && !this.loadingScene) { |
| 3092 |
var loadingScene = new LoadingScene(this, this.resource); |
this.setLoadingScene(this.loadingSceneClass); |
|
loadingScene.finished.handle(this, this.preloadComplete); |
|
|
this.changeScene(loadingScene); |
|
| 3093 |
} |
} |
| 3094 |
}; |
}; |
| 3095 |
Game.prototype.preloadOther = function (identity) { |
Game.prototype.preloadOther = function (identity) { |
| 3098 |
Game.prototype.preloadCompleteOther = function (identity) { |
Game.prototype.preloadCompleteOther = function (identity) { |
| 3099 |
this.resource.completeManual(identity); |
this.resource.completeManual(identity); |
| 3100 |
}; |
}; |
| 3101 |
|
Game.prototype.setLoadingScene = function (scene) { |
| 3102 |
|
if(!this.loadingScene) { |
| 3103 |
|
if(scene instanceof LoadingScene) { |
| 3104 |
|
this.loadingScene = scene; |
| 3105 |
|
} else { |
| 3106 |
|
this.loadingScene = new scene(this, this.resource); |
| 3107 |
|
} |
| 3108 |
|
this.loadingScene.finished.handle(this, this.preloadComplete); |
| 3109 |
|
this.changeScene(this.loadingScene); |
| 3110 |
|
} |
| 3111 |
|
}; |
| 3112 |
Game.prototype.preloadComplete = function () { |
Game.prototype.preloadComplete = function () { |
| 3113 |
|
if(this.loadingScene) { |
| 3114 |
|
delete this.loadingScene; |
| 3115 |
|
} |
| 3116 |
this.loaded.fire(); |
this.loaded.fire(); |
| 3117 |
}; |
}; |
| 3118 |
Game.prototype.end = function () { |
Game.prototype.end = function () { |