cannotIn / cannotOut使用checkbox选项框

This commit is contained in:
ckcz123 2020-05-06 14:03:59 +08:00
parent b49728ecef
commit b55388a499
7 changed files with 67 additions and 85 deletions

View File

@ -1 +1 @@
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":null,"disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}

View File

@ -210,11 +210,7 @@ div.etableInputDiv {
border: none;
}
.etableInputDiv input[type="text"] {
}
.etableInputDiv input[type="checkbox"] {
.etableInputDiv .checkbox {
width: 16px;
height: 16px;
position: absolute;
@ -224,8 +220,10 @@ div.etableInputDiv {
margin-top: -8px;
}
.etableInputDiv select {
.etableInputDiv .cannotInOutCheckbox {
width: 16px;
height: 16px;
display: inline;
}
.etableInputDiv textarea {

View File

@ -21,11 +21,18 @@ editor_table_wrapper = function (editor) {
return /* html */`<input type='text' spellcheck='false' value='${JSON.stringify(value)}'/>\n`
}
editor_table.prototype.checkbox = function (value) {
return /* html */`<input type='checkbox' ${(value ? 'checked ' : '')}/>\n`
return /* html */`<input type='checkbox' class='checkbox' ${(value ? 'checked ' : '')}/>\n`
}
editor_table.prototype.textarea = function (value, indent) {
return /* html */`<textarea spellcheck='false'>${JSON.stringify(value, null, indent || 0)}</textarea>\n`
}
editor_table.prototype.cannotInOutCheckbox = function (value) {
if (!(value instanceof Array)) value = [];
return /* html */`上:<input type='checkbox' class='cannotInOutCheckbox' ${value.indexOf('up')>=0 ? 'checked ' : ''} />
&nbsp;<input type='checkbox' class='cannotInOutCheckbox' ${value.indexOf('down')>=0 ? 'checked ' : ''} /><br/>
<input type='checkbox' class='cannotInOutCheckbox' ${value.indexOf('left')>=0 ? 'checked ' : ''} />
&nbsp;<input type='checkbox' class='cannotInOutCheckbox' ${value.indexOf('right')>=0 ? 'checked ' : ''} /><br/>`;
}
editor_table.prototype.editGrid = function (showComment) {
var html = "";
if (showComment) html += "<button onclick='editor.table.onCommentBtnClick(this)'>显示完整注释</button><br/>";
@ -220,16 +227,15 @@ editor_table_wrapper = function (editor) {
editor_table.prototype.objToTd = function (obj, commentObj, field, cfield, vobj, cobj) {
var thiseval = vobj;
if (cobj._select) {
var values = cobj._select.values;
return editor.table.select(thiseval, values);
} else if (cobj._input) {
return editor.table.text(thiseval);
} else if (cobj._bool) {
return editor.table.checkbox(thiseval);
} else {
var indent = 0;
return editor.table.textarea(thiseval, indent);
switch (cobj._type) {
case 'select':
return editor.table.select(thiseval, cobj._select.values);
case 'checkbox':
return editor.table.checkbox(thiseval);
case 'cannotInOutCheckbox':
return editor.table.cannotInOutCheckbox(thiseval);
default:
return editor.table.textarea(thiseval, cobj.indent || 0);
}
}
@ -263,6 +269,7 @@ editor_table_wrapper = function (editor) {
// >td[title=comment,cobj=cobj:json]
// >td>div>input[value=thiseval]
var thisTr = document.getElementById(guid);
var inputs = thisTr.children[2].children[0].children;
var input = thisTr.children[2].children[0].children[0];
var field = thisTr.children[0].getAttribute('title');
var cobj = JSON.parse(thisTr.children[1].getAttribute('cobj'));
@ -270,8 +277,17 @@ editor_table_wrapper = function (editor) {
while (!editor_mode._ids.hasOwnProperty(modeNode.getAttribute('id'))) {
modeNode = modeNode.parentNode;
}
input.onchange = function () {
editor.table.onchange(guid, obj, commentObj, thisTr, input, field, cobj, modeNode)
for (var i in inputs) {
var input = inputs[i];
if (input.nodeName == 'INPUT' || input.nodeName == 'SELECT' || input.nodeName == 'TEXTAREA') {
input.onchange = function () {
if (cobj._type == 'cannotInOutCheckbox') {
editor.table.onCannotInOutChange(guid, obj, commentObj, thisTr, inputs, field, cobj, modeNode);
} else {
editor.table.onchange(guid, obj, commentObj, thisTr, input, field, cobj, modeNode);
}
}
}
}
// 用检测两次单击的方式来实现双击(以支持手机端的双击)
var doubleClickCheck = [0];
@ -307,6 +323,31 @@ editor_table_wrapper = function (editor) {
}
}
/**
* cannotOut / cannotIn的表格值变化时
*/
editor_table.prototype.onCannotInOutChange = function (guid, obj, commentObj, thisTr, inputs, field, cobj, modeNode) {
editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]);
var value = [];
var directions = ['up', 'down', 'left', 'right'];
var index = 0;
for (var i in inputs) {
if (inputs[i].nodeName == 'INPUT') {
if (inputs[i].checked) value.push(directions[index]);
index++;
}
}
if (value.length == 0) thiseval = null;
else thiseval = value;
if (editor.table.checkRange(cobj, thiseval)) {
editor_mode.addAction(['change', field, thiseval]);
editor_mode.onmode('save');//自动保存 删掉此行的话点保存按钮才会保存
} else {
printe(field + ' : 输入的值不合要求,请鼠标放置在注释上查看说明');
}
}
/**
* "显示完整注释"被按下时
*/

View File

@ -48,7 +48,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"hideInReplay": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否回放时绘制道具栏。\n如果此项为true则在回放录像时使用本道具将不会绘制道具栏页面而是直接使用。\n此项建议在会频繁连续多次使用的道具开启如开启技能或者《镜子》那样的镜像切换等等"
}
}
@ -159,7 +158,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"zoneSquare": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "领域怪是否九宫格伤害"
},
"range": {
@ -171,7 +169,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"notBomb": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该怪物不可被炸"
},
"n": {
@ -183,7 +180,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"add": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "吸血后是否加到自身;光环是否叠加"
},
"atkValue": {
@ -273,20 +269,17 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"cannotOut": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||(thiseval instanceof Array)",
"_type": "cannotInOutCheckbox",
"_data": "该图块的不可出方向\n可以在这里定义在该图块时不能前往哪个方向可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表在该图块时不能往上和左走\n此值对背景层、事件层、前景层上的图块均有效"
},
"cannotIn": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||(thiseval instanceof Array)",
"_type": "cannotInOutCheckbox",
"_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效"
},
"canBreak": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该图块是否可被破墙或地震"
},
"animate": {
@ -347,25 +340,21 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"canFlyTo": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)"
},
"canUseQuickShop": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该层是否允许使用快捷商店"
},
"cannotViewMap": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该层是否不允许被浏览地图看到;如果勾上则浏览地图会跳过该层"
},
"cannotMoveDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该层是否不允许瞬间移动;如果勾上则不可在此层进行瞬移"
},
"firstArrive": {
@ -436,7 +425,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"underGround": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否是地下层如果该项为true则同层传送将传送至上楼梯"
}
}

View File

@ -436,205 +436,171 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"enableFloor": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示当前楼层"
},
"enableName": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示勇士名字"
},
"enableLv": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示当前等级"
},
"enableHPMax": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否是否启用生命上限"
},
"enableMana": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否开启魔力值"
},
"enableMDef": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏及战斗界面显示魔防(护盾)"
},
"enableMoney": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏、怪物手册及战斗界面显示金币"
},
"enableExperience": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏、怪物手册及战斗界面显示经验"
},
"enableLevelUp": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许等级提升进阶如果上面enableExperience为false则此项恒视为false"
},
"levelUpLeftMode": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "进阶使用扣除模式即在状态栏显示距离下个等级所需要的经验值只有enableExperience和enableLevelUp均开启时才有效。"
},
"enableKeys": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示三色钥匙数量"
},
"enablePZF": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示破炸飞数量"
},
"enableDebuff": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示毒衰咒"
},
"enableSkill": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否启用技能栏"
},
"flyNearStair": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "传送器是否需要在楼梯边使用如果flyRecordPosition开启则此项对箭头也有效。"
},
"flyRecordPosition": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "传送器平面塔模式;此模式下楼层传送器将飞到上次离开该楼层的位置。"
},
"pickaxeFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用破墙镐是否四个方向都破坏如果false则只破坏面前的墙壁"
},
"bombFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用炸弹是否四个方向都会炸如果false则只炸面前的怪物即和圣锤等价"
},
"snowFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用冰冻徽章是否四个方向都会消除熔岩如果false则只消除面前的熔岩"
},
"bigKeyIsBox": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "如果此项为true则视为钥匙盒红黄蓝钥匙+1若为false则视为大黄门钥匙"
},
"steelDoorWithoutKey": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "铁门是否不需要钥匙开启。如果此项为true则无需钥匙也可以开铁门。"
},
"itemFirstText": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "首次获得道具是否提示"
},
"equipment": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "剑和盾是否作为装备。如果此项为true则作为装备需要在装备栏使用否则将直接加属性。"
},
"equipboxButton": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
},
"iconInEquipbox": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "在装备栏中的属性变化,是否绘制图标;如果此项开启,则会绘制图标而不是文字"
},
"enableAddPoint": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否支持加点"
},
"enableNegativeDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否支持负伤害(回血)"
},
"hatredDecrease": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在和仇恨怪战斗后减一半的仇恨值此项为false则和仇恨怪不会扣减仇恨值。"
},
"betweenAttackCeil": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "夹击上整还是下整。如果此项为true则夹击伤害值向上取整为false则为向下取整"
},
"betweenAttackMax": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "夹击伤害是否不超过怪物伤害值。"
},
"useLoop": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否循环计算临界如果此项为true则使用循环法而不是回合数计算法来算临界\n从V2.5.3开始,对于大数据的循环法将改为使用二分法进行计算"
},
"startUsingCanvas": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否开始菜单canvas化如果此项为true则将使用canvas来绘制开始菜单"
},
"startDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面"
},
"statusCanvas": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否状态栏canvas化即手动自定义绘制状态栏。\n如果此项开启则可在脚本编辑的drawStatusBar中自定义绘制菜单栏。"
},
"statusCanvasRowsOnMobile": {
@ -646,73 +612,61 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"displayEnemyDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否地图怪物显伤;用户可以手动在菜单栏中开关"
},
"displayCritical": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否地图显示临界;用户可以手动在菜单栏中开关"
},
"displayExtraDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关"
},
"enableGentleClick": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许轻触(获得面前物品)"
},
"potionWhileRouting": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "寻路算法是否经过血瓶如果该项为false则寻路算法会自动尽量绕过血瓶"
},
"ignoreChangeFloor": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "经过楼梯、传送门时是否能“穿透”。\n穿透的意思是自动寻路得到的的路径中间经过了楼梯行走时是否触发楼层转换事件"
},
"canGoDeadZone": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许走到将死的领域上。如果此项为true则可以走到将死的领域上"
},
"enableMoveDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许瞬间移动"
},
"enableDisabledShop": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许查看未开启状态的快捷商店内容;如果此项为真,则对于未开启状态的商店允许查看其内容(但不能购买)"
},
"disableShopOnDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在经过领域/夹击/路障等伤害后禁用快捷商店。"
},
"blurFg": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否虚化前景层;如果此项开启,则在游戏中事件层有东西(如宝石等)时虚化前景层。"
},
"checkConsole": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否检查控制台的开启情况。"
}
}

View File

@ -515,6 +515,7 @@ maps.prototype._canMoveHero_checkCannotInOut = function (number, name, direction
}
return false;
}
if (name == 'cannotIn') direction = core.reverseDirection(direction);
return core.inArray((this.getBlockByNumber(number).event || {})[name], direction);
}

View File

@ -105,10 +105,10 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"151": {"cls":"autotile","id":"autotile1","noPass":true},
"152": {"cls":"autotile","id":"autotile2","noPass":true},
"153": {"cls":"autotile","id":"autotile3","noPass":true},
"161": {"cls":"terrains","id":"arrowUp","noPass":false,"cannotOut":["left","right","down"],"cannotIn":["down"]},
"162": {"cls":"terrains","id":"arrowDown","noPass":false,"cannotOut":["left","right","up"],"cannotIn":["up"]},
"163": {"cls":"terrains","id":"arrowLeft","noPass":false,"cannotOut":["up","down","right"],"cannotIn":["right"]},
"164": {"cls":"terrains","id":"arrowRight","noPass":false,"cannotOut":["up","down","left"],"cannotIn":["left"]},
"161": {"cls":"terrains","id":"arrowUp","noPass":false,"cannotOut":["left","right","down"],"cannotIn":["up"]},
"162": {"cls":"terrains","id":"arrowDown","noPass":false,"cannotOut":["left","right","up"],"cannotIn":["down"]},
"163": {"cls":"terrains","id":"arrowLeft","noPass":false,"cannotOut":["up","down","right"],"cannotIn":["left"]},
"164": {"cls":"terrains","id":"arrowRight","noPass":false,"cannotOut":["up","down","left"],"cannotIn":["right"]},
"165": {"cls":"terrains","id":"light","trigger":"changeLight","noPass":false},
"166": {"cls":"terrains","id":"darkLight","noPass":true},
"167": {"cls":"terrains","id":"ski","trigger":"ski","noPass":false},