Optimize system switches, remove checkConsole

This commit is contained in:
ckcz123 2020-05-10 15:16:43 +08:00
parent 7cefb0e7b1
commit 4b503e1663
14 changed files with 50 additions and 94 deletions

View File

@ -2146,11 +2146,6 @@ core.showWithAnimate(obj, speed, callback) / core.hideWithAnimate(obj, speed, ca
动画淡入或淡出一个对象。
core.consoleOpened()
检测当前的控制台是否处于开启状态。仅在全塔属性中的检查控制台开关开启时有效。
此函数有可能会存在误伤行为,即没开过控制台仍认为开启过。
core.hashCode(obj)
计算一个对象的哈希值。

View File

@ -2151,11 +2151,6 @@ core.showWithAnimate(obj, speed, callback) / core.hideWithAnimate(obj, speed, ca
动画淡入或淡出一个对象。
core.consoleOpened()
检测当前的控制台是否处于开启状态。仅在全塔属性中的检查控制台开关开启时有效。
此函数有可能会存在误伤行为,即没开过控制台仍认为开启过。
core.hashCode(obj)
计算一个对象的哈希值。

View File

@ -709,7 +709,7 @@ if (core.flags.enableSkill) {
- **`flag:textAttribute`**, **`flag:globalAttribute`**, **`flag:globalFlags`**: 当前的剧情文本属性,当前的全局属性,当前的全局开关。
- **`flag:cannotMoveDirectly`**, **`flag:__noClickMove__`**: 当前是否不允许瞬间移动,当前用户是否开启了单击瞬移。
- **`flag:hideStatusBar`**, **`flag:showToolbox`**: 是否隐藏状态栏,是否显示工具栏。
- **`flag:debug`**, **`flag:__consoleOpened__`**: 当前是否开启了调试模式,是否开启了控制台
- **`flag:debug`**: 当前是否开启了调试模式。
- **`flag:__seed__`**, **`flag:__rand__`**: 伪随机数生成种子和当前的状态
==========================================================================================

View File

@ -2740,13 +2740,13 @@ Global_Attribute_List
/*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor', 'equipName']*/;
Global_Value_List
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'|'楼层切换时间'
/*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'moveSpeed', 'animateSpeed', 'floorChangeTime']*/;
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'动画时间'
/*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'animateSpeed']*/;
Global_Flag_List
: '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示魔力值'|'显示魔防值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'楼传平面塔模式'|'破墙镐四方向'|'炸弹四方向'|'冰冻徽章四方向'|'铁门不需要钥匙'|'开启加点'|'开启负伤'|'夹击不超伤害值'|'循环计算临界'|'允许轻按'|'寻路算法不绕血瓶'|'允许走到将死领域'|'允许瞬间移动'|'允许查看禁用商店'|'阻激夹域后禁用快捷商店'|'虚化前景层'|'检查控制台'
/*Global_Flag_List ['enableFloor','enableName','enableLv', 'enableHPMax', 'enableMana', 'enableMDef', 'enableMoney', 'enableExperience', 'enableLevelUp', 'levelUpLeftMode', 'enableKeys', 'enablePZF', 'enableDebuff', 'enableSkill', 'flyNearStair', 'flyRecordPosition', 'pickaxeFourDirections', 'bombFourDirections', 'snowFourDirections', 'steelDoorWithoutKey', 'enableAddPoint', 'enableNegativeDamage', 'betweenAttackMax', 'useLoop', 'enableGentleClick', 'potionWhileRouting', 'canGoDeadZone', 'enableMoveDirectly', 'enableDisabledShop', 'disableShopOnDamage', 'blurFg', 'checkConsole']*/;
: '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示魔力值'|'显示魔防值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'楼传平面塔模式'|'破墙镐四方向'|'炸弹四方向'|'冰冻徽章四方向'|'铁门不需要钥匙'|'开启加点'|'开启负伤'|'夹击不超伤害值'|'循环计算临界'|'允许轻按'|'允许走到将死领域'|'允许瞬间移动'|'允许查看禁用商店'|'阻激夹域后禁用快捷商店'|'虚化前景层'|'检查控制台'
/*Global_Flag_List ['enableFloor','enableName','enableLv', 'enableHPMax', 'enableMana', 'enableMDef', 'enableMoney', 'enableExperience', 'enableLevelUp', 'levelUpLeftMode', 'enableKeys', 'enablePZF', 'enableDebuff', 'enableSkill', 'flyNearStair', 'flyRecordPosition', 'pickaxeFourDirections', 'bombFourDirections', 'snowFourDirections', 'steelDoorWithoutKey', 'enableAddPoint', 'enableNegativeDamage', 'betweenAttackMax', 'useLoop', 'enableGentleClick', 'canGoDeadZone', 'enableMoveDirectly', 'enableDisabledShop', 'disableShopOnDamage', 'blurFg']*/;
Colour
: 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则

View File

@ -407,20 +407,10 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_data": "仇恨属性中,每杀死一个怪物获得的仇恨值"
},
"moveSpeed": {
"_leaf": true,
"_type": "textarea",
"_data": "行走速度即勇士每走一格的时间一般100比较合适"
},
"animateSpeed": {
"_leaf": true,
"_type": "textarea",
"_data": "全局动画时间即怪物振动频率一般300比较合适"
},
"floorChangeTime": {
"_leaf": true,
"_type": "textarea",
"_data": "默认楼层切换时间"
}
}
},
@ -613,11 +603,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "checkbox",
"_data": "是否允许轻触(获得面前物品)"
},
"potionWhileRouting": {
"_leaf": true,
"_type": "checkbox",
"_data": "寻路算法是否经过血瓶和绿钥匙如果该项为false则寻路算法会自动尽量绕过血瓶和绿钥匙"
},
"ignoreChangeFloor": {
"_leaf": true,
"_type": "checkbox",
@ -647,11 +632,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "checkbox",
"_data": "是否虚化前景层;如果此项开启,则在游戏中事件层有东西(如宝石等)时虚化前景层。"
},
"checkConsole": {
"_leaf": true,
"_type": "checkbox",
"_data": "是否检查控制台的开启情况。"
}
}
}

View File

@ -841,12 +841,6 @@ actions.prototype._selectChoices = function (length, keycode, callback) {
if (keycode == 13 || keycode == 32 || keycode == 67) {
callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
}
//左右方向键调整 音量 行走速度
if(core.status.event.id == "switchs" && (core.status.event.selection == 2 || core.status.event.selection == 3))
{
if (keycode == 37) callback.apply(this, [this.HSIZE - 2, topIndex + core.status.event.selection]);
if (keycode == 39) callback.apply(this, [this.HSIZE + 2, topIndex + core.status.event.selection]);
}
if (keycode >= 49 && keycode <= 57) {
var index = keycode - 49;
@ -1956,7 +1950,7 @@ actions.prototype._clickSwitchs = function (x, y) {
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
var selection = y - topIndex;
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) {
if (selection != 2 && selection != 3) return;
if (selection != 2 && selection != 3 && selection != 4) return;
}
var width = choices[selection].width;
var leftPos = (core.__PIXELS__ - width) / 2, rightPos = (core.__PIXELS__ + width) / 2;
@ -1977,16 +1971,20 @@ actions.prototype._clickSwitchs = function (x, y) {
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_moveSpeed(10);
return;
case 4:
return this._clickSwitchs_displayEnemyDamage();
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_floorChangeTime(-100);
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_floorChangeTime(100);
return;
case 5:
return this._clickSwitchs_displayCritical();
return this._clickSwitchs_displayEnemyDamage();
case 6:
return this._clickSwitchs_displayExtraDamage();
return this._clickSwitchs_displayCritical();
case 7:
return this._clickSwitchs_localForage();
return this._clickSwitchs_displayExtraDamage();
case 8:
return this._clickSwitchs_clickMove();
return this._clickSwitchs_potionNoRouting();
case 9:
return this._clickSwitchs_clickMove();
case 10:
core.status.event.selection = 0;
core.ui.drawSettings();
break;
@ -2022,6 +2020,12 @@ actions.prototype._clickSwitchs_moveSpeed = function (delta) {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_floorChangeTime = function (delta) {
core.values.floorChangeTime = core.clamp(core.values.floorChangeTime + delta, 0, 2000);
core.setLocalStorage("floorChangeTime", core.values.floorChangeTime);
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage;
core.updateDamage();
@ -2043,12 +2047,9 @@ actions.prototype._clickSwitchs_displayExtraDamage = function () {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_localForage = function () {
core.platform.useLocalForage = !core.platform.useLocalForage;
core.setLocalStorage('useLocalForage', core.platform.useLocalForage);
core.control.getSaveIndexes(function (indexes) {
core.saves.ids = indexes;
});
actions.prototype._clickSwitchs_potionNoRouting = function () {
if (core.hasFlag('__potionNoRouting__')) core.removeFlag('__potionNoRouting__');
else core.setFlag('__potionNoRouting__', true);
core.ui.drawSwitchs();
}
@ -2065,6 +2066,19 @@ actions.prototype._keyUpSwitchs = function (keycode) {
core.ui.drawSettings();
return;
}
if (keycode == 37) {
switch (core.status.event.selection) {
case 2: return this._clickSwitchs_userVolume(-1);
case 3: return this._clickSwitchs_moveSpeed(-10);
case 4: this._clickSwitchs_floorChangeTime(-100);
}
} else if (keycode == 39) {
switch (core.status.event.selection) {
case 2: return this._clickSwitchs_userVolume(1);
case 3: return this._clickSwitchs_moveSpeed(10);
case 4: this._clickSwitchs_floorChangeTime(100);
}
}
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs);
}

View File

@ -26,7 +26,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("checkConsoleOpened", true, this._animationFrame_checkConsoleOpened);
// --- 注册系统的replay
this.registerReplayAction("move", this._replayAction_move);
this.registerReplayAction("item", this._replayAction_item);
@ -183,7 +182,7 @@ control.prototype._animationFrame_animate = function (timestamp) {
control.prototype._animationFrame_heroMoving = function (timestamp) {
if (core.status.heroMoving <= 0) return;
// 换腿
if (timestamp - core.animateFrame.moveTime > (core.values.moveSpeed||100)) {
if (timestamp - core.animateFrame.moveTime > core.values.moveSpeed) {
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
core.animateFrame.moveTime = timestamp;
}
@ -316,10 +315,6 @@ control.prototype._animationFrame_parallelDo = function (timestamp) {
core.control.controldata.parallelDo(timestamp);
}
control.prototype._animationFrame_checkConsoleOpened = function (timestamp) {
if (core.consoleOpened()) core.setFlag('__consoleOpened__', true);
}
// ------ 标题界面的处理 ------ //
////// 显示游戏开始界面 //////
@ -493,7 +488,7 @@ control.prototype._setAutomaticRoute_isMoving = function (destX, destY) {
core.control.tryMoveDirectly(destX, destY);
}
core.status.automaticRoute.moveDirectly = false;
}, core.values.moveSpeed || 100);
}, core.values.moveSpeed);
}
return true;
}
@ -609,7 +604,7 @@ control.prototype.setHeroMoveInterval = function (callback) {
core.moveOneStep(core.nextX(), core.nextY());
if (callback) callback();
}
}, (core.values.moveSpeed||100) / 8 * toAdd / core.status.replay.speed);
}, core.values.moveSpeed / 8 * toAdd / core.status.replay.speed);
}
////// 每移动一格后执行的事件 //////
@ -904,7 +899,7 @@ control.prototype.setViewport = function (x, y) {
////// 移动视野范围 //////
control.prototype.moveViewport = function (steps, time, callback) {
time = time || core.values.moveSpeed || 300;
time = time || core.values.moveSpeed;
var step = 0, moveSteps = (steps||[]).filter(function (t) {
return ['up','down','left','right'].indexOf(t)>=0;
});
@ -1715,10 +1710,6 @@ control.prototype._doSL_load_afterGet = function (id, data) {
var _replay = function () {
core.startGame(data.hard, data.hero.flags.__seed__, core.decodeRoute(data.route));
};
if (core.flags.checkConsole && data.hashCode != null && data.hashCode != core.hashCode(data.hero)) {
core.myconfirm("存档校验失败,请勿修改存档文件!\n你想回放此存档的录像吗\n可以随时停止录像播放以继续游戏。", _replay);
return;
}
if (data.version != core.firstData.version) {
core.myconfirm("存档版本不匹配!\n你想回放此存档的录像吗\n可以随时停止录像播放以继续游戏。", _replay);
return;

View File

@ -289,7 +289,8 @@ core.prototype._init_sys_flags = function () {
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
// 行走速度
core.values.moveSpeed = core.getLocalStorage('moveSpeed', core.values.moveSpeed);
core.values.moveSpeed = core.getLocalStorage('moveSpeed', 100);
core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', 500);
}
core.prototype._init_platform = function () {

View File

@ -133,7 +133,6 @@ events.prototype.gameOver = function (ending, fromReplay, norank) {
var reason = null;
if (fromReplay) reason = "录像回放完毕!";
else if (core.hasFlag("debug")) reason = "\t[系统提示]调试模式下无法上传成绩";
else if (core.hasFlag("__consoleOpened__")) reason = "\t[系统提示]本存档开启过控制台,无法上传成绩";
if (reason != null)
core.drawText(reason, core.restart);
@ -602,8 +601,6 @@ events.prototype._changeFloor_getInfo = function (floorId, stair, heroLoc, time)
if (main.mode != 'play' || core.isReplaying()) time = 0;
if (time == null) time = core.values.floorChangeTime;
if (time == null) time = 800;
if (time < 100) time = 0;
time /= 20;
return {
@ -2770,7 +2767,7 @@ events.prototype._vibrate_update = function (shakeInfo) {
/////// 使用事件让勇士移动。这个函数将不会触发任何事件 //////
events.prototype.eventMoveHero = function(steps, time, callback) {
time = time || core.values.moveSpeed || 100;
time = time || core.values.moveSpeed;
var step = 0, moveSteps = (steps||[]).filter(function (t) {
return ['up','down','left','right','forward','backward'].indexOf(t)>=0;
});

View File

@ -688,7 +688,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y) {
// 绕过路障
if (id.endsWith("Net")) deepAdd += 100;
// 绕过血瓶和绿宝石
if (!core.flags.potionWhileRouting && (id.endsWith("Potion") || id == 'greenJewel')) deepAdd += 100;
if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenJewel')) deepAdd += 100;
// 绕过传送点
// if (block.block.event.trigger == 'changeFloor') deepAdd+=10;
}

View File

@ -1524,10 +1524,11 @@ ui.prototype.drawSwitchs = function() {
" < 音量:" + Math.round(Math.sqrt(100 * core.musicStatus.userVolume)) + " > ",
//数值越大耗时越长
" < 步时:" + core.values.moveSpeed + " > ",
" < 转场:" + core.values.floorChangeTime + " > ",
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"),
"血瓶绕路: "+(core.hasFlag('__potionNoRouting__') ? "[ON]":"[OFF]"),
"单击瞬移: "+(!core.hasFlag("__noClickMove__") ? "[ON]":"[OFF]"),
"返回主菜单"
];
@ -2545,7 +2546,7 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi
var v2 = "/"+core.formatBigNumber(data.hero.mdef,true);
if (core.calWidth('ui', v + v2, this._buildFont(10, false)) <= size) v += v2;
core.fillText('ui', v, x, y+30+size, '#FFD700');
core.fillText('ui', core.formatDate(new Date(data.time)), x, y+43+size, data.hero.flags.__consoleOpened__||data.hero.flags.debug?'#FF6A6A':'#FFFFFF');
core.fillText('ui', core.formatDate(new Date(data.time)), x, y+43+size, data.hero.flags.debug?'#FF6A6A':'#FFFFFF');
}
else {
core.fillRect('ui', x-size/2, y+15, size, size, '#333333', 2);

View File

@ -1070,17 +1070,6 @@ utils.prototype._decodeCanvas = function (arr, width, height) {
tempCanvas.putImageData(imgData, 0, 0);
}
utils.prototype.consoleOpened = function () {
if (!core.flags.checkConsole) return false;
if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
return true;
if (!core.platform.isPC) return false;
var threshold = 160;
var zoom = Math.min(window.outerWidth / window.innerWidth, window.outerHeight / window.innerHeight);
return window.outerWidth - zoom * window.innerWidth > threshold
|| window.outerHeight - zoom * window.innerHeight > threshold;
}
utils.prototype.hashCode = function (obj) {
if (typeof obj == 'string') {
var hash = 0, i, chr;

View File

@ -408,9 +408,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"counterAttack": 0.1,
"purify": 3,
"hatred": 2,
"moveSpeed": 100,
"animateSpeed": 400,
"floorChangeTime": 800
"animateSpeed": 400
},
"flags": {
"enableFloor": true,
@ -450,13 +448,11 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"displayCritical": true,
"displayExtraDamage": true,
"enableGentleClick": true,
"potionWhileRouting": false,
"ignoreChangeFloor": true,
"canGoDeadZone": false,
"enableMoveDirectly": true,
"enableDisabledShop": true,
"disableShopOnDamage": false,
"blurFg": false,
"checkConsole": false
"blurFg": false
}
}

View File

@ -947,9 +947,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
'version': core.firstData.version,
"time": new Date().getTime()
};
if (core.flags.checkConsole) {
data.hashCode = core.utils.hashCode(data.hero);
}
// 设置商店次数
for (var shopId in core.status.shops) {
data.shops[shopId] = {