setStartPoint

This commit is contained in:
ckcz123 2019-10-22 11:56:29 +08:00
parent 46f0aa7e0e
commit f0bdd3e026
6 changed files with 57 additions and 18 deletions

View File

@ -15,7 +15,7 @@ function editor() {
dataSelection : document.getElementById('dataSelection'),
iconLib:document.getElementById('iconLib'),
midMenu:document.getElementById('midMenu'),
addFloorEvent :document.getElementById('addFloorEvent'),
extraEvent: document.getElementById('extraEvent'),
chooseThis : document.getElementById('chooseThis'),
chooseInRight : document.getElementById('chooseInRight'),
copyLoc : document.getElementById('copyLoc'),

View File

@ -25,7 +25,7 @@ editor_listen_wrapper = function (editor) {
editor.dom.iconLib.onmousedown = editor.uifunctions.material_ondown
editor.dom.addFloorEvent.onmousedown = editor.addFloorEvent_click
editor.dom.extraEvent.onmousedown = editor.uifunctions.extraEvent_click
editor.dom.chooseThis.onmousedown = editor.uifunctions.chooseThis_click
editor.dom.chooseInRight.onmousedown = editor.uifunctions.chooseInRight_click
editor.dom.copyLoc.onmousedown = editor.uifunctions.copyLoc_click

View File

@ -271,19 +271,27 @@ editor_mappanel_wrapper = function (editor) {
// 检测是否是上下楼
var thisevent = editor.map[editor.pos.y][editor.pos.x];
if (thisevent.id == 'upFloor') {
editor.dom.addFloorEvent.style.display = 'block';
editor.dom.addFloorEvent.children[0].innerHTML = '绑定上楼事件';
if (thisevent == 0) {
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定出生点为此点';
}
else if (thisevent.id == 'upFloor') {
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定上楼事件';
}
else if (thisevent.id == 'downFloor') {
editor.dom.addFloorEvent.style.display = 'block';
editor.dom.addFloorEvent.children[0].innerHTML = '绑定下楼事件';
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定下楼事件';
}
else if (['leftPortal', 'rightPortal', 'downPortal', 'upPortal'].indexOf(thisevent.id) >= 0) {
editor.dom.addFloorEvent.style.display = 'block';
editor.dom.addFloorEvent.children[0].innerHTML = '绑定楼传事件';
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定楼传事件';
}
else editor.dom.addFloorEvent.style.display = 'none';
else if (thisevent.id == 'specialDoor') {
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定机关门事件';
}
else editor.dom.extraEvent.style.display = 'none';
editor.dom.chooseThis.children[0].innerHTML = '选中此点' + '(' + editor.pos.x + ',' + editor.pos.y + ')'
editor.dom.copyLoc.children[0].innerHTML = '复制事件' + locStr + '到此处';
@ -305,13 +313,38 @@ editor_mappanel_wrapper = function (editor) {
}
/**
* editor.dom.addFloorEvent.onmousedown
* 菜单 添加上下楼事件
* editor.dom.extraEvent.onmousedown
* 菜单 附加点操作
*/
editor.addFloorEvent_click = function (e) {
editor.uifunctions.extraEvent_click = function (e) {
editor.uifunctions.hideMidMenu();
e.stopPropagation();
var thisevent = editor.map[editor.pos.y][editor.pos.x];
return this._extraEvent_bindStartPoint(thisevent) || this._extraEvent_bindStair(thisevent)
|| this._extraEvent_bindSpecialDoor(thisevent);
}
editor.uifunctions._extraEvent_bindStartPoint = function (thisevent) {
if (thisevent != 0) return false;
editor.file.editTower([
["change", "['firstData']['floorId']", editor.currentFloorId],
["change", "['firstData']['hero']['loc']['x']", editor.pos.x],
["change", "['firstData']['hero']['loc']['y']", editor.pos.y]
], function (objs_) {//console.log(objs_);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
editor.drawPosSelection();
editor_mode.showMode('tower');
printf('绑定初始点成功');
});
}
editor.uifunctions._extraEvent_bindStair = function (thisevent) {
if (['upFloor', 'downFloor', 'leftPortal', 'rightPortal', 'upPortal', 'downPortal'].indexOf(thisevent.id) < 0)
return false;
var loc = editor.pos.x + "," + editor.pos.y;
if (thisevent.id == 'upFloor') {
editor.currentFloorData.changeFloor[loc] = { "floorId": ":next", "stair": "downFloor" };
@ -334,6 +367,11 @@ editor_mappanel_wrapper = function (editor) {
editor_mode.showMode('loc');
printf('添加楼梯事件成功');
});
return true;
}
editor.uifunctions._extraEvent_bindSpecialDoor = function (thisevent) {
}
/**

View File

@ -337,7 +337,7 @@
</span>
<div id="menuDiv">
<div id="midMenu" style="display:none">
<div id='addFloorEvent' class="menuitem" style="display:none"><div class="menuitem-content">添加上下楼事件</div></div>
<div id='extraEvent' class='menuitem' style="display:none"><div class="menuitem-content"></div></div>
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>

View File

@ -358,7 +358,7 @@
</div>
<div id="menuDiv">
<div id="midMenu" style="display:none">
<div id='addFloorEvent' class="menuitem" style="display:none"><div class="menuitem-content">添加上下楼事件</div></div>
<div id='extraEvent' class='menuitem' style="display:none"><div class="menuitem-content"></div></div>
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>

View File

@ -136,8 +136,8 @@ dynamicMapEditor.prototype.onItemClick = function(index) {
var item = this.items[startIndex + index];
if(!item) return;
if(index == this.selectedIndex) {
var enemy = core.material.enemys[item.id];
if (!enemy) {
if (core.material.enemys[item.id]) {
var enemy = core.material.enemys[item.id];
var nowData = [enemy.hp, enemy.atk, enemy.def, enemy.special].join(';');
core.myprompt("请输入新怪物属性\n血;攻;防;能力,以分号分隔", nowData, function (result) {
if (result) {
@ -169,7 +169,8 @@ dynamicMapEditor.prototype.onItemClick = function(index) {
return;
}
core.drawTip('无效的输入数据');
})
});
return;
}
} else {
this.selectedIndex = index;