main.log &&
This commit is contained in:
parent
2906d2cb7e
commit
3de7cae269
@ -56,7 +56,7 @@
|
||||
callback(null, data);
|
||||
}
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
callback(e+":请检查启动服务是否处于正常运行状态。");
|
||||
}, "text/plain; charset=x-user-defined");
|
||||
}
|
||||
|
||||
@ -1851,7 +1851,7 @@ core.insertAction([
|
||||
try {
|
||||
eval(core.floors[core.status.floorId].parallelDo);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ control.prototype.setRequestAnimationFrame = function () {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2206,7 +2206,7 @@ control.prototype.doSL = function (id, type) {
|
||||
if (id == 'autoSave') core.saves.autosave.data = core.clone(data);
|
||||
afterGet(data);
|
||||
}, function(err) {
|
||||
console.log(err);
|
||||
main.log(err);
|
||||
alert("无效的存档");
|
||||
})
|
||||
}
|
||||
@ -2248,7 +2248,7 @@ control.prototype.doSL = function (id, type) {
|
||||
if (id == 'autoSave') core.saves.autosave.data = core.clone(data);
|
||||
afterGet(data);
|
||||
}, function(err) {
|
||||
console.log(err);
|
||||
main.log(err);
|
||||
alert("无效的存档");
|
||||
})
|
||||
}
|
||||
@ -2425,7 +2425,7 @@ control.prototype.getSaves = function (index, callback) {
|
||||
core.getLocalForage("save"+index, null, function(data) {
|
||||
if (core.isset(callback)) callback(data);
|
||||
}, function(err) {
|
||||
console.log(err);
|
||||
main.log(err);
|
||||
if (core.isset(callback))
|
||||
callback(null);
|
||||
})
|
||||
@ -2445,7 +2445,7 @@ control.prototype.getSaves = function (index, callback) {
|
||||
saves.push(data);
|
||||
load(index+1, callback);
|
||||
}, function(err) {
|
||||
console.log(err);
|
||||
main.log(err);
|
||||
load(index+1, callback);
|
||||
})
|
||||
}
|
||||
@ -2556,7 +2556,7 @@ control.prototype.playBgm = function (bgm) {
|
||||
core.material.bgms[bgm].pause();
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -2589,7 +2589,7 @@ control.prototype.playBgm = function (bgm) {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法播放BGM "+bgm);
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.musicStatus.playingBgm = null;
|
||||
}
|
||||
}
|
||||
@ -2604,7 +2604,7 @@ control.prototype.pauseBgm = function () {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法暂停BGM");
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
this.setMusicBtn();
|
||||
|
||||
@ -2620,7 +2620,7 @@ control.prototype.resumeBgm = function () {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法恢复BGM");
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
this.setMusicBtn();
|
||||
}
|
||||
@ -2666,7 +2666,7 @@ control.prototype.playSound = function (sound) {
|
||||
source.noteOn(0);
|
||||
}
|
||||
catch (ee) {
|
||||
console.log(ee);
|
||||
main.log(ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2677,7 +2677,7 @@ control.prototype.playSound = function (sound) {
|
||||
}
|
||||
catch (eee) {
|
||||
console.log("无法播放SE "+sound);
|
||||
console.log(eee);
|
||||
main.log(eee);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
libs/core.js
10
libs/core.js
@ -293,13 +293,13 @@ core.prototype.init = function (coreData, callback) {
|
||||
core.removeLocalForage("__test__");
|
||||
}
|
||||
}
|
||||
catch (e) {console.log(e); core.platform.useLocalForage=false;}
|
||||
}, function(e) {console.log(e); core.platform.useLocalForage=false;})
|
||||
catch (e) {main.log(e); core.platform.useLocalForage=false;}
|
||||
}, function(e) {main.log(e); core.platform.useLocalForage=false;})
|
||||
}
|
||||
catch (e) {console.log(e); core.platform.useLocalForage=false;}
|
||||
}, function(e) {console.log(e); core.platform.useLocalForage=false;})
|
||||
catch (e) {main.log(e); core.platform.useLocalForage=false;}
|
||||
}, function(e) {main.log(e); core.platform.useLocalForage=false;})
|
||||
}
|
||||
catch (e) {console.log(e); core.platform.useLocalForage=false;}
|
||||
catch (e) {main.log(e); core.platform.useLocalForage=false;}
|
||||
}
|
||||
|
||||
core.platform.extendKeyboard = core.getLocalStorage("extendKeyboard", false);
|
||||
|
||||
@ -978,7 +978,7 @@ events.prototype.doAction = function() {
|
||||
core.setFlag((prefix||"global")+"@"+data.name.substring(7), value);
|
||||
}
|
||||
}
|
||||
catch (e) {console.log(e)}
|
||||
catch (e) {main.log(e)}
|
||||
core.updateStatusBar();
|
||||
this.doAction();
|
||||
break;
|
||||
@ -1052,7 +1052,7 @@ events.prototype.doAction = function() {
|
||||
value = core.decodeBase64(action.substring(7));
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.stopReplay();
|
||||
core.drawTip("录像文件出错");
|
||||
return;
|
||||
@ -1147,7 +1147,7 @@ events.prototype.doAction = function() {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
if (!data.async)
|
||||
this.doAction();
|
||||
|
||||
@ -35,7 +35,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
eval(this.itemEffect[itemId]);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
|
||||
@ -55,7 +55,7 @@ items.prototype.getItemEffectTip = function(itemId) {
|
||||
try {
|
||||
return eval(this.itemEffectTip[itemId])||"";
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ items.prototype.useItem = function (itemId, callback) {
|
||||
eval(this.useItemEffect[itemId]);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
// 记录路线
|
||||
@ -107,7 +107,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
able = eval(this.canUseItemEffect[itemId]);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
if (!able) core.status.event.data = null;
|
||||
@ -218,7 +218,7 @@ items.prototype.loadEquip = function (equipId, callback) {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ loader.prototype.loadImage = function (imgName, callback) {
|
||||
image.src = 'project/images/' + name + "?v=" + main.version;
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ loader.prototype.loadAnimates = function () {
|
||||
image.src = t2;
|
||||
data.images.push(image);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
data.images.push(null);
|
||||
}
|
||||
}
|
||||
@ -171,11 +171,11 @@ loader.prototype.loadAnimates = function () {
|
||||
core.material.animates[t] = data;
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.material.animates[t] = null;
|
||||
}
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.material.animates[t] = null;
|
||||
}, "text/plain; charset=x-user-defined")
|
||||
})
|
||||
@ -206,11 +206,11 @@ loader.prototype.loadMusic = function () {
|
||||
core.playBgm(t);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.material.bgms[t] = null;
|
||||
}
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.material.bgms[t] = null;
|
||||
}, "text/plain; charset=x-user-defined")
|
||||
|
||||
@ -234,16 +234,16 @@ loader.prototype.loadMusic = function () {
|
||||
core.musicStatus.audioContext.decodeAudioData(data, function (buffer) {
|
||||
core.material.sounds[t] = buffer;
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.material.sounds[t] = null;
|
||||
})
|
||||
}
|
||||
catch (ee) {
|
||||
console.log(ee);
|
||||
main.log(ee);
|
||||
core.material.sounds[t] = null;
|
||||
}
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
core.material.sounds[t] = null;
|
||||
}, null, 'arraybuffer');
|
||||
}
|
||||
|
||||
@ -2367,14 +2367,14 @@ ui.prototype.drawSLPanel = function(index, refresh) {
|
||||
core.saves.autosave.data = data;
|
||||
core.status.event.ui[i]=data;
|
||||
loadSave(i+1, callback);
|
||||
}, function(err) {console.log(err);});
|
||||
}, function(err) {main.log(err);});
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.getLocalForage("save"+(5*page+i), null, function(data) {
|
||||
core.status.event.ui[i]=data;
|
||||
loadSave(i+1, callback);
|
||||
}, function(err) {console.log(err);});
|
||||
}, function(err) {main.log(err);});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,14 @@ utils.prototype.init = function () {
|
||||
return to;
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.endsWith != "function") {
|
||||
String.prototype.endsWith = function(search, this_len) {
|
||||
if (this_len === undefined || this_len > this.length) {
|
||||
this_len = this.length;
|
||||
}
|
||||
return this.substring(this_len - search.length, this_len) === search;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -136,7 +144,7 @@ utils.prototype.setLocalStorage = function(key, value) {
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -160,7 +168,7 @@ utils.prototype.getLocalStorage = function(key, defaultValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -226,7 +234,7 @@ utils.prototype.getLocalForage = function (key, defaultValue, successCallback, e
|
||||
successCallback(JSON.parse(output));
|
||||
return;
|
||||
}
|
||||
catch (ee) {console.log(ee);}
|
||||
catch (ee) {main.log(ee);}
|
||||
}
|
||||
if (core.isset(successCallback))
|
||||
successCallback(JSON.parse(value));
|
||||
@ -669,7 +677,7 @@ utils.prototype.readFileContent = function (content) {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
alert(e);
|
||||
}
|
||||
alert("不是有效的JSON文件!");
|
||||
|
||||
33
main.js
33
main.js
@ -309,6 +309,17 @@ main.prototype.setMainTipsText = function (text) {
|
||||
main.dom.mainTips.innerHTML = text;
|
||||
}
|
||||
|
||||
main.prototype.log = function (e) {
|
||||
if (e) {
|
||||
if (main.core && main.core.platform && !main.core.platform.isPC) {
|
||||
console.log((e.stack || e.toString()).replace("\n", " --- "));
|
||||
}
|
||||
else {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
main.prototype.listen = function () {
|
||||
|
||||
@ -316,7 +327,7 @@ main.prototype.listen = function () {
|
||||
window.onresize = function () {
|
||||
try {
|
||||
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
}catch (e) { console.log(e); }
|
||||
}catch (e) { main.log(e); }
|
||||
}
|
||||
|
||||
////// 在界面上按下某按键时 //////
|
||||
@ -324,7 +335,7 @@ main.dom.body.onkeydown = function(e) {
|
||||
try {
|
||||
if (main.core && (main.core.isPlaying() || main.core.status.lockControl))
|
||||
main.core.onkeyDown(e);
|
||||
} catch (ee) { console.log(ee); }
|
||||
} catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 在界面上放开某按键时 //////
|
||||
@ -332,7 +343,7 @@ main.dom.body.onkeyup = function(e) {
|
||||
try {
|
||||
if (main.core && (main.core.isPlaying() || main.core.status.lockControl))
|
||||
main.core.onkeyUp(e);
|
||||
} catch (ee) { console.log(ee); }
|
||||
} catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 开始选择时 //////
|
||||
@ -347,7 +358,7 @@ main.dom.data.onmousedown = function (e) {
|
||||
var loc = main.core.getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
main.core.ondown(loc);
|
||||
} catch (ee) { console.log(ee); }
|
||||
} catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 鼠标移动时 //////
|
||||
@ -357,14 +368,14 @@ main.dom.data.onmousemove = function (e) {
|
||||
var loc = main.core.getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
main.core.onmove(loc);
|
||||
}catch (ee) { console.log(ee); }
|
||||
}catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 鼠标放开时 //////
|
||||
main.dom.data.onmouseup = function () {
|
||||
try {
|
||||
main.core.onup();
|
||||
}catch (e) { console.log(e); }
|
||||
}catch (e) { main.log(e); }
|
||||
}
|
||||
|
||||
////// 鼠标滑轮滚动时 //////
|
||||
@ -374,7 +385,7 @@ main.dom.data.onmousewheel = function(e) {
|
||||
main.core.onmousewheel(Math.sign(e.wheelDelta))
|
||||
else if (e.detail)
|
||||
main.core.onmousewheel(Math.sign(e.detail));
|
||||
} catch (ee) { console.log(ee); }
|
||||
} catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 手指在触摸屏开始触摸时 //////
|
||||
@ -384,7 +395,7 @@ main.dom.data.ontouchstart = function (e) {
|
||||
var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
|
||||
if (loc == null) return;
|
||||
main.core.ondown(loc);
|
||||
}catch (ee) { console.log(ee); }
|
||||
}catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 手指在触摸屏上移动时 //////
|
||||
@ -394,7 +405,7 @@ main.dom.data.ontouchmove = function (e) {
|
||||
var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
|
||||
if (loc == null) return;
|
||||
main.core.onmove(loc);
|
||||
}catch (ee) { console.log(ee); }
|
||||
}catch (ee) { main.log(ee); }
|
||||
}
|
||||
|
||||
////// 手指离开触摸屏时 //////
|
||||
@ -403,7 +414,7 @@ main.dom.data.ontouchend = function (e) {
|
||||
e.preventDefault();
|
||||
main.core.onup();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,7 +634,7 @@ main.dom.musicBtn.onclick = function () {
|
||||
try {
|
||||
if (main.core)
|
||||
main.core.triggerBgm();
|
||||
} catch (e) {console.log(e);}
|
||||
} catch (e) {main.log(e);}
|
||||
}
|
||||
|
||||
window.onblur = function () {
|
||||
|
||||
@ -1211,7 +1211,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
try {
|
||||
eval(core.floors[core.status.floorId].parallelDo);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user