Merge branch 'v2.0' of https://github.com/ckcz123/mota-js into v2.0
This commit is contained in:
commit
dc35bc7adf
9 files changed
+120
-47
No files matched your search
+2
-1
@@ -181,4 +181,5 @@ fs.readdir(path, callback)
|
||||
|
||||
目前主体部分使用了 0-15,75,100
|
||||
|
||||
blockly使用 200 ,多行文本编辑器使用 300
|
||||
blockly使用 200,201
|
||||
多行文本编辑器使用 300
|
||||
@@ -764,13 +764,13 @@ return code;
|
||||
*/
|
||||
|
||||
choices_s
|
||||
: '选项' ':' EvalString BGNL? '标题' EvalString? '图像' IdString? BGNL? Newline choicesContext+ BEND Newline
|
||||
: '选项' ':' EvalString? BGNL? '标题' EvalString? '图像' IdString? BGNL? Newline choicesContext+ BEND Newline
|
||||
;
|
||||
|
||||
/* choices_s
|
||||
tooltip : choices: 给用户提供选项
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=choices-%e7%bb%99%e7%94%a8%e6%88%b7%e6%8f%90%e4%be%9b%e9%80%89%e9%a1%b9
|
||||
default : ["提示文字:选择一种钥匙","流浪者","woman"]
|
||||
default : ["","流浪者","woman"]
|
||||
var title='';
|
||||
if (EvalString_1==''){
|
||||
if (IdString_0=='')title='';
|
||||
@@ -779,7 +779,9 @@ if (EvalString_1==''){
|
||||
if (IdString_0=='')title='\\t['+EvalString_1+']';
|
||||
else title='\\t['+EvalString_1+','+IdString_0+']';
|
||||
}
|
||||
var code = ['{"type": "choices", "text": "',title+EvalString_0,'", "choices": [\n',
|
||||
EvalString_0 = title+EvalString_0;
|
||||
EvalString_0 = EvalString_0 ?(', "text": "'+EvalString_0+'"'):'';
|
||||
var code = ['{"type": "choices"',EvalString_0,', "choices": [\n',
|
||||
choicesContext_0,
|
||||
']},\n'].join('');
|
||||
return code;
|
||||
@@ -1315,7 +1317,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
choice.text,this.insertActionList(choice.action),text_choices]);
|
||||
}
|
||||
this.next = MotaActionBlocks['choices_s'].xmlText([
|
||||
this.EvalString(data.text),'','',text_choices,this.next]);
|
||||
this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]);
|
||||
break;
|
||||
case "win":
|
||||
this.next = MotaActionBlocks['win_s'].xmlText([
|
||||
|
||||
+2
-2
@@ -368,7 +368,7 @@ editor.prototype.listen = function() {
|
||||
var pos = locToPos(loc);
|
||||
editor_mode.onmode('nextChange');
|
||||
editor_mode.onmode('loc');
|
||||
editor_mode.loc();
|
||||
//editor_mode.loc();
|
||||
tip.whichShow = 1;
|
||||
return;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ editor.prototype.listen = function() {
|
||||
tip.infos = JSON.parse(JSON.stringify(editor.info));
|
||||
editor_mode.onmode('nextChange');
|
||||
editor_mode.onmode('emenyitem');
|
||||
editor_mode.emenyitem();
|
||||
//editor_mode.emenyitem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,8 +347,21 @@ editor_blockly.import = function(id_){
|
||||
return true;
|
||||
}
|
||||
|
||||
editor_blockly.show = function(){document.getElementById('left6').style='';}
|
||||
editor_blockly.hide = function(){document.getElementById('left6').style='z-index:-1;opacity: 0;';}
|
||||
var blocklyWidgetDiv = document.getElementsByClassName('blocklyWidgetDiv');
|
||||
editor_blockly.show = function(){
|
||||
document.getElementById('left6').style='';
|
||||
for(var ii =0,node;node=blocklyWidgetDiv[ii];ii++){
|
||||
node.style.zIndex = 201;
|
||||
node.style.opacity = '';
|
||||
}
|
||||
}
|
||||
editor_blockly.hide = function(){
|
||||
document.getElementById('left6').style='z-index:-1;opacity: 0;';
|
||||
for(var ii =0,node;node=blocklyWidgetDiv[ii];ii++){
|
||||
node.style.zIndex = -1;
|
||||
node.style.opacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
editor_blockly.cancel = function(){
|
||||
editor_blockly.id='';
|
||||
|
||||
+77
-30
@@ -149,10 +149,10 @@ editor_file = function(editor, callback){
|
||||
saveSetting('maps',[["add","['"+idnum+"']",{'cls': info.images, 'id':id}]],tempcallback);
|
||||
saveSetting('icons',[["add","['"+info.images+"']['"+id+"']",info.y]],tempcallback);
|
||||
if(info.images==='items'){
|
||||
saveSetting('items',[["change"/*其实应该是add*/,"['items']['"+id+"']",editor_file.comment.items_template]],function(err){if(err){printe(err);throw(err)}});
|
||||
saveSetting('items',[["add","['items']['"+id+"']",editor_file.comment.items_template]],function(err){if(err){printe(err);throw(err)}});
|
||||
}
|
||||
if(info.images==='enemys' || info.images==='enemy48'){
|
||||
saveSetting('enemys',[["change"/*其实应该是add*/,"['"+id+"']",editor_file.comment.enemys_template]],function(err){if(err){printe(err);throw(err)}});
|
||||
saveSetting('enemys',[["add","['"+id+"']",editor_file.comment.enemys_template]],function(err){if(err){printe(err);throw(err)}});
|
||||
}
|
||||
|
||||
callback(null);
|
||||
@@ -174,33 +174,47 @@ editor_file = function(editor, callback){
|
||||
});
|
||||
saveSetting('items',actionList,function (err) {
|
||||
callback([
|
||||
{'items':(function(){
|
||||
var locObj=Object.assign({},editor.core.items.items[id]);
|
||||
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
||||
if (!isset(editor.core.items.items[id][v]))
|
||||
/* locObj[v]=editor.core.items.items[id][v];
|
||||
else */
|
||||
locObj[v]=null;
|
||||
(function(){
|
||||
var locObj_ ={};
|
||||
Object.keys(editor_file.comment.items).forEach(function(v){
|
||||
if (isset(editor.core.items[v][id]) && v!=='items')
|
||||
locObj_[v]=editor.core.items[v][id];
|
||||
else
|
||||
locObj_[v]=null;
|
||||
});
|
||||
return locObj;
|
||||
locObj_['items']=(function(){
|
||||
var locObj=Object.assign({},editor.core.items.items[id]);
|
||||
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
||||
if (!isset(editor.core.items.items[id][v]))
|
||||
locObj[v]=null;
|
||||
});
|
||||
return locObj;
|
||||
})();
|
||||
return locObj_;
|
||||
})(),
|
||||
'itemEffect':editor.core.items.itemEffect[id],'itemEffectTip':editor.core.items.itemEffectTip[id]},
|
||||
editor_file.comment.items,
|
||||
err]);
|
||||
});
|
||||
} else {
|
||||
callback([
|
||||
{'items':(function(){
|
||||
var locObj=Object.assign({},editor.core.items.items[id]);
|
||||
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
||||
if (!isset(editor.core.items.items[id][v]))
|
||||
/* locObj[v]=editor.core.items.items[id][v];
|
||||
else */
|
||||
locObj[v]=null;
|
||||
(function(){
|
||||
var locObj_ ={};
|
||||
Object.keys(editor_file.comment.items).forEach(function(v){
|
||||
if (isset(editor.core.items[v][id]) && v!=='items')
|
||||
locObj_[v]=editor.core.items[v][id];
|
||||
else
|
||||
locObj_[v]=null;
|
||||
});
|
||||
return locObj;
|
||||
locObj_['items']=(function(){
|
||||
var locObj=Object.assign({},editor.core.items.items[id]);
|
||||
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
||||
if (!isset(editor.core.items.items[id][v]))
|
||||
locObj[v]=null;
|
||||
});
|
||||
return locObj;
|
||||
})();
|
||||
return locObj_;
|
||||
})(),
|
||||
'itemEffect':editor.core.items.itemEffect[id],'itemEffectTip':editor.core.items.itemEffectTip[id]},
|
||||
editor_file.comment.items,
|
||||
null]);
|
||||
}
|
||||
@@ -253,6 +267,49 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
//callback([obj,commentObj,err:String])
|
||||
|
||||
editor_file.editMapBlocksInfo = function(idnum,actionList,callback){
|
||||
/*actionList:[
|
||||
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。"]],
|
||||
["change","['afterBattle']",null],
|
||||
]
|
||||
为[]时只查询不修改
|
||||
*/
|
||||
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')};
|
||||
if (isset(actionList) && actionList.length > 0){
|
||||
actionList.forEach(function (value) {
|
||||
value[1] = "['"+idnum+"']"+value[1];
|
||||
});
|
||||
saveSetting('maps',actionList,function (err) {
|
||||
callback([
|
||||
(function(){
|
||||
var locObj=Object.assign({},editor.core.maps.blocksInfo[idnum]);
|
||||
Object.keys(editor_file.comment.maps).forEach(function(v){
|
||||
if (!isset(editor.core.maps.blocksInfo[idnum][v]))
|
||||
locObj[v]=null;
|
||||
});
|
||||
locObj.idnum = idnum;
|
||||
return locObj;
|
||||
})(),
|
||||
editor_file.comment.maps,
|
||||
null]);
|
||||
});
|
||||
} else {
|
||||
callback([
|
||||
(function(){
|
||||
var locObj=Object.assign({},editor.core.maps.blocksInfo[idnum]);
|
||||
Object.keys(editor_file.comment.maps).forEach(function(v){
|
||||
if (!isset(editor.core.maps.blocksInfo[idnum][v]))
|
||||
locObj[v]=null;
|
||||
});
|
||||
locObj.idnum = idnum;
|
||||
return locObj;
|
||||
})(),
|
||||
editor_file.comment.maps,
|
||||
null]);
|
||||
}
|
||||
}
|
||||
//callback([obj,commentObj,err:String])
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
editor_file.editLoc = function(x,y,actionList,callback){
|
||||
@@ -479,13 +536,9 @@ editor_file = function(editor, callback){
|
||||
var saveSetting = function(file,actionList,callback) {
|
||||
//console.log(file);
|
||||
//console.log(actionList);
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='change' && file!='icons' && file!='maps') {printe('目前只支持change');throw('目前只支持change')};
|
||||
});
|
||||
|
||||
if (file=='icons') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='add')return;
|
||||
eval("icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1"+value[1]+'='+JSON.stringify(value[2]));
|
||||
});
|
||||
var datastr='icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = \n';
|
||||
@@ -497,7 +550,6 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
if (file=='maps') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='add')return;
|
||||
eval("maps_90f36752_8815_4be8_b32b_d7fad1d0542e"+value[1]+'='+JSON.stringify(value[2]));
|
||||
});
|
||||
var datastr='maps_90f36752_8815_4be8_b32b_d7fad1d0542e = \n';
|
||||
@@ -517,7 +569,6 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
if (file=='items') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='change')return;
|
||||
eval("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a"+value[1]+'='+JSON.stringify(value[2]));
|
||||
});
|
||||
var datastr='items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n';
|
||||
@@ -529,7 +580,6 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
if (file=='enemys') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='change')return;
|
||||
eval("enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80"+value[1]+'='+JSON.stringify(value[2]));
|
||||
});
|
||||
var datastr='enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n';
|
||||
@@ -546,7 +596,6 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
if (file=='data') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='change')return;
|
||||
eval("data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d"+value[1]+'='+JSON.stringify(value[2]));
|
||||
});
|
||||
var datastr='data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = \n';
|
||||
@@ -558,7 +607,6 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
if (file=='functions') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='change')return;
|
||||
eval("fmap[fobj"+value[1]+']='+JSON.stringify(value[2]));
|
||||
});
|
||||
var fraw = fjson;
|
||||
@@ -574,7 +622,6 @@ editor_file = function(editor, callback){
|
||||
}
|
||||
if (file=='floors') {
|
||||
actionList.forEach(function (value) {
|
||||
if (value[0]!='change')return;
|
||||
eval("editor.currentFloorData"+value[1]+'='+JSON.stringify(value[2]));
|
||||
});
|
||||
editor_file.saveFloorFile(callback);
|
||||
|
||||
@@ -182,6 +182,8 @@ editor_mode.prototype.doActionList = function(mode,actionList){
|
||||
editor.file.editEnemy(editor_mode.info.id,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
|
||||
} else if (editor_mode.info.images=='items'){
|
||||
editor.file.editItem(editor_mode.info.id,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
|
||||
} else {
|
||||
editor.file.editMapBlocksInfo(editor_mode.info.idnum,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
|
||||
}
|
||||
break;
|
||||
case 'floor':
|
||||
@@ -256,8 +258,9 @@ editor_mode.prototype.emenyitem = function(callback){
|
||||
} else if (editor_mode.info.images=='items'){
|
||||
editor.file.editItem(editor_mode.info.id,[],function(objs_){objs=objs_;/*console.log(objs_)*/});
|
||||
} else {
|
||||
document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML='';
|
||||
return;
|
||||
/* document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML='';
|
||||
return; */
|
||||
editor.file.editMapBlocksInfo(editor_mode.info.idnum,[],function(objs_){objs=objs_;/*console.log(objs_)*/});
|
||||
}
|
||||
//只查询不修改时,内部实现不是异步的,所以可以这么写
|
||||
var tableinfo=editor_mode.objToTable(objs[0],objs[1]);
|
||||
|
||||
Reference in new issue
Block a user