commit
1c7e95239a
@ -581,8 +581,11 @@ editor_mode = function (editor) {
|
|||||||
editor_mode.appendPic.height = image.height;
|
editor_mode.appendPic.height = image.height;
|
||||||
|
|
||||||
if (selectAppend.value == 'autotile') {
|
if (selectAppend.value == 'autotile') {
|
||||||
sprite.style.width = (sprite.width = image.width) / ratio + 'px';
|
for (var ii = 0; ii < 3; ii++) {
|
||||||
sprite.style.height = (sprite.height = image.height) / ratio + 'px';
|
var newsprite = appendPicCanvas.children[ii];
|
||||||
|
newsprite.style.width = (newsprite.width = image.width) / ratio + 'px';
|
||||||
|
newsprite.style.height = (newsprite.height = image.height) / ratio + 'px';
|
||||||
|
}
|
||||||
sprite_ctx.clearRect(0, 0, sprite.width, sprite.height);
|
sprite_ctx.clearRect(0, 0, sprite.width, sprite.height);
|
||||||
sprite_ctx.drawImage(image, 0, 0);
|
sprite_ctx.drawImage(image, 0, 0);
|
||||||
}
|
}
|
||||||
@ -804,17 +807,12 @@ editor_mode = function (editor) {
|
|||||||
appendConfirm.onclick = function () {
|
appendConfirm.onclick = function () {
|
||||||
|
|
||||||
var confirmAutotile = function () {
|
var confirmAutotile = function () {
|
||||||
if (sprite.width != 96 || sprite.height != 128) {
|
var image = editor_mode.appendPic.img;
|
||||||
if (sprite.height==128 && sprite.width%96==0) {
|
if (image.width % 96 !=0 || image.height != 128) {
|
||||||
printe("这里只能导入单帧的自动元件,多帧的动画请先导入单帧自动元件再同名替换素材即可。");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printe("不合法的Autotile图片!");
|
printe("不合法的Autotile图片!");
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var imgData = source_ctx.getImageData(0,0,sprite.width,sprite.height);
|
var imgData = source_ctx.getImageData(0,0,image.width,image.height);
|
||||||
sprite_ctx.putImageData(imgData, 0, 0);
|
sprite_ctx.putImageData(imgData, 0, 0);
|
||||||
var imgbase64 = sprite.toDataURL().split(',')[1];
|
var imgbase64 = sprite.toDataURL().split(',')[1];
|
||||||
|
|
||||||
|
|||||||
@ -372,18 +372,10 @@ actions.prototype.onmove = function (loc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 当点击(触摸)事件放开时 //////
|
////// 当点击(触摸)事件放开时 //////
|
||||||
actions.prototype.onup = function (loc) {
|
actions.prototype.onup = function () {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
|
|
||||||
// 画板
|
|
||||||
if (core.status.played && (core.status.event||{}).id=='paint') {
|
|
||||||
this.onupPaint(loc.x, loc.y)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
|
||||||
|
|
||||||
clearTimeout(core.timeout.onDownTimeout);
|
clearTimeout(core.timeout.onDownTimeout);
|
||||||
core.timeout.onDownTimeout = null;
|
core.timeout.onDownTimeout = null;
|
||||||
clearInterval(core.interval.onDownInterval);
|
clearInterval(core.interval.onDownInterval);
|
||||||
@ -2452,18 +2444,7 @@ actions.prototype.onmovePaint = function (x, y) {
|
|||||||
core.status.event.data.y = y;
|
core.status.event.data.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.prototype.onupPaint = function (x,y) {
|
actions.prototype.onupPaint = function () {
|
||||||
x+=core.bigmap.offsetX;
|
|
||||||
y+=core.bigmap.offsetY;
|
|
||||||
if (core.status.event.data.erase) {
|
|
||||||
core.clearMap('route', x-5, y-5, 10, 10);
|
|
||||||
}
|
|
||||||
else if (core.status.event.data.x!=null) {
|
|
||||||
var midx = (core.status.event.data.x+x)/2, midy = (core.status.event.data.y+y)/2;
|
|
||||||
core.canvas.route.quadraticCurveTo(midx, midy, x, y);
|
|
||||||
core.canvas.route.stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
core.status.event.data.x = null;
|
core.status.event.data.x = null;
|
||||||
core.status.event.data.y = null;
|
core.status.event.data.y = null;
|
||||||
// 保存
|
// 保存
|
||||||
|
|||||||
@ -407,8 +407,8 @@ core.prototype.onmove = function (loc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 当点击(触摸)事件放开时 //////
|
////// 当点击(触摸)事件放开时 //////
|
||||||
core.prototype.onup = function (loc) {
|
core.prototype.onup = function () {
|
||||||
return core.actions.onup(loc);
|
return core.actions.onup();
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得点击事件相对左上角的坐标(0到12之间) //////
|
////// 获得点击事件相对左上角的坐标(0到12之间) //////
|
||||||
|
|||||||
@ -836,7 +836,7 @@ ui.prototype.drawSettings = function () {
|
|||||||
core.status.event.id = 'settings';
|
core.status.event.id = 'settings';
|
||||||
|
|
||||||
this.drawChoices(null, [
|
this.drawChoices(null, [
|
||||||
"系统设置", "快捷商店", "浏览地图", "打开画板", "同步存档", "返回标题", "数据统计", "操作帮助", "关于本塔", "返回游戏"
|
"系统设置", "快捷商店", "浏览地图", "绘图模式", "同步存档", "返回标题", "数据统计", "操作帮助", "关于本塔", "返回游戏"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
main.js
12
main.js
@ -344,12 +344,9 @@ main.dom.data.onmousemove = function (e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 鼠标放开时 //////
|
////// 鼠标放开时 //////
|
||||||
main.dom.data.onmouseup = function (e) {
|
main.dom.data.onmouseup = function () {
|
||||||
try {
|
try {
|
||||||
e.stopPropagation();
|
main.core.onup();
|
||||||
var loc = main.core.getClickLoc(e.clientX, e.clientY);
|
|
||||||
if (loc == null) return;
|
|
||||||
main.core.onup(loc);
|
|
||||||
}catch (e) {}
|
}catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,10 +383,7 @@ main.dom.data.ontouchmove = function (e) {
|
|||||||
////// 手指离开触摸屏时 //////
|
////// 手指离开触摸屏时 //////
|
||||||
main.dom.data.ontouchend = function () {
|
main.dom.data.ontouchend = function () {
|
||||||
try {
|
try {
|
||||||
e.preventDefault();
|
main.core.onup();
|
||||||
var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
|
|
||||||
if (loc == null) return;
|
|
||||||
main.core.onup(loc);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user