copy enemyitem & foldColNum & fix bug
This commit is contained in:
parent
34e4635167
commit
cc80dd450d
@ -82,6 +82,12 @@ function editor() {
|
||||
loc: null,
|
||||
n: -1,
|
||||
enemys: []
|
||||
},
|
||||
|
||||
// 复制怪物或道具属性
|
||||
copyEnemyItem : {
|
||||
type: null,
|
||||
data: {}
|
||||
}
|
||||
|
||||
};
|
||||
@ -402,7 +408,7 @@ editor.prototype.drawInitData = function (icons) {
|
||||
editor.widthsX = {};
|
||||
editor.uivalues.folded = core.getLocalStorage('folded', false);
|
||||
// editor.uivalues.folded = true;
|
||||
editor.uivalues.foldPerCol = 50;
|
||||
editor.uivalues.foldPerCol = core.getLocalStorage('foldPerCol', 50);
|
||||
// var imgNames = Object.keys(images); //还是固定顺序吧;
|
||||
var imgNames = ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48", "autotile"];
|
||||
|
||||
|
||||
@ -210,7 +210,57 @@ editor_datapanel_wrapper = function (editor) {
|
||||
}
|
||||
}
|
||||
|
||||
editor.uifunctions.copyPasteEnemyItem_func = function () {
|
||||
var copyEnemyItem = document.getElementById('copyEnemyItem');
|
||||
var pasteEnemyItem = document.getElementById('pasteEnemyItem');
|
||||
|
||||
copyEnemyItem.onclick = function () {
|
||||
var cls = (editor_mode.info || {}).images;
|
||||
if (editor_mode.mode != 'enemyitem' || (cls != 'enemys' && cls != 'enemy48' && cls != 'items')) return;
|
||||
editor.uivalues.copyEnemyItem.type = cls;
|
||||
var id = editor_mode.info.id;
|
||||
if (cls == 'enemys' || cls == 'enemy48') {
|
||||
editor.uivalues.copyEnemyItem.data = core.clone(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80[id]);
|
||||
printf("怪物属性复制成功");
|
||||
} else {
|
||||
editor.uivalues.copyEnemyItem.data = {};
|
||||
for (var x in items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a) {
|
||||
if (items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[x][id] != null) {
|
||||
editor.uivalues.copyEnemyItem.data[x] = core.clone(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[x][id]);
|
||||
}
|
||||
}
|
||||
printf("道具属性复制成功");
|
||||
}
|
||||
}
|
||||
|
||||
pasteEnemyItem.onclick = function () {
|
||||
var cls = (editor_mode.info || {}).images;
|
||||
if (editor_mode.mode != 'enemyitem' || !cls || cls != editor.uivalues.copyEnemyItem.type) return;
|
||||
var id = editor_mode.info.id;
|
||||
if (cls == 'enemys' || cls == 'enemy48') {
|
||||
if (confirm("你确定要覆盖此怪物的全部属性么?这是个不可逆操作!")) {
|
||||
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80[id] = core.clone(editor.uivalues.copyEnemyItem.data);
|
||||
editor.file.saveSetting('enemys', [], function (err) {
|
||||
if (err) printe(err);
|
||||
else printf("怪物属性粘贴成功\n请再重新选中该怪物方可查看更新后的表格。");
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (confirm("你确定要覆盖此道具的全部属性么?这是个不可逆操作!")) {
|
||||
for (var x in editor.uivalues.copyEnemyItem.data) {
|
||||
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[x][id] = core.clone(editor.uivalues.copyEnemyItem.data[x]);
|
||||
}
|
||||
editor.file.saveSetting('items', [], function (err) {
|
||||
if (err) printe(err);
|
||||
else printf("道具属性粘贴成功\n请再重新选中该道具方可查看更新后的表格。");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -897,6 +897,8 @@ editor_file = function (editor, callback) {
|
||||
callback('出错了,要设置的文件名不识别');
|
||||
}
|
||||
|
||||
editor.file.saveSetting = saveSetting;
|
||||
|
||||
return editor_file;
|
||||
}
|
||||
//editor_file = editor_file(editor);
|
||||
@ -133,6 +133,7 @@ editor_listen_wrapper = function (editor) {
|
||||
|
||||
editor.uifunctions.newIdIdnum_func()
|
||||
editor.uifunctions.changeId_func()
|
||||
editor.uifunctions.copyPasteEnemyItem_func();
|
||||
|
||||
editor.uifunctions.selectFloor_func()
|
||||
editor.uifunctions.saveFloor_func()
|
||||
|
||||
@ -29,11 +29,19 @@ editor_materialpanel_wrapper = function (editor) {
|
||||
* editor.dom.iconExpandBtn.onclick
|
||||
*/
|
||||
editor.uifunctions.fold_material_click = function () {
|
||||
if (confirm(editor.uivalues.folded ? "你想要展开素材吗?\n展开模式下将显示全素材内容。"
|
||||
: ("你想要折叠素材吗?\n折叠模式下每个素材将仅显示单列,并且每" + editor.uivalues.foldPerCol + "个自动换列。"))) {
|
||||
core.setLocalStorage('folded', !editor.uivalues.folded);
|
||||
if (editor.uivalues.folded) {
|
||||
if (confirm("你想要展开素材吗?\n展开模式下将显示全素材内容。")) {
|
||||
core.setLocalStorage('folded', false);
|
||||
window.location.reload();
|
||||
}
|
||||
} else {
|
||||
var perCol = parseInt(prompt("请输入折叠素材模式下每列的个数:", "50")) || 0;
|
||||
if (perCol > 0) {
|
||||
core.setLocalStorage('foldPerCol', perCol);
|
||||
core.setLocalStorage('folded', true);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -143,7 +143,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==null || thiseval instanceof Array || (thiseval==~~thiseval && thiseval>=0)",
|
||||
"_data": "特殊属性\n\n0:无,1:先攻,2:魔攻,3:坚固,4:2连击,\n5:3连击,6:n连击,7:破甲,8:反击,9:净化,\n10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,\n15:领域,16:夹击,17:仇恨,18:阻击,19:自爆,\n20:无敌,21:退化,22:固伤,23:重生,24:激光,25:光环\n\n多个属性例如用[1,4,11]表示先攻2连击吸血"
|
||||
"_data": "特殊属性\n\n0:无,1:先攻,2:魔攻,3:坚固,4:2连击,\n5:3连击,6:n连击,7:破甲,8:反击,9:净化,\n10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,\n15:领域,16:夹击,17:仇恨,18:阻击,19:自爆,\n20:无敌,21:退化,22:固伤,23:重生,24:激光,25:光环\n26:支援,27:捕捉\n多个属性例如用[1,4,11]表示先攻2连击吸血"
|
||||
},
|
||||
"value": {
|
||||
"_leaf": true,
|
||||
|
||||
@ -131,6 +131,10 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="margin-top: -10px; margin-bottom: 10px">
|
||||
<button id="copyEnemyItem">复制属性</button>
|
||||
<button id="pasteEnemyItem">粘贴属性</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id='newIdIdnum'><!-- id and idnum -->
|
||||
<input placeholder="新id(唯一标识符)"/>
|
||||
|
||||
@ -976,13 +976,13 @@ events.prototype.recoverEvents = function (data) {
|
||||
////// 检测自动事件 //////
|
||||
events.prototype.checkAutoEvents = function () {
|
||||
// 只有在无操作或事件流中才能执行自动事件!
|
||||
if (!core.isPlaying() || core.status.lockControl && core.status.event.id != 'action') return;
|
||||
if (!core.isPlaying() || (core.status.lockControl && core.status.event.id != 'action')) return;
|
||||
var todo = [], delay = [];
|
||||
core.status.autoEvents.forEach(function (autoEvent) {
|
||||
var symbol = autoEvent.symbol, x = autoEvent.x, y = autoEvent.y, floorId = autoEvent.floorId;
|
||||
// 不在当前楼层 or 已经执行过 or 正在执行中
|
||||
if (autoEvent.currentFloor && floorId != core.status.floorId) return;
|
||||
if (!autoEvent.multiExecute && autoEvent.executed) return;
|
||||
if (!autoEvent.multiExecute && core.autoEventExecuted(symbol)) return;
|
||||
if (core.autoEventExecuting(symbol)) return;
|
||||
var prefix = floorId + "@" + x + "@" + y;
|
||||
try {
|
||||
@ -992,7 +992,7 @@ events.prototype.checkAutoEvents = function () {
|
||||
}
|
||||
|
||||
core.autoEventExecuting(symbol, true);
|
||||
autoEvent.executed = true;
|
||||
core.autoEventExecuted(symbol, true);
|
||||
|
||||
var event = [
|
||||
{"type": "function", "function":
|
||||
@ -1022,7 +1022,13 @@ events.prototype.checkAutoEvents = function () {
|
||||
|
||||
events.prototype.autoEventExecuting = function (symbol, value) {
|
||||
var name = '_executing_autoEvent_' + symbol;
|
||||
if (value == null) return core.getFlag(name, false);
|
||||
if (value == null) return core.hasFlag(name);
|
||||
else core.setFlag(name, value || null);
|
||||
}
|
||||
|
||||
events.prototype.autoEventExecuted = function (symbol, value) {
|
||||
var name = '_executed_autoEvent_' + symbol;
|
||||
if (value == null) return core.hasFlag(name);
|
||||
else core.setFlag(name, value || null);
|
||||
}
|
||||
|
||||
|
||||
@ -369,7 +369,7 @@ maps.prototype._getBgFgMapArray = function (name, floorId, noCache) {
|
||||
return core.status[name + "maps"][floorId];
|
||||
|
||||
var arr = core.clone(core.floors[floorId][name + "map"] || []);
|
||||
if (main.mode == 'editor' && !(uievent && uievent.isOpen))
|
||||
if (main.mode == 'editor' && !(window.editor && editor.uievent && editor.uievent.isOpen))
|
||||
arr = core.clone(editor[name + "map"]) || arr;
|
||||
for (var x = 0; x < width; x++) {
|
||||
for (var y = 0; y < height; y++) {
|
||||
|
||||
@ -39,22 +39,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"redPotion": {
|
||||
"cls": "items",
|
||||
"name": "红血瓶",
|
||||
"text": "',生命+'+core.values.redPotion"
|
||||
"text": "',生命+${core.values.redPotion}'"
|
||||
},
|
||||
"bluePotion": {
|
||||
"cls": "items",
|
||||
"name": "蓝血瓶",
|
||||
"text": "',生命+'+core.values.bluePotion"
|
||||
"text": "',生命+${core.values.bluePotion}'"
|
||||
},
|
||||
"yellowPotion": {
|
||||
"cls": "items",
|
||||
"name": "黄血瓶",
|
||||
"text": "'生命+'+core.values.yellowPotion"
|
||||
"text": "',生命+${core.values.yellowPotion'}"
|
||||
},
|
||||
"greenPotion": {
|
||||
"cls": "items",
|
||||
"name": "绿血瓶",
|
||||
"text": "',生命+'+core.values.greenPotion"
|
||||
"text": "',生命+${core.values.greenPotion}'"
|
||||
},
|
||||
"sword0": {
|
||||
"cls": "items",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user