分区砍层插件
This commit is contained in:
parent
9a343dd8af
commit
69b688bdfd
@ -1748,6 +1748,17 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
|||||||
"!type": "number",
|
"!type": "number",
|
||||||
"!doc": "窗口宽度的一半,为6或7"
|
"!doc": "窗口宽度的一半,为6或7"
|
||||||
},
|
},
|
||||||
|
"floorIds": {
|
||||||
|
"!type": "[string]",
|
||||||
|
"!doc": "全部楼层ID列表"
|
||||||
|
},
|
||||||
|
"floors": {
|
||||||
|
"!doc": "全部楼层信息"
|
||||||
|
},
|
||||||
|
"floorPartitions": {
|
||||||
|
"!type": "[[string]]",
|
||||||
|
"!doc": "楼层分区信息"
|
||||||
|
},
|
||||||
"material": {
|
"material": {
|
||||||
"!doc": "游戏所用到的资源",
|
"!doc": "游戏所用到的资源",
|
||||||
"animates": {
|
"animates": {
|
||||||
@ -3990,6 +4001,10 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
|||||||
"!doc": "恢复某一些被删除楼层。<br/>fromId: 开始恢复的楼层ID<br/>toId: 恢复到的楼层编号;可选,不填则视为fromId<br/>例如:core.resumeMaps(\"MT1\", \"MT300\") 恢复MT1~MT300之间的全部层<br/>core.resumeMaps(\"MT10\") 只删恢复MT10层",
|
"!doc": "恢复某一些被删除楼层。<br/>fromId: 开始恢复的楼层ID<br/>toId: 恢复到的楼层编号;可选,不填则视为fromId<br/>例如:core.resumeMaps(\"MT1\", \"MT300\") 恢复MT1~MT300之间的全部层<br/>core.resumeMaps(\"MT10\") 只删恢复MT10层",
|
||||||
"!type": "fn(fromId: string, toId?: string)"
|
"!type": "fn(fromId: string, toId?: string)"
|
||||||
},
|
},
|
||||||
|
"autoRemoveMaps": {
|
||||||
|
"!doc": "根据楼层分区信息自动砍层与恢复",
|
||||||
|
"!type": "fn(floorId: string)"
|
||||||
|
},
|
||||||
"openItemShop": {
|
"openItemShop": {
|
||||||
"!doc": "打开一个道具商店",
|
"!doc": "打开一个道具商店",
|
||||||
"!type": "fn(itemShopId: string)"
|
"!type": "fn(itemShopId: string)"
|
||||||
|
|||||||
@ -387,6 +387,42 @@ var code = '{"title": "'+EvalString_0+'", "name": "'+EvalString_1+'", "hard": '+
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
floorPartition_m
|
||||||
|
: '高层塔分区管理' BGNL? floorPartitionList+ BEND
|
||||||
|
|
||||||
|
|
||||||
|
/* floorPartition_m
|
||||||
|
tooltip : 高层塔分区管理
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
var code = '[\n'+floorPartitionList_0+']\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
floorPartitionList
|
||||||
|
: floorPartitionItem
|
||||||
|
| floorPartitionEmpty;
|
||||||
|
|
||||||
|
floorPartitionEmpty
|
||||||
|
: Newline
|
||||||
|
|
||||||
|
/* floorPartitionEmpty
|
||||||
|
var code = ' \n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
floorPartitionItem
|
||||||
|
: '分区项' '起始楼层ID' IdString '终止楼层ID(不填代表到最后一层)' IdString? BEND
|
||||||
|
|
||||||
|
/* floorPartitionItem
|
||||||
|
tooltip : 难度分歧项
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
default : ['MTx','']
|
||||||
|
IdString_1 = IdString_1 ? (', "'+IdString_1+'"') : '';
|
||||||
|
var code = '["'+IdString_0+'"'+IdString_1+'],\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
|
||||||
// equip 事件编辑器入口之一
|
// equip 事件编辑器入口之一
|
||||||
equip_m
|
equip_m
|
||||||
: '装备' '类型' EvalString '装备动画(第一个装备格有效)' IdString? BGNL? '数值提升项' equipList+ '百分比提升项' equipList+ BEND
|
: '装备' '类型' EvalString '装备动画(第一个装备格有效)' IdString? BGNL? '数值提升项' equipList+ '百分比提升项' equipList+ BEND
|
||||||
|
|||||||
@ -58,6 +58,14 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
}
|
}
|
||||||
return MotaActionBlocks['levelChoose_m'].xmlText([text_choices]);
|
return MotaActionBlocks['levelChoose_m'].xmlText([text_choices]);
|
||||||
|
|
||||||
|
case 'floorPartition':
|
||||||
|
if(!obj) obj=[];
|
||||||
|
var text_choices = null;
|
||||||
|
for(var ii=obj.length-1,choice;choice=obj[ii];ii--) {
|
||||||
|
text_choices=MotaActionBlocks['floorPartitionItem'].xmlText([obj[0], obj[1]||"", text_choices]);
|
||||||
|
}
|
||||||
|
return MotaActionBlocks['floorPartition_m'].xmlText([text_choices]);
|
||||||
|
|
||||||
case 'equip':
|
case 'equip':
|
||||||
if(!obj) obj={};
|
if(!obj) obj={};
|
||||||
var buildEquip = function (obj) {
|
var buildEquip = function (obj) {
|
||||||
|
|||||||
@ -65,6 +65,9 @@ editor_blocklyconfig=(function(){
|
|||||||
MotaActionBlocks['firstArrive_m'].xmlText(),
|
MotaActionBlocks['firstArrive_m'].xmlText(),
|
||||||
MotaActionBlocks['eachArrive_m'].xmlText(),
|
MotaActionBlocks['eachArrive_m'].xmlText(),
|
||||||
MotaActionBlocks['level_m'].xmlText(),
|
MotaActionBlocks['level_m'].xmlText(),
|
||||||
|
MotaActionFunctions.actionParser.parse([
|
||||||
|
['MTx', '']
|
||||||
|
], 'floorPartition'),
|
||||||
MotaActionBlocks['commonEvent_m'].xmlText(),
|
MotaActionBlocks['commonEvent_m'].xmlText(),
|
||||||
MotaActionBlocks['item_m'].xmlText(),
|
MotaActionBlocks['item_m'].xmlText(),
|
||||||
MotaActionFunctions.actionParser.parse([
|
MotaActionFunctions.actionParser.parse([
|
||||||
|
|||||||
@ -18,6 +18,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_docs": "楼层列表",
|
"_docs": "楼层列表",
|
||||||
"_data": "在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器、浏览地图和上/下楼器的顺序"
|
"_data": "在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器、浏览地图和上/下楼器的顺序"
|
||||||
},
|
},
|
||||||
|
"floorPartitions": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "event",
|
||||||
|
"_event": "floorPartition",
|
||||||
|
"_docs": "分区指定",
|
||||||
|
"_data": "可以在这里指定楼层分区;主要适用于不可返回的高层塔;进入新分区后将自动调用砍层插件以减少空间消耗;未在任何分区的楼层将被视为公共区域"
|
||||||
|
},
|
||||||
"images": {
|
"images": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "material",
|
"_type": "material",
|
||||||
|
|||||||
2
main.js
2
main.js
@ -236,7 +236,7 @@ main.prototype.init = function (mode, callback) {
|
|||||||
main.loadFloors(function() {
|
main.loadFloors(function() {
|
||||||
var coreData = {};
|
var coreData = {};
|
||||||
["dom", "statusBar", "canvas", "images", "tilesets", "materials",
|
["dom", "statusBar", "canvas", "images", "tilesets", "materials",
|
||||||
"animates", "bgms", "sounds", "floorIds", "floors"].forEach(function (t) {
|
"animates", "bgms", "sounds", "floorIds", "floors", "floorPartitions"].forEach(function (t) {
|
||||||
coreData[t] = main[t];
|
coreData[t] = main[t];
|
||||||
})
|
})
|
||||||
main.core.init(coreData, callback);
|
main.core.init(coreData, callback);
|
||||||
|
|||||||
@ -8,6 +8,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"sample3",
|
"sample3",
|
||||||
"MT0"
|
"MT0"
|
||||||
],
|
],
|
||||||
|
"floorPartitions": [],
|
||||||
"images": [
|
"images": [
|
||||||
"bg.jpg",
|
"bg.jpg",
|
||||||
"winskin.png",
|
"winskin.png",
|
||||||
@ -79,8 +80,18 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"statusLeftBackground": "url(project/materials/ground.png) repeat",
|
"statusLeftBackground": "url(project/materials/ground.png) repeat",
|
||||||
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||||
"toolsBackground": "url(project/materials/ground.png) repeat",
|
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||||
"borderColor": [204,204,204,1],
|
"borderColor": [
|
||||||
"statusBarColor": [255,255,255,1],
|
204,
|
||||||
|
204,
|
||||||
|
204,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"statusBarColor": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
"floorChangingStyle": "background-color: black; color: white",
|
"floorChangingStyle": "background-color: black; color: white",
|
||||||
"font": "Verdana"
|
"font": "Verdana"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,6 +110,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
// core.deleteAllCanvas();
|
// core.deleteAllCanvas();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 根据分区信息自动砍层与恢复
|
||||||
|
if (core.autoRemoveMaps) core.autoRemoveMaps(floorId);
|
||||||
|
|
||||||
// 重置画布尺寸
|
// 重置画布尺寸
|
||||||
core.maps.resizeMap(floorId);
|
core.maps.resizeMap(floorId);
|
||||||
// 设置勇士的位置
|
// 设置勇士的位置
|
||||||
|
|||||||
@ -252,10 +252,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
var fromIndex = core.floorIds.indexOf(fromId),
|
var fromIndex = core.floorIds.indexOf(fromId),
|
||||||
toIndex = core.floorIds.indexOf(toId);
|
toIndex = core.floorIds.indexOf(toId);
|
||||||
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
||||||
|
flags.__visited__ = flags.__visited__ || {};
|
||||||
flags.__removed__ = flags.__removed__ || [];
|
flags.__removed__ = flags.__removed__ || [];
|
||||||
flags.__disabled__ = flags.__disabled__ || [];
|
flags.__disabled__ = flags.__disabled__ || {};
|
||||||
for (var i = fromIndex; i <= toIndex; ++i) {
|
for (var i = fromIndex; i <= toIndex; ++i) {
|
||||||
var floorId = core.floorIds[i];
|
var floorId = core.floorIds[i];
|
||||||
|
if (core.status.maps[floorId].deleted) continue;
|
||||||
delete flags.__visited__[floorId];
|
delete flags.__visited__[floorId];
|
||||||
flags.__removed__.push(floorId);
|
flags.__removed__.push(floorId);
|
||||||
delete flags.__disabled__[floorId];
|
delete flags.__disabled__[floorId];
|
||||||
@ -276,12 +278,43 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
flags.__removed__ = flags.__removed__ || [];
|
flags.__removed__ = flags.__removed__ || [];
|
||||||
for (var i = fromIndex; i <= toIndex; ++i) {
|
for (var i = fromIndex; i <= toIndex; ++i) {
|
||||||
var floorId = core.floorIds[i];
|
var floorId = core.floorIds[i];
|
||||||
|
if (!core.status.maps[floorId].deleted) continue;
|
||||||
flags.__removed__ = flags.__removed__.filter(function (f) { return f != floorId; });
|
flags.__removed__ = flags.__removed__.filter(function (f) { return f != floorId; });
|
||||||
if (core.status.maps[floorId].deleted) {
|
core.status.maps[floorId] = core.loadFloor(floorId);
|
||||||
core.status.maps[floorId] = core.loadFloor(floorId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 分区砍层相关
|
||||||
|
var inAnyPartition = function (floorId) {
|
||||||
|
var inPartition = false;
|
||||||
|
(core.floorPartitions || []).forEach(function (floor) {
|
||||||
|
var fromIndex = core.floorIds.indexOf(floor[0]);
|
||||||
|
var toIndex = core.floorIds.indexOf(floor[1]);
|
||||||
|
var index = core.floorIds.indexOf(floorId);
|
||||||
|
if (fromIndex < 0 || index < 0) return;
|
||||||
|
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
||||||
|
if (index >= fromIndex && index <= toIndex) inPartition = true;
|
||||||
|
});
|
||||||
|
return inPartition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分区砍层
|
||||||
|
this.autoRemoveMaps = function (floorId) {
|
||||||
|
if (main.mode != 'play' || !inAnyPartition(floorId)) return;
|
||||||
|
// 根据分区信息自动砍层与恢复
|
||||||
|
(core.floorPartitions || []).forEach(function (floor) {
|
||||||
|
var fromIndex = core.floorIds.indexOf(floor[0]);
|
||||||
|
var toIndex = core.floorIds.indexOf(floor[1]);
|
||||||
|
var index = core.floorIds.indexOf(floorId);
|
||||||
|
if (fromIndex < 0 || index < 0) return;
|
||||||
|
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
||||||
|
if (index >= fromIndex && index <= toIndex) {
|
||||||
|
core.resumeMaps(core.floorIds[fromIndex], core.floorIds[toIndex]);
|
||||||
|
} else {
|
||||||
|
core.removeMaps(core.floorIds[fromIndex], core.floorIds[toIndex]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"fiveLayers": function () {
|
"fiveLayers": function () {
|
||||||
// 是否启用五图层(增加背景2层和前景2层) 将__enableFiveLayers置为true即会启用;启用后请保存后刷新编辑器
|
// 是否启用五图层(增加背景2层和前景2层) 将__enableFiveLayers置为true即会启用;启用后请保存后刷新编辑器
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user