flag中文冒号 & 更多值块
This commit is contained in:
parent
ead209ddad
commit
4d0a5d22d6
@ -3406,6 +3406,10 @@ expression
|
|||||||
| blockNumber_e
|
| blockNumber_e
|
||||||
| blockCls_e
|
| blockCls_e
|
||||||
| equip_e
|
| equip_e
|
||||||
|
| nextXY_e
|
||||||
|
| isReplaying_e
|
||||||
|
| hasVisitedFloor_e
|
||||||
|
| isShopVisited_e
|
||||||
| evalString_e
|
| evalString_e
|
||||||
|
|
||||||
|
|
||||||
@ -3566,6 +3570,47 @@ return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
|
||||||
|
nextXY_e
|
||||||
|
: '前方' Int '格的' NextXY_List
|
||||||
|
|
||||||
|
/* nextXY_e
|
||||||
|
default : [1, 'nextX']
|
||||||
|
var code = NextXY_List_0 == 'nextY' ? ('core.nextY('+Int_0+')') : ('core.nextX('+Int_0+')');
|
||||||
|
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||||
|
*/;
|
||||||
|
|
||||||
|
|
||||||
|
isReplaying_e
|
||||||
|
: '录像播放中'
|
||||||
|
|
||||||
|
/* isReplaying_e
|
||||||
|
var code = 'core.isReplaying()';
|
||||||
|
return [code, Blockly.JavaScript.ORDER_ATOMIC];;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
|
||||||
|
hasVisitedFloor_e
|
||||||
|
: '访问过楼层' IdString
|
||||||
|
|
||||||
|
/* hasVisitedFloor_e
|
||||||
|
default : ['MT0']
|
||||||
|
allFloorIds : ['IdString_0']
|
||||||
|
var code = 'core.hasVisitedFloor(\'' + IdString_0 + '\')';
|
||||||
|
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||||
|
*/;
|
||||||
|
|
||||||
|
|
||||||
|
isShopVisited_e
|
||||||
|
: '开启过商店' IdString
|
||||||
|
|
||||||
|
/* isShopVisited_e
|
||||||
|
default : ['shop1']
|
||||||
|
allFloorIds : ['IdString_0']
|
||||||
|
var code = 'core.isShopVisited(\'' + IdString_0 + '\')';
|
||||||
|
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||||
|
*/;
|
||||||
|
|
||||||
|
|
||||||
equip_e
|
equip_e
|
||||||
: '装备孔:' Int
|
: '装备孔:' Int
|
||||||
|
|
||||||
@ -3730,6 +3775,10 @@ Global_Flag_List
|
|||||||
: '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示生命值'|'显示魔力值'|'显示攻击力'|'显示防御力'|'显示护盾值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示绿钥匙'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'楼传平面塔模式'|'铁门不需要钥匙'|'开启加点'|'开启负伤'|'夹击不超伤害值'|'循环计算临界'|'允许轻按'|'允许走到将死领域'|'允许瞬间移动'|'阻激夹域后禁用快捷商店'|'虚化前景层'
|
: '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示生命值'|'显示魔力值'|'显示攻击力'|'显示防御力'|'显示护盾值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示绿钥匙'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'楼传平面塔模式'|'铁门不需要钥匙'|'开启加点'|'开启负伤'|'夹击不超伤害值'|'循环计算临界'|'允许轻按'|'允许走到将死领域'|'允许瞬间移动'|'阻激夹域后禁用快捷商店'|'虚化前景层'
|
||||||
/*Global_Flag_List ['s:enableFloor','s:enableName','s:enableLv', 's:enableHPMax', 's:enableHP', 's:enableMana', 's:enableAtk', 's:enableDef', 's:enableMDef', 's:enableMoney', 's:enableExp', 's:enableLevelUp', 's:levelUpLeftMode', 's:enableKeys', 's:enableGreenKey', 's:enablePZF', 's:enableDebuff', 's:enableSkill', 'flyNearStair', 'flyRecordPosition', 'steelDoorWithoutKey', 'enableAddPoint', 'enableNegativeDamage', 'betweenAttackMax', 'useLoop', 'enableGentleClick', 'canGoDeadZone', 'enableMoveDirectly', 'disableShopOnDamage', 'blurFg']*/;
|
/*Global_Flag_List ['s:enableFloor','s:enableName','s:enableLv', 's:enableHPMax', 's:enableHP', 's:enableMana', 's:enableAtk', 's:enableDef', 's:enableMDef', 's:enableMoney', 's:enableExp', 's:enableLevelUp', 's:levelUpLeftMode', 's:enableKeys', 's:enableGreenKey', 's:enablePZF', 's:enableDebuff', 's:enableSkill', 'flyNearStair', 'flyRecordPosition', 'steelDoorWithoutKey', 'enableAddPoint', 'enableNegativeDamage', 'betweenAttackMax', 'useLoop', 'enableGentleClick', 'canGoDeadZone', 'enableMoveDirectly', 'disableShopOnDamage', 'blurFg']*/;
|
||||||
|
|
||||||
|
NextXY_List
|
||||||
|
: '横坐标'|'纵坐标'
|
||||||
|
/*NextXY_List ['nextX','nextY']*/;
|
||||||
|
|
||||||
Colour
|
Colour
|
||||||
: 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则
|
: 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则
|
||||||
;
|
;
|
||||||
|
|||||||
@ -1204,6 +1204,26 @@ ActionParser.prototype.matchEvalAtom = function(args) {
|
|||||||
args[0]=match[1]
|
args[0]=match[1]
|
||||||
return rt(MotaActionBlocks['equip_e'].xmlText, args);
|
return rt(MotaActionBlocks['equip_e'].xmlText, args);
|
||||||
}
|
}
|
||||||
|
match=/^core\.isReplaying\(\)$/.exec(args[0]);
|
||||||
|
if (match) {
|
||||||
|
return rt(MotaActionBlocks['isReplaying_e'].xmlText, args);
|
||||||
|
}
|
||||||
|
match=/^core\.(nextX|nextY)\((-?\d*)\)$/.exec(args[0]);
|
||||||
|
if (match) {
|
||||||
|
if (match[2] == null) match[2] = 1;
|
||||||
|
args=[match[2], match[1]];
|
||||||
|
return rt(MotaActionBlocks['nextXY_e'].xmlText, args);
|
||||||
|
}
|
||||||
|
match=/^core\.hasVisitedFloor\(['"](.*?)['"']\)$/.exec(args[0]);
|
||||||
|
if (match) {
|
||||||
|
args[0]=match[1];
|
||||||
|
return rt(MotaActionBlocks['hasVisitedFloor_e'].xmlText, args);
|
||||||
|
}
|
||||||
|
match=/^core\.isShopVisited\(['"](.*?)['"']\)$/.exec(args[0]);
|
||||||
|
if (match) {
|
||||||
|
args[0]=match[1];
|
||||||
|
return rt(MotaActionBlocks['isShopVisited_e'].xmlText, args);
|
||||||
|
}
|
||||||
return {ret:false}
|
return {ret:false}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -265,6 +265,10 @@ editor_blocklyconfig=(function(){
|
|||||||
MotaActionBlocks['blockNumber_e'].xmlText(),
|
MotaActionBlocks['blockNumber_e'].xmlText(),
|
||||||
MotaActionBlocks['blockCls_e'].xmlText(),
|
MotaActionBlocks['blockCls_e'].xmlText(),
|
||||||
MotaActionBlocks['equip_e'].xmlText(),
|
MotaActionBlocks['equip_e'].xmlText(),
|
||||||
|
MotaActionBlocks['nextXY_e'].xmlText(),
|
||||||
|
MotaActionBlocks['isReplaying_e'].xmlText(),
|
||||||
|
MotaActionBlocks['hasVisitedFloor_e'].xmlText(),
|
||||||
|
MotaActionBlocks['isShopVisited_e'].xmlText(),
|
||||||
MotaActionBlocks['evalString_e'].xmlText(),
|
MotaActionBlocks['evalString_e'].xmlText(),
|
||||||
],
|
],
|
||||||
'常见事件模板':[
|
'常见事件模板':[
|
||||||
|
|||||||
@ -77,11 +77,13 @@ editor_datapanel_wrapper = function (editor) {
|
|||||||
}
|
}
|
||||||
importMap.onclick= function () {
|
importMap.onclick= function () {
|
||||||
var sy=editor.map.length,sx=editor.map[0].length;
|
var sy=editor.map.length,sx=editor.map[0].length;
|
||||||
var mapArray;
|
var mapArray = null;
|
||||||
try {
|
var value = pout.value.trim();
|
||||||
mapArray = JSON.parse('[' + pout.value + ']');
|
// 去除可能末尾的 ','
|
||||||
if (mapArray.length != sy || mapArray[0].length != sx) throw '';
|
if (value.endsWith(',')) value = value.substring(0, value.length - 1);
|
||||||
} catch (e) {
|
try { mapArray = JSON.parse(value); } catch (e) {console.log(e)}
|
||||||
|
try { mapArray = mapArray || JSON.parse('[' + value + ']'); } catch (e) {console.log(e)}
|
||||||
|
if (mapArray == null || mapArray.length != sy || mapArray[0].length != sx) {
|
||||||
printe('格式错误!请使用正确格式(请使用地图生成器进行生成,且需要和本地图宽高完全一致)');
|
printe('格式错误!请使用正确格式(请使用地图生成器进行生成,且需要和本地图宽高完全一致)');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,17 +97,17 @@ utils.prototype.replaceText = function (text, prefix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
utils.prototype.replaceValue = function (value) {
|
utils.prototype.replaceValue = function (value) {
|
||||||
if (typeof value == "string" && value.indexOf(":") >= 0) {
|
if (typeof value == "string" && (value.indexOf(":") >= 0 || value.indexOf("flag:") >= 0 || value.indexOf('global:') >= 0)) {
|
||||||
if (value.indexOf('status:') >= 0)
|
if (value.indexOf('status:') >= 0)
|
||||||
value = value.replace(/status:([a-zA-Z0-9_]+)/g, "core.getStatus('$1')");
|
value = value.replace(/status:([a-zA-Z0-9_]+)/g, "core.getStatus('$1')");
|
||||||
if (value.indexOf('item:') >= 0)
|
if (value.indexOf('item:') >= 0)
|
||||||
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
|
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
|
||||||
if (value.indexOf('flag:') >= 0)
|
if (value.indexOf('flag:') >= 0 || value.indexOf('flag:') >= 0)
|
||||||
value = value.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getFlag('$1', 0)");
|
value = value.replace(/flag[::]([a-zA-Z0-9_\u4E00-\u9FCC\u3040-\u30FF\u2160-\u216B]+)/g, "core.getFlag('$1', 0)");
|
||||||
//if (value.indexOf('switch:' >= 0))
|
//if (value.indexOf('switch:' >= 0))
|
||||||
// value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
|
// value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
|
||||||
if (value.indexOf('global:') >= 0)
|
if (value.indexOf('global:') >= 0 || value.indexOf('global:') >= 0)
|
||||||
value = value.replace(/global:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getGlobal('$1', 0)");
|
value = value.replace(/global[::]([a-zA-Z0-9_\u4E00-\u9FCC\u3040-\u30FF\u2160-\u216B]+)/g, "core.getGlobal('$1', 0)");
|
||||||
if (value.indexOf('enemy:')>=0)
|
if (value.indexOf('enemy:')>=0)
|
||||||
value = value.replace(/enemy:([a-zA-Z0-9_]+)[\.:]([a-zA-Z0-9_]+)/g, "core.material.enemys['$1'].$2");
|
value = value.replace(/enemy:([a-zA-Z0-9_]+)[\.:]([a-zA-Z0-9_]+)/g, "core.material.enemys['$1'].$2");
|
||||||
if (value.indexOf('blockId:')>=0)
|
if (value.indexOf('blockId:')>=0)
|
||||||
@ -128,7 +128,7 @@ utils.prototype.replaceValue = function (value) {
|
|||||||
utils.prototype.calValue = function (value, prefix) {
|
utils.prototype.calValue = function (value, prefix) {
|
||||||
if (!core.isset(value)) return null;
|
if (!core.isset(value)) return null;
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
if (value.indexOf(':') >= 0) {
|
if (value.indexOf(':') >= 0 || value.indexOf("flag:") >= 0 || value.indexOf('global:') >= 0) {
|
||||||
if (value.indexOf('switch:' >= 0))
|
if (value.indexOf('switch:' >= 0))
|
||||||
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
|
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
|
||||||
value = this.replaceValue(value);
|
value = this.replaceValue(value);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user