syntax error in editor & B in replay

This commit is contained in:
oc 2019-06-28 16:36:20 +08:00
parent 6f75c878a0
commit 4a960790c3
4 changed files with 30 additions and 6 deletions

View File

@ -81,6 +81,12 @@ editor_multi = function () {
_format();
}
editor_multi.hasError = function () {
if (!editor_multi.lintAutocomplete) return false;
return JSHINT.errors.filter(function (e) {
return e.code.startsWith("E")
}).length > 0;
}
editor_multi.import = function (id_, args) {
var thisTr = document.getElementById(id_);
@ -126,6 +132,11 @@ editor_multi = function () {
}
editor_multi.confirm = function () {
if (editor_multi.hasError()) {
alert("当前好像存在严重的语法错误,请处理后再保存。\n严重的语法错误可能会导致整个编辑器的崩溃。");
return;
}
if (!editor_multi.id) {
editor_multi.id = '';
return;

View File

@ -112,9 +112,8 @@ actions.prototype.doRegisteredAction = function (action) {
}
actions.prototype._checkReplaying = function () {
if (core.isReplaying() && core.status.event.id != 'save'
&& (core.status.event.id || "").indexOf('book') != 0 && core.status.event.id != 'viewMaps'
&& core.status.event.id != 'toolbox' && core.status.event.id != 'equipbox')
if (core.isReplaying() &&
['save','book','book-detail','viewMaps','toolbox','equipbox','text'].indexOf(core.status.event.id)<0)
return true;
return false;
}
@ -175,6 +174,8 @@ actions.prototype._sys_onkeyUp_replay = function (e) {
core.toolboxReplay();
else if (e.keyCode == 81) // Q
core.equipboxReplay();
else if (e.keyCode == 66) // B
core.drawStatistics();
else if (e.keyCode >= 49 && e.keyCode <= 51) // 1-3
core.setReplaySpeed(e.keyCode - 48);
else if (e.keyCode == 52) // 4

View File

@ -1202,6 +1202,7 @@ control.prototype.bookReplay = function () {
if (core.isMoving() || core.status.replay.animate
|| (core.status.event.id && core.status.event.id != 'viewMaps'))
return core.drawTip("请等待当前事件的处理结束");
if (!core.hasItem('book')) return core.drawTip('你没有怪物手册');
// 从“浏览地图”页面打开
if (core.status.event.id=='viewMaps')

View File

@ -539,7 +539,8 @@ ui.prototype.drawText = function (contents, callback) {
ui.prototype._drawText_setContent = function (contents, callback) {
// 合并进 insertAction
if ((core.status.event && core.status.event.id=='action') || core.isReplaying()) {
if ((core.status.event && core.status.event.id=='action')
|| (!core.hasFlag('__replayText__') && core.isReplaying())) {
core.insertAction(contents,null,null,callback);
return;
}
@ -1866,11 +1867,19 @@ ui.prototype._drawBookDetail_turnAndCriticals = function (enemy, floorId, texts)
var damageInfo = core.getDamageInfo(enemy, null, null, null, floorId);
texts.push("战斗回合数:"+((damageInfo||{}).turn||0));
// 临界表
var criticals = core.enemys.nextCriticals(enemy, 10, null, null, floorId).map(function (v) {
var criticals = core.enemys.nextCriticals(enemy, 8, null, null, floorId).map(function (v) {
return core.formatBigNumber(v[0])+":"+core.formatBigNumber(v[1]);
});
while (criticals[0]=='0:0') criticals.shift();
texts.push("临界表:"+JSON.stringify(criticals))
texts.push("临界表:"+JSON.stringify(criticals));
var prevInfo = core.getDamageInfo(enemy, {atk: core.status.hero.atk-1}, null, null, floorId);
if (prevInfo != null && damageInfo != null) {
if (damageInfo.damage != null) damageInfo = damageInfo.damage;
if (prevInfo.damage != null) prevInfo = prevInfo.damage;
if (prevInfo > damageInfo) {
texts.push("(当前攻击力正位于临界点上)")
}
}
}
ui.prototype._drawBookDetail_drawContent = function (enemy, contents, pos) {
@ -2564,6 +2573,7 @@ ui.prototype.drawStatistics = function (floorIds) {
core.ui._drawStatistics_floorId(floorId, obj);
});
var statistics = core.status.hero.statistics;
core.setFlag("__replayText__", true);
core.drawText([
this._drawStatistics_generateText(obj, "全塔", obj.total),
this._drawStatistics_generateText(obj, "当前", obj.current),
@ -2581,6 +2591,7 @@ ui.prototype.drawStatistics = function (floorIds) {
"4. 在自定义道具例如其他宝石需在脚本编辑的drawStatistics中注册不然不会进行统计。\n"+
"5. 所有统计信息仅供参考,如有错误,概不负责。"
])
core.removeFlag("__replayText__");
}
ui.prototype._drawStatistics_buildObj = function () {