diff --git a/libs/control.js b/libs/control.js index eb45c7e5..b6653234 100644 --- a/libs/control.js +++ b/libs/control.js @@ -2064,11 +2064,17 @@ control.prototype.loadData = function (data, callback) { ////// 设置勇士属性 ////// control.prototype.setStatus = function (statusName, statusVal) { - core.status.hero[statusName] = statusVal; + if (core.isset(core.status.hero.loc[statusName])) + core.status.hero.loc[statusName] = statusVal; + else + core.status.hero[statusName] = statusVal; } ////// 获得勇士属性 ////// control.prototype.getStatus = function (statusName) { + // support status:x + if (core.isset(core.status.hero.loc[statusName])) + return core.status.hero.loc[statusName]; return core.status.hero[statusName]; } diff --git a/libs/core.js b/libs/core.js index 0af085d3..34e06f1a 100644 --- a/libs/core.js +++ b/libs/core.js @@ -1028,8 +1028,8 @@ core.prototype.decodeRoute = function (route) { } ////// 发送HTTP ////// -core.prototype.http = function (type, url, formData, success, error, header) { - core.utils.http(type, url, formData, success, error, header) +core.prototype.http = function (type, url, formData, success, error, mimeType, responseType) { + core.utils.http(type, url, formData, success, error, mimeType, responseType) } ////// 设置勇士属性 ////// diff --git a/libs/loader.js b/libs/loader.js index 969f4f54..c74f36b0 100644 --- a/libs/loader.js +++ b/libs/loader.js @@ -204,12 +204,10 @@ loader.prototype.loadMusic = function () { core.sounds.forEach(function (t) { if (core.musicStatus.audioContext != null) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', 'project/sounds/'+t, true); - xhr.responseType = 'arraybuffer'; - xhr.onload = function(e) { //下载完成 + + core.http('GET', 'project/sounds/'+t, null, function (data) { try { - core.musicStatus.audioContext.decodeAudioData(this.response, function (buffer) { + core.musicStatus.audioContext.decodeAudioData(data, function (buffer) { core.material.sounds[t] = buffer; }, function (e) { console.log(e); @@ -220,17 +218,10 @@ loader.prototype.loadMusic = function () { console.log(ee); core.material.sounds[t] = null; } - }; - - xhr.ontimeout = function(e) { + }, function () { console.log(e); core.material.sounds[t] = null; - } - xhr.onerror = function(e) { - console.log(e); - core.material.sounds[t] = null; - } - xhr.send(); + }, null, 'arraybuffer'); } else { var music = new Audio(); diff --git a/libs/utils.js b/libs/utils.js index 8ad8e03b..b650904b 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -590,11 +590,13 @@ utils.prototype.hide = function (obj, speed, callback) { }, speed); } -utils.prototype.http = function (type, url, formData, success, error, mimeType) { +utils.prototype.http = function (type, url, formData, success, error, mimeType, responseType) { var xhr = new XMLHttpRequest(); xhr.open(type, url, true); if (core.isset(mimeType)) xhr.overrideMimeType(mimeType); + if (core.isset(responseType)) + xhr.responseType = responseType; xhr.onload = function(e) { if (xhr.status==200) { if (core.isset(success)) {