更新状态栏及resize及表格bug
This commit is contained in:
parent
7e43d0672f
commit
5ea909da30
@ -2408,8 +2408,8 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
||||
"!type": "fn(type?: string, level?: number)"
|
||||
},
|
||||
"updateStatusBar": {
|
||||
"!doc": "立刻刷新状态栏和地图显伤<br/>doNotCheckAutoEvents: 是否不检查自动事件",
|
||||
"!type": "fn(doNotCheckAutoEvents?: bool)"
|
||||
"!doc": "刷新状态栏和地图显伤<br/>doNotCheckAutoEvents: 是否不检查自动事件",
|
||||
"!type": "fn(doNotCheckAutoEvents?: bool, immediate?: bool)"
|
||||
},
|
||||
"autosave": {
|
||||
"!doc": "自动存档",
|
||||
|
||||
@ -322,7 +322,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"haloAdd": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "吸血加到自身",
|
||||
"_docs": "光环是否叠加",
|
||||
"_data": "光环是否叠加"
|
||||
},
|
||||
"atkValue": {
|
||||
@ -661,7 +661,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"ratio": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==~~thiseval && thiseval>=0",
|
||||
"_range": "thiseval <= Number.MAX_SAFE_INTEGER && thiseval>=0",
|
||||
"_docs": "宝石血瓶效果",
|
||||
"_data": "每一层的宝石/血瓶效果,即获得宝石和血瓶时框内\"ratio\"的值。"
|
||||
}
|
||||
|
||||
@ -552,6 +552,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"_data": "状态栏显示项"
|
||||
},
|
||||
"autoScale": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "自动缩放最大化",
|
||||
"_data": "是否自动缩放最大化,关闭后不再最大化"
|
||||
},
|
||||
"extendToolbar": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
|
||||
@ -18,7 +18,6 @@ control.prototype._init = function () {
|
||||
this.replayActions = [];
|
||||
this.weathers = {};
|
||||
this.resizes = [];
|
||||
this.needUpdate = false;
|
||||
this.noAutoEvents = true;
|
||||
// --- 注册系统的animationFrame
|
||||
this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime);
|
||||
@ -29,7 +28,6 @@ control.prototype._init = function () {
|
||||
this.registerAnimationFrame("weather", true, this._animationFrame_weather);
|
||||
this.registerAnimationFrame("tip", true, this._animateFrame_tip);
|
||||
this.registerAnimationFrame("parallelDo", false, this._animationFrame_parallelDo);
|
||||
this.registerAnimationFrame("updateStatusBar", true, this.updateStatusBar_update);
|
||||
// --- 注册系统的天气
|
||||
this.registerWeather("rain", this._weather_rain, this._animationFrame_weather_rain);
|
||||
this.registerWeather("snow", this._weather_snow, this._animationFrame_weather_snow);
|
||||
@ -1134,11 +1132,11 @@ control.prototype.checkBlock = function () {
|
||||
core.status.hero.statistics.extraDamage += damage;
|
||||
if (core.status.hero.hp <= 0) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.events.lose();
|
||||
return;
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
}
|
||||
}
|
||||
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
|
||||
@ -1350,7 +1348,7 @@ control.prototype.startReplay = function (list) {
|
||||
core.createCanvas('replay', 0, core.__PIXELS__ - 40, core.__PIXELS__, 40, 199);
|
||||
core.setOpacity('replay', 0.6);
|
||||
this._replay_drawProgress();
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip("开始播放");
|
||||
this.replay();
|
||||
}
|
||||
@ -1365,7 +1363,7 @@ control.prototype.triggerReplay = function () {
|
||||
control.prototype.pauseReplay = function () {
|
||||
if (!core.isPlaying() || !core.isReplaying()) return;
|
||||
core.status.replay.pausing = true;
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip("暂停播放");
|
||||
}
|
||||
|
||||
@ -1377,7 +1375,7 @@ control.prototype.resumeReplay = function () {
|
||||
return core.drawTip("请等待当前事件的处理结束");
|
||||
}
|
||||
core.status.replay.pausing = false;
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip("恢复播放");
|
||||
core.replay();
|
||||
}
|
||||
@ -1442,7 +1440,7 @@ control.prototype.stopReplay = function (force) {
|
||||
core.status.replay.steps = 0;
|
||||
core.status.replay.save = [];
|
||||
core.deleteCanvas('replay');
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip("停止播放并恢复游戏");
|
||||
}
|
||||
|
||||
@ -1477,7 +1475,7 @@ control.prototype.rewindReplay = function () {
|
||||
core.createCanvas('replay', 0, core.__PIXELS__ - 40, core.__PIXELS__, 40, 199);
|
||||
core.setOpacity('replay', 0.6);
|
||||
core.control._replay_drawProgress();
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip("成功回退到上一个节点");
|
||||
});
|
||||
}
|
||||
@ -3045,20 +3043,21 @@ control.prototype.clearStatusBar = function () {
|
||||
}
|
||||
|
||||
////// 更新状态栏 //////
|
||||
control.prototype.updateStatusBar = function (doNotCheckAutoEvents) {
|
||||
this.needUpdate = true;
|
||||
control.prototype.updateStatusBar = function (doNotCheckAutoEvents, immediate) {
|
||||
if (immediate) {
|
||||
return this.updateStatusBar_update();
|
||||
}
|
||||
if (!doNotCheckAutoEvents) this.noAutoEvents = false;
|
||||
if (core.isReplaying()) return this.updateStatusBar_update();
|
||||
if (core.isReplaying()) this.updateStatusBar_update();
|
||||
requestAnimationFrame(this.updateStatusBar_update)
|
||||
}
|
||||
|
||||
control.prototype.updateStatusBar_update = function () {
|
||||
if (!core.control.needUpdate) return;
|
||||
if (!core.isPlaying() || core.hasFlag('__statistics__')) return;
|
||||
core.control.controldata.updateStatusBar();
|
||||
if (!core.control.noAutoEvents) core.checkAutoEvents();
|
||||
core.control._updateStatusBar_setToolboxIcon();
|
||||
core.clearRouteFolding();
|
||||
core.control.needUpdate = false;
|
||||
core.control.noAutoEvents = true;
|
||||
}
|
||||
|
||||
@ -3364,18 +3363,18 @@ control.prototype._resize_gameGroup = function (obj) {
|
||||
|
||||
control.prototype._resize_canvas = function (obj) {
|
||||
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
|
||||
for (var i = 0; i < core.dom.gameCanvas.length; ++i) {
|
||||
var ctx = core.dom.gameCanvas[i].getContext('2d');
|
||||
// core.maps._setHDCanvasSize(ctx);
|
||||
core.resizeCanvas(ctx, core.__PIXELS__, core.__PIXELS__);
|
||||
}
|
||||
requestAnimationFrame(function () {
|
||||
if (core.status && core.status.maps && core.status.floorId && core.status.maps[core.status.floorId]) {
|
||||
core.redrawMap();
|
||||
core.drawHero();
|
||||
core.setWeather(core.animateFrame.weather.type, core.animateFrame.weather.level);
|
||||
if (!core.isPlaying()) {
|
||||
for (var i = 0; i < core.dom.gameCanvas.length; ++i) {
|
||||
var ctx = core.dom.gameCanvas[i].getContext('2d');
|
||||
core.resizeCanvas(ctx, core.__PIXELS__, core.__PIXELS__);
|
||||
core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[i].style.height = innerSize;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
requestAnimationFrame(function () {
|
||||
for (var i = 0; i < core.dom.gameCanvas.length; ++i)
|
||||
core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[i].style.height = innerSize;
|
||||
});
|
||||
}
|
||||
core.dom.gif.style.width = core.dom.gif.style.height = innerSize;
|
||||
core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize;
|
||||
core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = innerSize;
|
||||
@ -3389,13 +3388,24 @@ control.prototype._resize_canvas = function (obj) {
|
||||
core.canvas[cn].canvas.style.height = core.canvas[cn].canvas.height / ratio * core.domStyle.scale + "px";
|
||||
});
|
||||
// resize dynamic canvas
|
||||
for (var name in core.dymCanvas) {
|
||||
var ctx = core.dymCanvas[name], canvas = ctx.canvas;
|
||||
// core.maps._setHDCanvasSize(ctx, parseFloat(canvas.getAttribute('_width')), parseFloat(canvas.getAttribute('_height')));
|
||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
||||
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
||||
var scale = canvas.getAttribute('_scale') || 1;
|
||||
core.resizeCanvas(canvas, canvas.width * scale / core.domStyle.scale, canvas.height * scale / core.domStyle.scale);
|
||||
if (!core.isPlaying()) {
|
||||
for (var name in core.dymCanvas) {
|
||||
var ctx = core.dymCanvas[name], canvas = ctx.canvas;
|
||||
// core.maps._setHDCanvasSize(ctx, parseFloat(canvas.getAttribute('_width')), parseFloat(canvas.getAttribute('_height')));
|
||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
||||
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
||||
var scale = canvas.getAttribute('_scale') || 1;
|
||||
core.resizeCanvas(canvas, canvas.width * scale / core.domStyle.scale, canvas.height * scale / core.domStyle.scale);
|
||||
}
|
||||
} else {
|
||||
for (var name in core.dymCanvas) {
|
||||
var ctx = core.dymCanvas[name], canvas = ctx.canvas;
|
||||
var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
|
||||
canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px";
|
||||
canvas.style.height = canvas.height / ratio * core.domStyle.scale + "px";
|
||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
||||
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
||||
}
|
||||
}
|
||||
// resize next
|
||||
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
||||
|
||||
@ -2369,7 +2369,7 @@ events.prototype._action_function = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_update = function (data, x, y, prefix) {
|
||||
core.updateStatusBar(data.doNotCheckAutoEvents);
|
||||
core.updateStatusBar(data.doNotCheckAutoEvents, true);
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
}
|
||||
else {
|
||||
core.addItem(itemId, itemNum);
|
||||
@ -121,7 +121,7 @@ items.prototype._afterUseItem = function (itemId) {
|
||||
core.status.hero.items[itemCls][itemId]--;
|
||||
if (core.status.hero.items[itemCls][itemId] <= 0)
|
||||
delete core.status.hero.items[itemCls][itemId];
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
}
|
||||
|
||||
////// 当前能否使用道具 //////
|
||||
|
||||
@ -2068,7 +2068,7 @@ maps.prototype.showBlock = function (x, y, floorId) {
|
||||
} else {
|
||||
core.drawBlock(block);
|
||||
core.addGlobalAnimate(block);
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,7 +669,7 @@ ui.prototype.closePanel = function () {
|
||||
}
|
||||
this.clearUI();
|
||||
core.maps.generateGroundPattern();
|
||||
core.updateStatusBar(true);
|
||||
core.updateStatusBar(true, true);
|
||||
core.unlockControl();
|
||||
core.status.event.data = null;
|
||||
core.status.event.id = null;
|
||||
|
||||
3
main.js
3
main.js
@ -238,7 +238,8 @@ main.prototype.init = function (mode, callback) {
|
||||
main.core.init(coreData, callback);
|
||||
main.core.resize();
|
||||
// 自动放缩最大化
|
||||
if (core.getLocalStorage('autoScale') === void 0) core.setLocalStorage('autoScale', true);
|
||||
if (!data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags.autoScale) core.setLocalStorage('autoScale', false)
|
||||
else core.setLocalStorage('autoScale', true);
|
||||
if (core.getLocalStorage('autoScale') && !core.domStyle.isVertical) {
|
||||
try {
|
||||
if (main.core) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
{
|
||||
"main": {
|
||||
"floorIds": [
|
||||
@ -747,6 +747,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"enableMoney",
|
||||
"enableKeys"
|
||||
],
|
||||
"autoScale": true,
|
||||
"extendToolbar": false,
|
||||
"flyNearStair": true,
|
||||
"flyRecordPosition": false,
|
||||
|
||||
@ -290,7 +290,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 判定是否致死
|
||||
if (damage == null || damage >= core.status.hero.hp) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.events.lose('战斗失败');
|
||||
return;
|
||||
}
|
||||
@ -926,6 +926,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.getNextItem();
|
||||
break;
|
||||
case 118: // F7:开启debug模式
|
||||
case 119: // F8:由于F7与部分浏览器有冲突,故新增F8
|
||||
core.debug();
|
||||
break;
|
||||
case 70: // F:开启技能“二倍斩”
|
||||
@ -1000,7 +1001,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
if (px >= 200 && px <= 250 && py >= 50 && py <= 100) {
|
||||
// 记录点击坐标。这里的1代表此时是竖屏!
|
||||
core.status.route.push("click:1:" + px + ":" + py);
|
||||
|
||||
// 可以插入公共事件 / 普通事件 / 执行一段脚本(如打开自绘UI或增减flag)
|
||||
core.insertCommonEvent("道具商店");
|
||||
// core.insertAction(["一段事件"]);
|
||||
@ -1011,7 +1011,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
if (px >= 50 && px <= 100 && py >= 200 && py <= 250) {
|
||||
// 记录点击坐标。这里的0代表此时是横屏!
|
||||
core.status.route.push("click:0:" + px + ":" + py);
|
||||
|
||||
// 可以插入公共事件 / 普通事件 / 执行一段脚本(如打开自绘UI或增减flag)
|
||||
core.insertCommonEvent("道具商店");
|
||||
// core.insertAction(["一段事件"]);
|
||||
@ -1478,17 +1477,17 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.status.hero.hp -= core.values.poisonDamage;
|
||||
if (core.status.hero.hp <= 0) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
core.events.lose();
|
||||
return;
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
// 从v2.7开始,每一步行走不会再刷新状态栏。
|
||||
// 如果有特殊要求(如每走一步都加buff之类),可手动取消注释下面这一句:
|
||||
// core.updateStatusBar(true);
|
||||
// core.updateStatusBar(true, true);
|
||||
|
||||
// 检查自动事件
|
||||
core.checkAutoEvents();
|
||||
@ -1553,7 +1552,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.status.hero.statistics.moveDirectly++;
|
||||
core.status.hero.statistics.ignoreSteps += ignoreSteps;
|
||||
if (core.hasFlag('poison')) {
|
||||
core.updateStatusBar();
|
||||
core.updateStatusBar(false, true);
|
||||
}
|
||||
core.checkRouteFolding();
|
||||
return true;
|
||||
|
||||
6
runtime.d.ts
vendored
6
runtime.d.ts
vendored
@ -331,10 +331,12 @@ declare class control {
|
||||
debug(): void
|
||||
|
||||
/**
|
||||
* 立刻刷新状态栏和地图显伤
|
||||
* 刷新状态栏和地图显伤
|
||||
* 2.9.1优化:非必须立刻执行的刷新(一般是伤害相关的除外)的延迟到下一动画帧执行
|
||||
* @param doNotCheckAutoEvents 是否不检查自动事件
|
||||
* @param immediate 是否立刻刷新,而非延迟到下一动画帧刷新
|
||||
*/
|
||||
updateStatusBar(doNotCheckAutoEvents?: boolean): void
|
||||
updateStatusBar(doNotCheckAutoEvents?: boolean, immediate?: boolean): void
|
||||
|
||||
/** 删除某个flag/变量 */
|
||||
removeFlag(name: string): void
|
||||
|
||||
Loading…
Reference in New Issue
Block a user