Merge branch 'v2.x' of github.com:ckcz123/mota-js into v2.x
This commit is contained in:
commit
dcf8e06246
@ -1998,7 +1998,7 @@ getToolboxItems: fn(cls: string) -> [string]
|
||||
loadCanvas: fn(name: string|CanvasRenderingContext2D)
|
||||
加载某个canvas状态
|
||||
|
||||
relocateCanvas: fn(name: string, x: number, y: number)
|
||||
relocateCanvas: fn(name: string, x: number, y: number, useDelta: bool)
|
||||
重新定位一个自定义画布
|
||||
|
||||
resizeCanvas: fn(name: string, x: number, y: number)
|
||||
|
||||
@ -3520,7 +3520,7 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
||||
},
|
||||
"relocateCanvas": {
|
||||
"!doc": "重新定位一个自定义画布",
|
||||
"!type": "fn(name: string, x: number, y: number)"
|
||||
"!type": "fn(name: string, x: number, y: number, useDelta: bool)"
|
||||
},
|
||||
"rotateCanvas": {
|
||||
"!doc": "设置一个自定义画布的旋转角度<br/>centerX, centerY: 旋转中心(以屏幕像素为基准);不填视为图片正中心。",
|
||||
|
||||
@ -426,7 +426,7 @@ table.row {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -55%);
|
||||
width: calc(20px + 1.25 * var(--pixel));
|
||||
width: 560px;
|
||||
}
|
||||
|
||||
#uieventHead {
|
||||
@ -448,8 +448,8 @@ table.row {
|
||||
}
|
||||
|
||||
#uieventBody {
|
||||
width: calc(1.25 * var(--pixel));
|
||||
height: calc(1.25 * var(--pixel));
|
||||
width: 540px;
|
||||
height: 540px;
|
||||
position: relative;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
@ -108,7 +108,7 @@ editor_uievent_wrapper = function (editor) {
|
||||
|
||||
uievent.selectPoint = function (floorId, x, y, bigmap, callback) {
|
||||
uievent.values.bigmap = bigmap;
|
||||
uievent.values.size = editor.isMobile ? window.innerWidth / core.__SIZE__ : 32 * 1.25;
|
||||
uievent.values.size = editor.isMobile ? window.innerWidth / core.__SIZE__ : 32 * 540 / core.__PIXELS__;
|
||||
|
||||
uievent.isOpen = true;
|
||||
uievent.elements.div.style.display = 'block';
|
||||
|
||||
@ -692,10 +692,12 @@ actions.prototype._sys_onup = function (x, y, px, py) {
|
||||
clearInterval(core.interval.onDownInterval);
|
||||
core.interval.onDownInterval = null;
|
||||
|
||||
core.status.preview.prepareDragging = false;
|
||||
if (core.status.preview.dragging) {
|
||||
core.status.preview.dragging = false;
|
||||
return true;
|
||||
if (core.isPlaying()) {
|
||||
core.status.preview.prepareDragging = false;
|
||||
if (core.status.preview.dragging) {
|
||||
core.status.preview.dragging = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((core.status.stepPostfix || []).length == 0) return false;
|
||||
|
||||
@ -783,6 +783,7 @@ events.prototype._changeFloor_getHeroLoc = function (floorId, stair, heroLoc) {
|
||||
}
|
||||
|
||||
events.prototype._changeFloor_beforeChange = function (info, callback) {
|
||||
this._changeFloor_playSound();
|
||||
// 需要 setTimeout 执行,不然会出错
|
||||
window.setTimeout(function () {
|
||||
if (info.time == 0)
|
||||
@ -794,6 +795,16 @@ events.prototype._changeFloor_beforeChange = function (info, callback) {
|
||||
}, 25)
|
||||
}
|
||||
|
||||
events.prototype._changeFloor_playSound = function () {
|
||||
// 播放换层音效
|
||||
if (core.hasFlag('__fromLoad__')) // 是否是读档造成的切换
|
||||
core.playSound('读档');
|
||||
else if (core.hasFlag('__isFlying__')) // 是否是楼传造成的切换
|
||||
core.playSound('飞行器');
|
||||
else
|
||||
core.playSound('上下楼');
|
||||
}
|
||||
|
||||
events.prototype._changeFloor_changing = function (info, callback) {
|
||||
this.changingFloor(info.floorId, info.heroLoc);
|
||||
// 回归视角
|
||||
|
||||
10
libs/ui.js
10
libs/ui.js
@ -3393,14 +3393,22 @@ ui.prototype.createCanvas = function (name, x, y, width, height, z) {
|
||||
}
|
||||
|
||||
////// canvas重定位 //////
|
||||
ui.prototype.relocateCanvas = function (name, x, y) {
|
||||
ui.prototype.relocateCanvas = function (name, x, y, useDelta) {
|
||||
var ctx = core.getContextByName(name);
|
||||
if (!ctx) return null;
|
||||
if (x != null) {
|
||||
// 增量模式
|
||||
if (useDelta) {
|
||||
x += parseFloat(ctx.canvas.getAttribute("_left")) || 0;
|
||||
}
|
||||
ctx.canvas.style.left = x * core.domStyle.scale + 'px';
|
||||
ctx.canvas.setAttribute("_left", x);
|
||||
}
|
||||
if (y != null) {
|
||||
// 增量模式
|
||||
if (useDelta) {
|
||||
y += parseFloat(ctx.canvas.getAttribute("_top")) || 0;
|
||||
}
|
||||
ctx.canvas.style.top = y * core.domStyle.scale + 'px';
|
||||
ctx.canvas.setAttribute("_top", y);
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ utils.prototype.formatTime = function (time) {
|
||||
|
||||
////// 两位数显示 //////
|
||||
utils.prototype.setTwoDigits = function (x) {
|
||||
return parseInt(x) < 10 ? "0" + x : x;
|
||||
return (parseInt(x) < 10 && parseInt(x) >= 0) ? "0" + x : x;
|
||||
}
|
||||
|
||||
utils.prototype.formatSize = function (size) {
|
||||
|
||||
@ -112,14 +112,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// core.deleteAllCanvas();
|
||||
// }
|
||||
|
||||
// 播放换层音效
|
||||
if (fromLoad)
|
||||
core.playSound('读档');
|
||||
else if (isFlying)
|
||||
core.playSound('飞行器');
|
||||
else if (currentId)
|
||||
core.playSound('上下楼');
|
||||
|
||||
// 根据分区信息自动砍层与恢复
|
||||
if (core.autoRemoveMaps) core.autoRemoveMaps(floorId);
|
||||
|
||||
|
||||
2
runtime.d.ts
vendored
2
runtime.d.ts
vendored
@ -2148,7 +2148,7 @@ declare class ui {
|
||||
createCanvas(name: string, x: number, y: number, width: number, height: number, zIndex: number): CanvasRenderingContext2D
|
||||
|
||||
/** 重新定位一个自定义画布 */
|
||||
relocateCanvas(name: string, x: number, y: number): void
|
||||
relocateCanvas(name: string, x: number, y: number, useDelta: boolean): void
|
||||
|
||||
/** 重新设置一个自定义画布的大小 */
|
||||
resizeCanvas(name: string, x: number, y: number): void
|
||||
|
||||
Loading…
Reference in New Issue
Block a user