额外素材拖框绘制

This commit is contained in:
ckcz123 2020-05-19 21:56:25 +08:00
parent 0bfef141c7
commit dc5ff0e309
5 changed files with 30 additions and 11 deletions

View File

@ -105,7 +105,7 @@ function editor() {
// tile // tile
tileSize: [1,1], tileSize: [1,1],
startLoc: {"x":0,"y":0}, startLoc: null,
lockMode: false, lockMode: false,
// 最近使用的图块 // 最近使用的图块

View File

@ -655,9 +655,9 @@ editor_mappanel_wrapper = function (editor) {
* 切换画笔模式 * 切换画笔模式
*/ */
editor.uifunctions.brushMod3_onchange = function () { editor.uifunctions.brushMod3_onchange = function () {
if (!editor.config.get('alertTileMode') && if (!editor.config.get('alertTileModeV2.7') &&
!confirm("从V2.6.6开始tileset贴图模式已被废弃。\n请右键额外素材并输入所需要绘制的宽高然后单击地图以绘制一个区域。\n\n点取消将不再显示此提示。")) { !confirm("从V2.7开始请直接素材区拖框进行绘制区域。\n\n点取消将不再显示此提示。")) {
editor.config.set('alertTileMode', true); editor.config.set('alertTileModeV2.7', true);
} }
// tip.showHelp(5) // tip.showHelp(5)
tip.isSelectedBlock(false) tip.isSelectedBlock(false)

View File

@ -77,6 +77,8 @@ editor_materialpanel_wrapper = function (editor) {
editor.uivalues.startLoc={ editor.uivalues.startLoc={
'x': scrollLeft + e.clientX + editor.dom.iconLib.scrollLeft - right.offsetLeft - editor.dom.iconLib.offsetLeft, 'x': scrollLeft + e.clientX + editor.dom.iconLib.scrollLeft - right.offsetLeft - editor.dom.iconLib.offsetLeft,
'y': scrollTop + e.clientY + editor.dom.iconLib.scrollTop - right.offsetTop - editor.dom.iconLib.offsetTop, 'y': scrollTop + e.clientY + editor.dom.iconLib.scrollTop - right.offsetTop - editor.dom.iconLib.offsetTop,
'px': e.clientX,
'py': e.clientY,
'size': 32 'size': 32
}; };
} }
@ -89,6 +91,14 @@ editor_materialpanel_wrapper = function (editor) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
lastmoveE=e; lastmoveE=e;
if (!editor.uivalues.startLoc) return;
var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc);
editor.dom.dataSelection.style.left = 32 * pos0.x + 'px';
editor.dom.dataSelection.style.top = 32 * pos0.y + 'px';
editor.dom.dataSelection.style.width = e.clientX - editor.uivalues.startLoc.px + 'px';
editor.dom.dataSelection.style.height = e.clientY - editor.uivalues.startLoc.py + 'px';
editor.dom.dataSelection.style.display = 'block';
} }
/** /**
@ -96,6 +106,9 @@ editor_materialpanel_wrapper = function (editor) {
* 素材区的单击/拖拽事件 * 素材区的单击/拖拽事件
*/ */
editor.uifunctions.material_onup = function (ee) { editor.uifunctions.material_onup = function (ee) {
var startLoc = editor.uivalues.startLoc;
editor.uivalues.startLoc = null;
var e=lastmoveE; var e=lastmoveE;
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;
@ -107,7 +120,7 @@ editor_materialpanel_wrapper = function (editor) {
}; };
editor.loc = loc; editor.loc = loc;
editor.uivalues.tileSize = [1,1]; editor.uivalues.tileSize = [1,1];
var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc); var pos0 = editor.uifunctions.locToPos(startLoc);
var pos = editor.uifunctions.locToPos(loc); var pos = editor.uifunctions.locToPos(loc);
for (var spriter in editor.widthsX) { for (var spriter in editor.widthsX) {
if (pos.x >= editor.widthsX[spriter][1] && pos.x < editor.widthsX[spriter][2]) { if (pos.x >= editor.widthsX[spriter][1] && pos.x < editor.widthsX[spriter][2]) {
@ -178,6 +191,9 @@ editor_materialpanel_wrapper = function (editor) {
} }
if (editor.info.isTile && e.button == 2) { //这段改一改之类的应该能给手机用,就不删了 if (editor.info.isTile && e.button == 2) { //这段改一改之类的应该能给手机用,就不删了
// 废弃好了
alert('V2.7后右键已被废弃,请直接素材区拖框选中区域。');
/*
var v = prompt("请输入该额外素材区域绑定宽高,以逗号分隔", "1,1"); var v = prompt("请输入该额外素材区域绑定宽高,以逗号分隔", "1,1");
if (v != null && /^\d+,\d+$/.test(v)) { if (v != null && /^\d+,\d+$/.test(v)) {
v = v.split(","); v = v.split(",");
@ -193,6 +209,7 @@ editor_materialpanel_wrapper = function (editor) {
editor.dom.dataSelection.style.width = 32*x - 6 + 'px'; editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
} }
} }
*/
} }
if (editor.info.isTile && e.button != 2) { //左键拖拽框选 if (editor.info.isTile && e.button != 2) { //左键拖拽框选
@ -203,7 +220,7 @@ editor_materialpanel_wrapper = function (editor) {
} else { } else {
editor.info = editor.ids[idindex-(x-1)-(y-1)*(widthX[2]-widthX[1])]; editor.info = editor.ids[idindex-(x-1)-(y-1)*(widthX[2]-widthX[1])];
editor.uifunctions.locToPos(editor.uivalues.startLoc); //重置editor.pos editor.uifunctions.locToPos(startLoc); //重置editor.pos
editor.uivalues.tileSize = [x, y]; editor.uivalues.tileSize = [x, y];
editor.dom.dataSelection.style.left = pos0.x * 32 + 'px'; editor.dom.dataSelection.style.left = pos0.x * 32 + 'px';
editor.dom.dataSelection.style.top = pos0.y * ysize + 'px'; editor.dom.dataSelection.style.top = pos0.y * ysize + 'px';

View File

@ -292,9 +292,11 @@ core.prototype._init_sys_flags = function () {
// 行走速度 // 行走速度
core.values.moveSpeed = core.getLocalStorage('moveSpeed', 100); core.values.moveSpeed = core.getLocalStorage('moveSpeed', 100);
core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', 500); core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', 500);
core.domStyle.scale = core.getLocalStorage('scale', 1); if (main.mode != 'editor') {
if (core.domStyle.scale != 1) { core.domStyle.scale = core.getLocalStorage('scale', 1);
core.resize(); if (core.domStyle.scale != 1) {
core.resize();
}
} }
} }

View File

@ -44,12 +44,12 @@
(已完成!) 重构全局商店! (已完成!) 重构全局商店!
(已完成!) 读档时色调数据丢失 (已完成!) 读档时色调数据丢失
(已完成!) 圆角边框 (已完成!) 圆角边框
像素高分辨率问题 (不处理) 像素高分辨率问题
(已完成!) 道具效果优化,删除部分道具相关的开关 (已完成!) 道具效果优化,删除部分道具相关的开关
(已完成!) 素材列表选择 (已完成!) 素材列表选择
(已完成!) 油漆桶,动态更改地图大小 (已完成!) 油漆桶,动态更改地图大小
地图拉框选择复制剪切删除 地图拉框选择复制剪切删除
额外素材区拖动选择一个区域 (已完成!) 额外素材区拖动选择一个区域
(已完成!) 素材替换 (已完成!) 素材替换
(已完成!) 大屏幕下放大游戏界面 (已完成!) 大屏幕下放大游戏界面
(已完成!) 最近使用/最常使用的图块 (已完成!) 最近使用/最常使用的图块