编辑器大地图模式
This commit is contained in:
parent
fbdf2d2a96
commit
25ab3d78b6
@ -800,6 +800,7 @@ editor.prototype.buildMark = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){
|
editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){
|
||||||
|
if (editor.uivalues.bigmap) return;
|
||||||
var pos={x: 0, y: 0, images: "terrains"};
|
var pos={x: 0, y: 0, images: "terrains"};
|
||||||
var ysize = 32;
|
var ysize = 32;
|
||||||
if(thisevent==0){
|
if(thisevent==0){
|
||||||
|
|||||||
@ -55,7 +55,7 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
* 双击地图可以选中素材
|
* 双击地图可以选中素材
|
||||||
*/
|
*/
|
||||||
editor.uifunctions.map_doubleClick = function (e) {
|
editor.uifunctions.map_doubleClick = function (e) {
|
||||||
if (editor.uivalues.bindSpecialDoor.loc != null) return;
|
if (editor.uivalues.bindSpecialDoor.loc != null || editor.uivalues.bigmap) return;
|
||||||
var loc = editor.uifunctions.eToLoc(e);
|
var loc = editor.uifunctions.eToLoc(e);
|
||||||
var pos = editor.uifunctions.locToPos(loc, true);
|
var pos = editor.uifunctions.locToPos(loc, true);
|
||||||
editor.setSelectBoxFromInfo(editor[editor.layerMod][pos.y][pos.x], true);
|
editor.setSelectBoxFromInfo(editor[editor.layerMod][pos.y][pos.x], true);
|
||||||
@ -93,8 +93,11 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
if (!selectBox.isSelected()) {
|
if (!selectBox.isSelected()) {
|
||||||
editor_mode.onmode('nextChange');
|
editor_mode.onmode('nextChange');
|
||||||
editor_mode.onmode('loc');
|
editor_mode.onmode('loc');
|
||||||
printi("大地图模式(F键)下可以很方便的切换到地图任意位置,但是不可对地图进行直接编辑。");
|
printi("大地图模式(F键)下,可以拖动、右键拉框与复制剪切粘贴;但不可进行绘图。");
|
||||||
editor.uivalues.startPos = pos;
|
editor.uivalues.startPos = pos;
|
||||||
|
editor.dom.euiCtx.strokeStyle = '#FF0000';
|
||||||
|
editor.dom.euiCtx.lineWidth = 2;
|
||||||
|
if (editor.isMobile) editor.uifunctions.showMidMenu(e.clientX, e.clientY);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -137,6 +140,15 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _getGridByPos = function (pos) {
|
||||||
|
if (editor.uivalues.bigmap) {
|
||||||
|
var info = editor.uivalues.bigmapInfo;
|
||||||
|
return {x: info.left + info.size * pos.x, y: info.top + info.size * pos.y, size: info.size};
|
||||||
|
} else {
|
||||||
|
return {x: 32 * pos.x - core.bigmap.offsetX, y: 32 * pos.y - core.bigmap.offsetY, size: 32};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* editor.dom.eui.onmousemove
|
* editor.dom.eui.onmousemove
|
||||||
* + 非绘图模式时维护起止位置并画箭头
|
* + 非绘图模式时维护起止位置并画箭头
|
||||||
@ -144,18 +156,20 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
*/
|
*/
|
||||||
editor.uifunctions.map_onmove = function (e) {
|
editor.uifunctions.map_onmove = function (e) {
|
||||||
editor.uivalues.lastMoveE=e;
|
editor.uivalues.lastMoveE=e;
|
||||||
if (editor.uivalues.bigmap) return false;
|
|
||||||
if (!selectBox.isSelected()) {
|
if (!selectBox.isSelected()) {
|
||||||
if (editor.uivalues.startPos == null) return;
|
if (editor.uivalues.startPos == null) return;
|
||||||
var loc = editor.uifunctions.eToLoc(e);
|
var loc = editor.uifunctions.eToLoc(e);
|
||||||
var pos = editor.uifunctions.locToPos(loc, true);
|
var pos = editor.uifunctions.locToPos(loc, true);
|
||||||
if (editor.uivalues.endPos != null && editor.uivalues.endPos.x == pos.x && editor.uivalues.endPos.y == pos.y) return;
|
if (editor.uivalues.endPos != null && editor.uivalues.endPos.x == pos.x && editor.uivalues.endPos.y == pos.y) return;
|
||||||
|
var startGrid = _getGridByPos(editor.uivalues.startPos), endGrid;
|
||||||
if (editor.uivalues.endPos != null) {
|
if (editor.uivalues.endPos != null) {
|
||||||
editor.dom.euiCtx.clearRect(Math.min(32 * editor.uivalues.startPos.x - core.bigmap.offsetX, 32 * editor.uivalues.endPos.x - core.bigmap.offsetX),
|
endGrid = _getGridByPos(editor.uivalues.endPos);
|
||||||
Math.min(32 * editor.uivalues.startPos.y - core.bigmap.offsetY, 32 * editor.uivalues.endPos.y - core.bigmap.offsetY),
|
editor.dom.euiCtx.clearRect(Math.min(startGrid.x, endGrid.x), Math.min(startGrid.y, endGrid.y),
|
||||||
(Math.abs(editor.uivalues.startPos.x - editor.uivalues.endPos.x) + 1) * 32, (Math.abs(editor.uivalues.startPos.y - editor.uivalues.endPos.y) + 1) * 32)
|
(Math.abs(editor.uivalues.startPos.x - editor.uivalues.endPos.x) + 1) * startGrid.size,
|
||||||
|
(Math.abs(editor.uivalues.startPos.y - editor.uivalues.endPos.y) + 1) * startGrid.size);
|
||||||
}
|
}
|
||||||
editor.uivalues.endPos = pos;
|
editor.uivalues.endPos = pos;
|
||||||
|
endGrid = _getGridByPos(editor.uivalues.endPos);
|
||||||
if (editor.uivalues.startPos != null) {
|
if (editor.uivalues.startPos != null) {
|
||||||
if (editor.uivalues.startPos.x != editor.uivalues.endPos.x || editor.uivalues.startPos.y != editor.uivalues.endPos.y) {
|
if (editor.uivalues.startPos.x != editor.uivalues.endPos.x || editor.uivalues.startPos.y != editor.uivalues.endPos.y) {
|
||||||
if (e.buttons == 2) {
|
if (e.buttons == 2) {
|
||||||
@ -169,13 +183,11 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
// draw rect
|
// draw rect
|
||||||
editor.dom.euiCtx.clearRect(0, 0, editor.dom.euiCtx.canvas.width, editor.dom.euiCtx.canvas.height);
|
editor.dom.euiCtx.clearRect(0, 0, editor.dom.euiCtx.canvas.width, editor.dom.euiCtx.canvas.height);
|
||||||
editor.dom.euiCtx.fillStyle = 'rgba(0, 127, 255, 0.4)';
|
editor.dom.euiCtx.fillStyle = 'rgba(0, 127, 255, 0.4)';
|
||||||
editor.dom.euiCtx.fillRect(32 * x0 - core.bigmap.offsetX, 32 * y0 - core.bigmap.offsetY,
|
var grid = _getGridByPos({x: x0, y: y0});
|
||||||
32 * (x1 - x0) + 32, 32 * (y1 - y0) + 32);
|
editor.dom.euiCtx.fillRect(grid.x, grid.y, grid.size * (x1 - x0 + 1), grid.size * (y1 - y0 + 1));
|
||||||
}else{
|
}else{
|
||||||
// 左键拖拽: 画箭头
|
// 左键拖拽: 画箭头
|
||||||
core.drawArrow('eui',
|
core.drawArrow('eui', startGrid.x + startGrid.size / 2, startGrid.y + startGrid.size / 2, endGrid.x + endGrid.size / 2, endGrid.y + endGrid.size / 2);
|
||||||
32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY,
|
|
||||||
32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,6 +196,7 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
//editor_mode.loc();
|
//editor_mode.loc();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (editor.uivalues.bigmap) return false;
|
||||||
|
|
||||||
if (editor.uivalues.holdingPath == 0) {
|
if (editor.uivalues.holdingPath == 0) {
|
||||||
return false;
|
return false;
|
||||||
@ -232,7 +245,6 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
editor.uivalues.selectedArea = null;
|
editor.uivalues.selectedArea = null;
|
||||||
ee.preventDefault();
|
ee.preventDefault();
|
||||||
ee.stopPropagation();
|
ee.stopPropagation();
|
||||||
if (editor.uivalues.bigmap) return false;
|
|
||||||
var e=editor.uivalues.lastMoveE;
|
var e=editor.uivalues.lastMoveE;
|
||||||
if (e.buttons == 2 && (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y))) {
|
if (e.buttons == 2 && (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y))) {
|
||||||
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
|
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
|
||||||
@ -258,6 +270,7 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
editor.uivalues.startPos = editor.uivalues.endPos = null;
|
editor.uivalues.startPos = editor.uivalues.endPos = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (editor.uivalues.bigmap) return false;
|
||||||
editor.uivalues.holdingPath = 0;
|
editor.uivalues.holdingPath = 0;
|
||||||
if (editor.uivalues.stepPostfix && editor.uivalues.stepPostfix.length) {
|
if (editor.uivalues.stepPostfix && editor.uivalues.stepPostfix.length) {
|
||||||
editor.savePreMap();
|
editor.savePreMap();
|
||||||
@ -796,10 +809,15 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editor.uifunctions.triggerBigmap = function () {
|
editor.uifunctions.triggerBigmap = function () {
|
||||||
|
if (selectBox.isSelected()) {
|
||||||
|
printe("请先点击【保存地图】以退出绘图模式");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
editor.uivalues.bigmap = !editor.uivalues.bigmap;
|
editor.uivalues.bigmap = !editor.uivalues.bigmap;
|
||||||
if (editor.uivalues.bigmap) {
|
if (editor.uivalues.bigmap) {
|
||||||
editor.dom.bigmapBtn.classList.add('highlight');
|
editor.dom.bigmapBtn.classList.add('highlight');
|
||||||
printi("大地图模式(F键)下可以很方便的切换到地图任意位置,但是不可对地图进行直接编辑。");
|
printi("大地图模式(F键)下,可以拖动与复制剪切粘贴;但不可拉框、绘图或呼出右键菜单。");
|
||||||
} else {
|
} else {
|
||||||
editor.dom.bigmapBtn.classList.remove('highlight');
|
editor.dom.bigmapBtn.classList.remove('highlight');
|
||||||
editor.setViewport(32 * (editor.pos.x - core.__HALF_SIZE__), 32 * (editor.pos.y - core.__HALF_SIZE__));
|
editor.setViewport(32 * (editor.pos.x - core.__HALF_SIZE__), 32 * (editor.pos.y - core.__HALF_SIZE__));
|
||||||
|
|||||||
@ -66,6 +66,7 @@ editor_materialpanel_wrapper = function (editor) {
|
|||||||
editor.uifunctions.material_ondown = function (e) {
|
editor.uifunctions.material_ondown = function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (editor.uivalues.bigmap) return;
|
||||||
editor.uivalues.lastMoveMaterE=e;
|
editor.uivalues.lastMoveMaterE=e;
|
||||||
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
|
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
|
||||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||||
@ -86,6 +87,7 @@ editor_materialpanel_wrapper = function (editor) {
|
|||||||
editor.uifunctions.material_onmove = function (e) {
|
editor.uifunctions.material_onmove = function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (editor.uivalues.bigmap) return;
|
||||||
editor.uivalues.lastMoveMaterE=e;
|
editor.uivalues.lastMoveMaterE=e;
|
||||||
if (!editor.uivalues.startLoc) return;
|
if (!editor.uivalues.startLoc) return;
|
||||||
var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc);
|
var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc);
|
||||||
@ -104,6 +106,7 @@ editor_materialpanel_wrapper = function (editor) {
|
|||||||
editor.uifunctions.material_onup = function (ee) {
|
editor.uifunctions.material_onup = function (ee) {
|
||||||
var startLoc = editor.uivalues.startLoc;
|
var startLoc = editor.uivalues.startLoc;
|
||||||
editor.uivalues.startLoc = null;
|
editor.uivalues.startLoc = null;
|
||||||
|
if (editor.uivalues.bigmap) return;
|
||||||
|
|
||||||
var e=editor.uivalues.lastMoveMaterE;
|
var e=editor.uivalues.lastMoveMaterE;
|
||||||
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
|
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
|
||||||
|
|||||||
@ -179,7 +179,8 @@ editor_ui_wrapper = function (editor) {
|
|||||||
|
|
||||||
var focusElement = document.activeElement;
|
var focusElement = document.activeElement;
|
||||||
if (!focusElement || focusElement.tagName.toLowerCase() == 'body'
|
if (!focusElement || focusElement.tagName.toLowerCase() == 'body'
|
||||||
|| focusElement.id == 'selectFloor') {
|
|| focusElement.id == 'selectFloor' || focusElement.id == 'bigmapBtn'
|
||||||
|
|| focusElement.id.startsWith('layerMod')) {
|
||||||
|
|
||||||
//Ctrl+z 撤销上一步undo
|
//Ctrl+z 撤销上一步undo
|
||||||
if (e.keyCode == 90 && e.ctrlKey) {
|
if (e.keyCode == 90 && e.ctrlKey) {
|
||||||
|
|||||||
6
main.js
6
main.js
@ -2,7 +2,7 @@ function main() {
|
|||||||
|
|
||||||
//------------------------ 用户修改内容 ------------------------//
|
//------------------------ 用户修改内容 ------------------------//
|
||||||
|
|
||||||
this.version = "2.7"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
this.version = "2.7.1"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
||||||
|
|
||||||
this.useCompress = false; // 是否使用压缩文件
|
this.useCompress = false; // 是否使用压缩文件
|
||||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||||
@ -186,8 +186,8 @@ function main() {
|
|||||||
this.floors = {}
|
this.floors = {}
|
||||||
this.canvas = {};
|
this.canvas = {};
|
||||||
|
|
||||||
this.__VERSION__ = "2.7";
|
this.__VERSION__ = "2.7.1";
|
||||||
this.__VERSION_CODE__ = 139;
|
this.__VERSION_CODE__ = 153;
|
||||||
}
|
}
|
||||||
|
|
||||||
main.prototype.init = function (mode, callback) {
|
main.prototype.init = function (mode, callback) {
|
||||||
|
|||||||
@ -99,7 +99,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"firstData": {
|
"firstData": {
|
||||||
"title": "魔塔样板",
|
"title": "魔塔样板",
|
||||||
"name": "template",
|
"name": "template",
|
||||||
"version": "Ver 2.7",
|
"version": "Ver 2.7.1",
|
||||||
"floorId": "sample0",
|
"floorId": "sample0",
|
||||||
"hero": {
|
"hero": {
|
||||||
"image": "hero.png",
|
"image": "hero.png",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user