mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Refactored abstract method creation
This commit is contained in:
parent
1a71fa38f9
commit
7c783d19e8
6 changed files with 72 additions and 163 deletions
|
|
@ -13,17 +13,23 @@ function (Parent, Settings, Nc, PIXI) {
|
|||
|
||||
Level.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Level.prototype.setup = function(levelData) {
|
||||
this.levelData = levelData;
|
||||
this.addBackground();
|
||||
Parent.prototype.setup.call(this, levelData);
|
||||
};
|
||||
|
||||
Level.prototype.loadLevelDataFromPath = function (path, callback) {
|
||||
var self = this;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4) {
|
||||
if(xhr.status == 200) {
|
||||
self.loadAssets(JSON.parse(xhr.responseText), callback);
|
||||
} else {
|
||||
console.error("Ajax error: " + xhr.status + " " + xhr.statusText)
|
||||
}
|
||||
if(xhr.readyState == 4) {
|
||||
if(xhr.status == 200) {
|
||||
self.loadAssets(JSON.parse(xhr.responseText), callback);
|
||||
} else {
|
||||
console.error("Ajax error: " + xhr.status + " " + xhr.statusText)
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.open("GET", path, true);
|
||||
xhr.send(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue