This commit is contained in:
oc 2018-05-12 12:50:00 +08:00
parent 334411878e
commit 985d3d8294
4 changed files with 17 additions and 18 deletions

View File

@ -2064,11 +2064,17 @@ control.prototype.loadData = function (data, callback) {
////// 设置勇士属性 ////// ////// 设置勇士属性 //////
control.prototype.setStatus = function (statusName, statusVal) { 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) { 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]; return core.status.hero[statusName];
} }

View File

@ -1028,8 +1028,8 @@ core.prototype.decodeRoute = function (route) {
} }
////// 发送HTTP ////// ////// 发送HTTP //////
core.prototype.http = function (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, header) core.utils.http(type, url, formData, success, error, mimeType, responseType)
} }
////// 设置勇士属性 ////// ////// 设置勇士属性 //////

View File

@ -204,12 +204,10 @@ loader.prototype.loadMusic = function () {
core.sounds.forEach(function (t) { core.sounds.forEach(function (t) {
if (core.musicStatus.audioContext != null) { if (core.musicStatus.audioContext != null) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'project/sounds/'+t, true); core.http('GET', 'project/sounds/'+t, null, function (data) {
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) { //下载完成
try { try {
core.musicStatus.audioContext.decodeAudioData(this.response, function (buffer) { core.musicStatus.audioContext.decodeAudioData(data, function (buffer) {
core.material.sounds[t] = buffer; core.material.sounds[t] = buffer;
}, function (e) { }, function (e) {
console.log(e); console.log(e);
@ -220,17 +218,10 @@ loader.prototype.loadMusic = function () {
console.log(ee); console.log(ee);
core.material.sounds[t] = null; core.material.sounds[t] = null;
} }
}; }, function () {
xhr.ontimeout = function(e) {
console.log(e); console.log(e);
core.material.sounds[t] = null; core.material.sounds[t] = null;
} }, null, 'arraybuffer');
xhr.onerror = function(e) {
console.log(e);
core.material.sounds[t] = null;
}
xhr.send();
} }
else { else {
var music = new Audio(); var music = new Audio();

View File

@ -590,11 +590,13 @@ utils.prototype.hide = function (obj, speed, callback) {
}, speed); }, 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(); var xhr = new XMLHttpRequest();
xhr.open(type, url, true); xhr.open(type, url, true);
if (core.isset(mimeType)) if (core.isset(mimeType))
xhr.overrideMimeType(mimeType); xhr.overrideMimeType(mimeType);
if (core.isset(responseType))
xhr.responseType = responseType;
xhr.onload = function(e) { xhr.onload = function(e) {
if (xhr.status==200) { if (xhr.status==200) {
if (core.isset(success)) { if (core.isset(success)) {