mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
31 lines
No EOL
858 B
JavaScript
Executable file
31 lines
No EOL
858 B
JavaScript
Executable file
define([
|
|
"Game/Core/Loader/Level",
|
|
"Game/Config/Settings"
|
|
],
|
|
|
|
function (Parent, Settings) {
|
|
|
|
function Level (uid, engine, gameObjects) {
|
|
Parent.call(this, uid, engine, gameObjects);
|
|
}
|
|
|
|
Level.prototype = Object.create(Parent.prototype);
|
|
|
|
Level.prototype.loadLevelDataFromPath = function (path, callback) {
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.onreadystatechange = function() {
|
|
if(xhr.readyState == 4) {
|
|
if(xhr.status == 200) {
|
|
callback(JSON.parse(xhr.responseText))
|
|
} else {
|
|
console.error("Ajax error: " + xhr.status + " " + xhr.statusText)
|
|
}
|
|
}
|
|
}
|
|
xhr.open("GET", path, true);
|
|
xhr.send(null);
|
|
}
|
|
|
|
return Level;
|
|
}); |