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) {
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];
}

View File

@ -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)
}
////// 设置勇士属性 //////

View File

@ -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();

View File

@ -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)) {