编辑mapblocksinfo
This commit is contained in:
parent
1c45bfee3f
commit
f933ca5435
@ -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);
|
||||
@ -268,23 +268,43 @@ editor_file = function(editor, callback){
|
||||
//callback([obj,commentObj,err:String])
|
||||
|
||||
editor_file.editMapBlocksInfo = function(idnum,actionList,callback){
|
||||
/*actionList:[]
|
||||
只允许[]查询
|
||||
/*actionList:[
|
||||
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。"]],
|
||||
["change","['afterBattle']",null],
|
||||
]
|
||||
为[]时只查询不修改
|
||||
*/
|
||||
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')};
|
||||
if (isset(actionList) && actionList.length > 0){
|
||||
printe('editor中不允许修改图块的地形信息');throw('editor中不允许修改图块的地形信息');
|
||||
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.enemys).forEach(function(v){
|
||||
if (!isset(editor.core.enemys.enemys[id][v]))
|
||||
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.enemys, */
|
||||
editor_file.comment.maps,
|
||||
null]);
|
||||
}
|
||||
}
|
||||
@ -516,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';
|
||||
@ -534,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';
|
||||
@ -554,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';
|
||||
@ -566,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';
|
||||
@ -583,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';
|
||||
@ -595,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;
|
||||
@ -611,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);
|
||||
|
||||
@ -33,6 +33,13 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
'damage':'战前扣血的点数\n$range(thiseval==~~thiseval||thiseval==null)$end'
|
||||
},
|
||||
"enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
||||
"maps" : {
|
||||
"id" : "$range(false)$end",
|
||||
"idnum" : "$range(false)$end",
|
||||
"cls" : "$range(false)$end",
|
||||
"trigger" : "$select({\"values\":[null,\"openDoor\",\"passNet\",\"changeLight\",\"ski\",\"pushBox\"]})$end",
|
||||
"noPass" : "$select({\"values\":[null,true,false]})$end"
|
||||
},
|
||||
"floors" : {
|
||||
'floor' : {
|
||||
"floorId": "文件名和floorId需要保持完全一致 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 \n楼层唯一标识符,需要和名字完全一致 \n这里不能更改floorId,请通过另存为来实现\n$range(false)$end",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user