更多值块 & 道具栏音效
This commit is contained in:
parent
22ed4527fc
commit
bf0092b8bc
@ -3456,7 +3456,6 @@ expression
|
||||
: expression Arithmetic_List expression
|
||||
| negate_e
|
||||
| unaryOperation_e
|
||||
| utilOperation_e
|
||||
| bool_e
|
||||
| idFixedList_e
|
||||
| idFlag_e
|
||||
@ -3472,6 +3471,9 @@ expression
|
||||
| isReplaying_e
|
||||
| hasVisitedFloor_e
|
||||
| isShopVisited_e
|
||||
| hasEquip_e
|
||||
| canBattle_e
|
||||
| rand_e
|
||||
| evalString_e
|
||||
|
||||
|
||||
@ -3482,9 +3484,6 @@ var ops = {
|
||||
'**': 'Math.pow('+expression_0+','+expression_1+')',
|
||||
'min': 'Math.min('+expression_0+','+expression_1+')',
|
||||
'max': 'Math.max('+expression_0+','+expression_1+')',
|
||||
'blockId': 'core.getBlockId('+expression_0+','+expression_1+')',
|
||||
'blockNum': 'core.getBlockNum('+expression_0+','+expression_1+')',
|
||||
'blockCls': 'core.getBlockCls('+expression_0+','+expression_1+')',
|
||||
'startsWith': expression_0+'.startsWith('+expression_1+')',
|
||||
'endsWith': expression_0+'.endsWith('+expression_1+')',
|
||||
'includes': expression_0+'.includes('+expression_1+')',
|
||||
@ -3513,9 +3512,6 @@ var orders = {
|
||||
'startsWith': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
|
||||
'endsWith': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
|
||||
'includes': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
|
||||
'blockId': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
|
||||
'blockNum': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
|
||||
'blockCls': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
|
||||
}
|
||||
return [code, orders[Arithmetic_List_0]];
|
||||
*/;
|
||||
@ -3539,15 +3535,6 @@ var code = UnaryOperator_List_0 + '(' + expression_0 + ')';
|
||||
return [code, Blockly.JavaScript.ORDER_MEMBER];
|
||||
*/;
|
||||
|
||||
utilOperation_e
|
||||
: UtilOperator_List expression
|
||||
|
||||
|
||||
/* utilOperation_e
|
||||
var code = UtilOperator_List_0 + '(' + expression_0 + ')';
|
||||
return [code, Blockly.JavaScript.ORDER_MEMBER];
|
||||
*/;
|
||||
|
||||
|
||||
bool_e
|
||||
: ':' Bool
|
||||
@ -3606,13 +3593,21 @@ return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
|
||||
|
||||
blockId_e
|
||||
: '图块ID:' Int ',' Int
|
||||
: '图块ID:' PosString ',' PosString
|
||||
|
||||
|
||||
/* blockId_e
|
||||
default : [0,0]
|
||||
var code = 'blockId:'+Int_0+','+Int_1;
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
if (/^\d+$/.test(PosString_0) && /^\d+$/.test(PosString_1)) {
|
||||
return ['blockId:'+PosString_0+','+PosString_1, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
}
|
||||
if (PosString_0.startsWith('"')) {
|
||||
PosString_0 = PosString_0.substring(1, PosString_0.length - 1);
|
||||
}
|
||||
if (PosString_1.startsWith('"')) {
|
||||
PosString_1 = PosString_1.substring(1, PosString_1.length - 1);
|
||||
}
|
||||
return ['core.getBlockId('+PosString_0+','+PosString_1+')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
@ -3622,8 +3617,16 @@ blockNumber_e
|
||||
|
||||
/* blockNumber_e
|
||||
default : [0,0]
|
||||
var code = 'blockNumber:'+Int_0+','+Int_1;
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
if (/^\d+$/.test(PosString_0) && /^\d+$/.test(PosString_1)) {
|
||||
return ['blockNumber:'+PosString_0+','+PosString_1, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
}
|
||||
if (PosString_0.startsWith('"')) {
|
||||
PosString_0 = PosString_0.substring(1, PosString_0.length - 1);
|
||||
}
|
||||
if (PosString_1.startsWith('"')) {
|
||||
PosString_1 = PosString_1.substring(1, PosString_1.length - 1);
|
||||
}
|
||||
return ['core.getBlockNumber('+PosString_0+','+PosString_1+')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
@ -3633,8 +3636,16 @@ blockCls_e
|
||||
|
||||
/* blockCls_e
|
||||
default : [0,0]
|
||||
var code = 'blockCls:'+Int_0+','+Int_1;
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
if (/^\d+$/.test(PosString_0) && /^\d+$/.test(PosString_1)) {
|
||||
return ['blockCls:'+PosString_0+','+PosString_1, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
}
|
||||
if (PosString_0.startsWith('"')) {
|
||||
PosString_0 = PosString_0.substring(1, PosString_0.length - 1);
|
||||
}
|
||||
if (PosString_1.startsWith('"')) {
|
||||
PosString_1 = PosString_1.substring(1, PosString_1.length - 1);
|
||||
}
|
||||
return ['core.getBlockCls('+PosString_0+','+PosString_1+')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
@ -3673,12 +3684,44 @@ isShopVisited_e
|
||||
|
||||
/* isShopVisited_e
|
||||
default : ['shop1']
|
||||
allFloorIds : ['IdString_0']
|
||||
allShops : ['IdString_0']
|
||||
var code = 'core.isShopVisited(\'' + IdString_0 + '\')';
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
hasEquip_e
|
||||
: '当前正在装备' IdString
|
||||
|
||||
/* hasEquip_e
|
||||
default : ['sword1']
|
||||
allEquips : ['IdString_0']
|
||||
var code = 'core.hasEquip(\'' + IdString_0 + '\')';
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
canBattle_e
|
||||
: '当前能否战斗' IdString
|
||||
|
||||
/* canBattle_e
|
||||
default : ['greenSlime']
|
||||
allEnemys : ['IdString_0']
|
||||
var code = 'core.canBattle(\'' + IdString_0 + '\')';
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
rand_e
|
||||
: '随机数 [0, ' Int ')'
|
||||
|
||||
/* rand_e
|
||||
default : ['10']
|
||||
var code = 'core.rand(' + Int_0 + ')';
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
*/;
|
||||
|
||||
|
||||
equip_e
|
||||
: '装备孔:' Int
|
||||
|
||||
@ -3783,8 +3826,8 @@ ShopUse_List
|
||||
/*ShopUse_List ['money','exp']*/;
|
||||
|
||||
Arithmetic_List
|
||||
: '加'|'减'|'乘'|'除'|'取余'|'乘方'|'等于'|'不等于'|'大于'|'小于'|'大于等于'|'小于等于'|'且'|'或'|'异或'|'取较大'|'取较小'|'弱相等'|'弱不相等'|'开始于'|'结束于'|'包含'|'图块id'|'图块数字'|'图块类型'
|
||||
/*Arithmetic_List ['+','-','*','/','%','**','===','!==','>','<','>=','<=','&&','||','^','max','min','==','!=','startsWith','endsWith','includes','blockId','blockNum','blockCls']*/;
|
||||
: '加'|'减'|'乘'|'除'|'取余'|'乘方'|'等于'|'不等于'|'大于'|'小于'|'大于等于'|'小于等于'|'且'|'或'|'异或'|'取较大'|'取较小'|'弱相等'|'弱不相等'|'开始于'|'结束于'|'包含'
|
||||
/*Arithmetic_List ['+','-','*','/','%','**','===','!==','>','<','>=','<=','&&','||','^','max','min','==','!=','startsWith','endsWith','includes']*/;
|
||||
|
||||
AssignOperator_List
|
||||
: '设为'|'增加'|'减少'|'乘以'|'除以'|'乘方'|'除以并取商'|'除以并取余'|'设为不小于'|'设为不大于'
|
||||
@ -3794,10 +3837,6 @@ UnaryOperator_List
|
||||
: '向下取整'|'向上取整'|'四舍五入'|'整数截断'|'绝对值'|'开方'|'变量类型'
|
||||
/*UnaryOperator_List ['Math.floor', 'Math.ceil', 'Math.round', 'Math.trunc', 'Math.abs', 'Math.sqrt', 'typeof']*/;
|
||||
|
||||
UtilOperator_List
|
||||
: '大数字格式化'|'哈希值'|'base64编码'|'base64解码'|'不可SL的随机'|'可以SL的随机'|'深拷贝'|'日期格式化'|'时间格式化'|'获得cookie'|'字符串字节数'
|
||||
/*UtilOperator_List ['core.formatBigNumber', 'core.hashCode', 'core.encodeBase64', 'core.decodeBase64', 'core.rand', 'core.rand2', 'core.clone', 'core.formatDate', 'core.formatTime', 'core.getCookie', 'core.strlen']*/;
|
||||
|
||||
Weather_List
|
||||
: '无'|'雨'|'雪'|'雾'|'云'
|
||||
/*Weather_List ['null','rain','snow','fog','cloud']*/;
|
||||
|
||||
@ -1222,7 +1222,7 @@ ActionParser.prototype.matchEvalAtom = function(args) {
|
||||
}
|
||||
match=/^core\.(nextX|nextY)\((-?\d*)\)$/.exec(args[0]);
|
||||
if (match) {
|
||||
if (match[2] == null) match[2] = 1;
|
||||
if (match[2] == "") match[2] = "1";
|
||||
args=[match[2], match[1]];
|
||||
return rt(MotaActionBlocks['nextXY_e'].xmlText, args);
|
||||
}
|
||||
@ -1236,6 +1236,21 @@ ActionParser.prototype.matchEvalAtom = function(args) {
|
||||
args[0]=match[1];
|
||||
return rt(MotaActionBlocks['isShopVisited_e'].xmlText, args);
|
||||
}
|
||||
match=/^core\.hasEquip\(['"](.*?)['"']\)$/.exec(args[0]);
|
||||
if (match) {
|
||||
args[0]=match[1];
|
||||
return rt(MotaActionBlocks['hasEquip_e'].xmlText, args);
|
||||
}
|
||||
match=/^core\.canBattle\(['"](.*?)['"']\)$/.exec(args[0]);
|
||||
if (match) {
|
||||
args[0]=match[1];
|
||||
return rt(MotaActionBlocks['canBattle_e'].xmlText, args);
|
||||
}
|
||||
match=/^core\.rand\((\d+)\)$/.exec(args[0]);
|
||||
if (match) {
|
||||
args[0]=match[1];
|
||||
return rt(MotaActionBlocks['rand_e'].xmlText, args);
|
||||
}
|
||||
return {ret:false}
|
||||
}
|
||||
|
||||
|
||||
@ -677,10 +677,10 @@ editor_blockly = function () {
|
||||
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
|
||||
namesObj.allItems = namesObj.allItems.concat(MotaActionFunctions.pattern.replaceItemList.map(function (x) {
|
||||
return x[1];
|
||||
}))
|
||||
namesObj.allEquips = namesObj.allEquips.concat(MotaActionFunctions.pattern.replaceItemList.map(function (x) {
|
||||
return x[1];
|
||||
}))
|
||||
}));
|
||||
namesObj.allEquips = namesObj.allEquips.concat(MotaActionFunctions.pattern.replaceItemList.filter(function (x) {
|
||||
return namesObj.allEquips.includes(x[0]);
|
||||
}).map(function (x) { return x[1]; }));
|
||||
}
|
||||
namesObj.allAnimates = Object.keys(core.material.animates)
|
||||
.concat(Object.keys(main.nameMap).filter(function (one) {return core.material.animates[main.nameMap[one]];}));
|
||||
|
||||
@ -258,7 +258,6 @@ editor_blocklyconfig=(function(){
|
||||
MotaActionBlocks['idTemp_e'].xmlText(),
|
||||
MotaActionBlocks['negate_e'].xmlText(),
|
||||
MotaActionBlocks['unaryOperation_e'].xmlText(),
|
||||
MotaActionBlocks['utilOperation_e'].xmlText(),
|
||||
MotaActionBlocks['bool_e'].xmlText(),
|
||||
MotaActionBlocks['idString_e'].xmlText(),
|
||||
MotaActionBlocks['idIdList_e'].xmlText(),
|
||||
@ -267,11 +266,14 @@ editor_blocklyconfig=(function(){
|
||||
MotaActionBlocks['blockId_e'].xmlText(),
|
||||
MotaActionBlocks['blockNumber_e'].xmlText(),
|
||||
MotaActionBlocks['blockCls_e'].xmlText(),
|
||||
MotaActionBlocks['hasEquip_e'].xmlText(),
|
||||
MotaActionBlocks['equip_e'].xmlText(),
|
||||
MotaActionBlocks['nextXY_e'].xmlText(),
|
||||
MotaActionBlocks['isReplaying_e'].xmlText(),
|
||||
MotaActionBlocks['hasVisitedFloor_e'].xmlText(),
|
||||
MotaActionBlocks['isShopVisited_e'].xmlText(),
|
||||
MotaActionBlocks['canBattle_e'].xmlText(),
|
||||
MotaActionBlocks['rand_e'].xmlText(),
|
||||
MotaActionBlocks['evalString_e'].xmlText(),
|
||||
],
|
||||
'常见事件模板':[
|
||||
|
||||
@ -965,11 +965,13 @@ actions.prototype._keyUpConfirmBox = function (keycode) {
|
||||
}
|
||||
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
||||
if (core.status.event.selection == 0 && core.status.event.data.yes) {
|
||||
core.playSound('确定');
|
||||
core.status.event.selection = null;
|
||||
core.status.event.data.yes();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.selection == 1 && core.status.event.data.no) {
|
||||
core.playSound('确定');
|
||||
core.status.event.selection = null;
|
||||
core.status.event.data.no();
|
||||
return;
|
||||
@ -1546,6 +1548,7 @@ actions.prototype._clickToolboxIndex = function (index) {
|
||||
core.events.tryUseItem(itemId);
|
||||
}
|
||||
else {
|
||||
core.playSound('光标移动');
|
||||
core.ui._drawToolbox(index);
|
||||
}
|
||||
}
|
||||
@ -1570,7 +1573,6 @@ actions.prototype._keyDownToolbox = function (keycode) {
|
||||
if (index == 0) { // 处理向前翻页
|
||||
if (toolsPage > 1) {
|
||||
core.status.event.data.toolsPage--;
|
||||
core.playSound('光标移动');
|
||||
index = last_index;
|
||||
}
|
||||
else return; // 第一页不向前翻
|
||||
@ -1583,7 +1585,6 @@ actions.prototype._keyDownToolbox = function (keycode) {
|
||||
}
|
||||
else {
|
||||
core.status.event.data.constantsPage--;
|
||||
core.playSound('光标移动');
|
||||
index = 2 * this.LAST - 1;
|
||||
}
|
||||
}
|
||||
@ -1605,12 +1606,10 @@ actions.prototype._keyDownToolbox = function (keycode) {
|
||||
if (keycode == 39) { // right
|
||||
if (toolsPage < toolsTotalPage && index == last_index) {
|
||||
core.status.event.data.toolsPage++;
|
||||
core.playSound('光标移动');
|
||||
index = 0;
|
||||
}
|
||||
else if (constantsPage < constantsTotalPage && index == 2 * this.LAST - 1) {
|
||||
core.status.event.data.constantsPage++;
|
||||
core.playSound('光标移动');
|
||||
index = this.LAST;
|
||||
}
|
||||
else if (index == toolsLastIndex) {
|
||||
@ -1648,6 +1647,7 @@ actions.prototype._keyDownToolbox = function (keycode) {
|
||||
////// 工具栏界面时,放开某个键的操作 //////
|
||||
actions.prototype._keyUpToolbox = function (keycode) {
|
||||
if (keycode == 81) {
|
||||
core.playSound('确定');
|
||||
core.ui.closePanel();
|
||||
if (core.isReplaying())
|
||||
core.control._replay_equipbox();
|
||||
@ -1672,6 +1672,7 @@ actions.prototype._keyUpToolbox = function (keycode) {
|
||||
actions.prototype._clickEquipbox = function (x, y) {
|
||||
// 道具栏
|
||||
if (x >= this.LAST - 2 && y == 0) {
|
||||
core.playSound('确定');
|
||||
core.ui.closePanel();
|
||||
if (core.isReplaying())
|
||||
core.control._replay_toolbox();
|
||||
@ -1731,7 +1732,7 @@ actions.prototype._clickEquipboxIndex = function (index) {
|
||||
if (core.isReplaying()) return;
|
||||
core.unloadEquip(index);
|
||||
core.status.route.push("unEquip:" + index);
|
||||
}
|
||||
} else core.playSound('光标移动');
|
||||
}
|
||||
else {
|
||||
var equips = core.getToolboxItems('equips');
|
||||
@ -1740,7 +1741,7 @@ actions.prototype._clickEquipboxIndex = function (index) {
|
||||
var equipId = equips[index - this.LAST + (core.status.event.data.page - 1) * this.LAST];
|
||||
core.loadEquip(equipId);
|
||||
core.status.route.push("equip:" + equipId);
|
||||
}
|
||||
} else core.playSound('光标移动');
|
||||
}
|
||||
core.ui._drawEquipbox(index);
|
||||
}
|
||||
@ -1829,6 +1830,7 @@ actions.prototype._keyUpEquipbox = function (keycode, altKey) {
|
||||
return;
|
||||
}
|
||||
if (keycode == 84) {
|
||||
core.playSound('确定');
|
||||
core.ui.closePanel();
|
||||
if (core.isReplaying())
|
||||
core.control._replay_toolbox();
|
||||
@ -1954,6 +1956,7 @@ actions.prototype._clickSL_favorite = function (page, offset) {
|
||||
});
|
||||
} else {
|
||||
var v = core.saves.favorite.indexOf(index);
|
||||
core.playSound('确定');
|
||||
if (v >= 0) { // 已经处于收藏状态:取消收藏
|
||||
core.saves.favorite.splice(v, 1);
|
||||
delete core.saves.favoriteName[index];
|
||||
@ -1961,7 +1964,6 @@ actions.prototype._clickSL_favorite = function (page, offset) {
|
||||
else if (core.hasSave(index)) { // 存在存档则进行收藏
|
||||
core.saves.favorite.push(index);
|
||||
core.saves.favorite = core.saves.favorite.sort(function (a,b) {return a-b;}); // 保证有序
|
||||
core.playSound('确定');
|
||||
core.drawTip("收藏成功!");
|
||||
}
|
||||
core.control._updateFavoriteSaves();
|
||||
@ -1972,7 +1974,6 @@ actions.prototype._clickSL_favorite = function (page, offset) {
|
||||
////// 存读档界面时,按下某个键的操作 //////
|
||||
actions.prototype._keyDownSL = function (keycode) {
|
||||
|
||||
// var index = core.status.event.data;
|
||||
var page = core.status.event.data.page, offset = core.status.event.data.offset;
|
||||
var index = page*10 + offset;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user