moveEnemyOnPoint dxy & setDisplayScale
This commit is contained in:
parent
61f42bd6c5
commit
4dc47a5d58
@ -573,6 +573,9 @@ color: 一行三列(第四列视为1)或一行四列(第四列若大于1
|
|||||||
time: 渐变时间,单位为毫秒。不填视为750ms,负数视为0(无渐变,立即更改)
|
time: 渐变时间,单位为毫秒。不填视为750ms,负数视为0(无渐变,立即更改)
|
||||||
callback: 更改完毕后的回调函数,可选。事件流中常取core.doAction
|
callback: 更改完毕后的回调函数,可选。事件流中常取core.doAction
|
||||||
|
|
||||||
|
setDisplayScale: fn(delta: number)
|
||||||
|
设置屏幕放缩
|
||||||
|
|
||||||
setFlag: fn(name: string, value: ?)
|
setFlag: fn(name: string, value: ?)
|
||||||
设置一个flag变量
|
设置一个flag变量
|
||||||
例如:core.setFlag('poison', true); // 令主角中毒
|
例如:core.setFlag('poison', true); // 令主角中毒
|
||||||
|
|||||||
@ -2560,6 +2560,10 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
|||||||
"!doc": "检查bgm状态",
|
"!doc": "检查bgm状态",
|
||||||
"!type": "fn()"
|
"!type": "fn()"
|
||||||
},
|
},
|
||||||
|
"setDisplayScale": {
|
||||||
|
"!doc": "设置屏幕放缩",
|
||||||
|
"!type": "fn(delta: number)"
|
||||||
|
},
|
||||||
"speedDownReplay": {
|
"speedDownReplay": {
|
||||||
"!doc": "减速播放",
|
"!doc": "减速播放",
|
||||||
"!type": "fn()"
|
"!type": "fn()"
|
||||||
|
|||||||
@ -780,6 +780,7 @@ action
|
|||||||
| setEnemyOnPoint_s
|
| setEnemyOnPoint_s
|
||||||
| resetEnemyOnPoint_s
|
| resetEnemyOnPoint_s
|
||||||
| moveEnemyOnPoint_s
|
| moveEnemyOnPoint_s
|
||||||
|
| moveEnemyOnPoint_1_s
|
||||||
| setEquip_s
|
| setEquip_s
|
||||||
| setFloor_s
|
| setFloor_s
|
||||||
| setGlobalAttribute_s
|
| setGlobalAttribute_s
|
||||||
@ -1257,6 +1258,24 @@ var code = '{"type": "moveEnemyOnPoint"'+floorstr+IdString_0+'},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
moveEnemyOnPoint_1_s
|
||||||
|
: '移动某点怪物属性' ':' '起点' 'x' PosString? ',' 'y' PosString? '增量' 'dx' PosString? 'dy' PosString? '楼层' IdString? Newline
|
||||||
|
|
||||||
|
|
||||||
|
/* moveEnemyOnPoint_1_s
|
||||||
|
tooltip : moveEnemyOnPoint:移动某个点上怪物的属性到其他点
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
default : ["", "", "", "", ""]
|
||||||
|
allFloorIds : ['IdString_0']
|
||||||
|
selectPoint : ["PosString_0", "PosString_1"]
|
||||||
|
colour : this.dataColor
|
||||||
|
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||||
|
var floorstr = PosString_0 && PosString_1 ? ', "from": ['+PosString_0+','+PosString_1+']' : '';
|
||||||
|
if (PosString_2 && PosString_3) floorstr += ', "dxy": ['+PosString_2+','+PosString_3+']'
|
||||||
|
var code = '{"type": "moveEnemyOnPoint"'+floorstr+IdString_0+'},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
setFloor_s
|
setFloor_s
|
||||||
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '为' JsonEvalString Newline
|
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '为' JsonEvalString Newline
|
||||||
|
|
||||||
|
|||||||
@ -750,9 +750,14 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
break;
|
break;
|
||||||
case "moveEnemyOnPoint":
|
case "moveEnemyOnPoint":
|
||||||
data.from=data.from||['','']
|
data.from=data.from||['','']
|
||||||
|
if (data.dxy) {
|
||||||
|
this.next = MotaActionBlocks['moveEnemyOnPoint_1_s'].xmlText([
|
||||||
|
data.from[0], data.from[1], data.dxy[0], data.dxy[1], data.floorId||'',this.next]);
|
||||||
|
} else {
|
||||||
data.to=data.to||['','']
|
data.to=data.to||['','']
|
||||||
this.next = MotaActionBlocks['moveEnemyOnPoint_s'].xmlText([
|
this.next = MotaActionBlocks['moveEnemyOnPoint_s'].xmlText([
|
||||||
data.from[0], data.from[1], data.to[0], data.to[1], data.floorId||'',this.next]);
|
data.from[0], data.from[1], data.to[0], data.to[1], data.floorId||'',this.next]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "setEquip":
|
case "setEquip":
|
||||||
this.next = MotaActionBlocks['setEquip_s'].xmlText([
|
this.next = MotaActionBlocks['setEquip_s'].xmlText([
|
||||||
|
|||||||
@ -126,6 +126,7 @@ editor_blocklyconfig=(function(){
|
|||||||
MotaActionBlocks['setEnemyOnPoint_s'].xmlText(),
|
MotaActionBlocks['setEnemyOnPoint_s'].xmlText(),
|
||||||
MotaActionBlocks['resetEnemyOnPoint_s'].xmlText(),
|
MotaActionBlocks['resetEnemyOnPoint_s'].xmlText(),
|
||||||
MotaActionBlocks['moveEnemyOnPoint_s'].xmlText(),
|
MotaActionBlocks['moveEnemyOnPoint_s'].xmlText(),
|
||||||
|
MotaActionBlocks['moveEnemyOnPoint_1_s'].xmlText(),
|
||||||
MotaActionBlocks['setEquip_s'].xmlText(),
|
MotaActionBlocks['setEquip_s'].xmlText(),
|
||||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||||
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
||||||
|
|||||||
@ -2262,13 +2262,7 @@ actions.prototype._clickSwitchs_display = function (x, y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions.prototype._clickSwitchs_display_setSize = function (delta) {
|
actions.prototype._clickSwitchs_display_setSize = function (delta) {
|
||||||
var index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
|
core.setDisplayScale(delta);
|
||||||
if (index < 0) return;
|
|
||||||
index += delta;
|
|
||||||
if (index < 0 || index >= core.domStyle.availableScale.length);
|
|
||||||
core.domStyle.scale = core.domStyle.availableScale[index];
|
|
||||||
core.setLocalStorage('scale', core.domStyle.scale);
|
|
||||||
core.resize();
|
|
||||||
var currentRatio = Math.max(window.devicePixelRatio || 1, core.domStyle.scale);
|
var currentRatio = Math.max(window.devicePixelRatio || 1, core.domStyle.scale);
|
||||||
if (currentRatio > core.domStyle.ratio) {
|
if (currentRatio > core.domStyle.ratio) {
|
||||||
core.drawTip("需刷新页面以调整UI清晰度");
|
core.drawTip("需刷新页面以调整UI清晰度");
|
||||||
|
|||||||
@ -2858,19 +2858,15 @@ control.prototype.checkBgm = function() {
|
|||||||
core.playBgm(core.musicStatus.playingBgm || main.startBgm);
|
core.playBgm(core.musicStatus.playingBgm || main.startBgm);
|
||||||
}
|
}
|
||||||
|
|
||||||
///// 设置屏幕大小 //////
|
///// 设置屏幕放缩 //////
|
||||||
control.prototype.setDisplaySize = function (delta) {
|
control.prototype.setDisplayScale = function (delta) {
|
||||||
var index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
|
var index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
|
||||||
if (index < 0) return;
|
if (index < 0) return;
|
||||||
index += delta;
|
index += delta;
|
||||||
if (index < 0 || index >= core.domStyle.availableScale.length);
|
if (index < 0 || index >= core.domStyle.availableScale.length) return;
|
||||||
core.domStyle.scale = core.domStyle.availableScale[index];
|
core.domStyle.scale = core.domStyle.availableScale[index];
|
||||||
core.setLocalStorage('scale', core.domStyle.scale);
|
core.setLocalStorage('scale', core.domStyle.scale);
|
||||||
core.resize();
|
core.resize();
|
||||||
var currentRatio = Math.max(window.devicePixelRatio || 1, core.domStyle.scale);
|
|
||||||
if (currentRatio > core.domStyle.ratio && core.isPlaying()) {
|
|
||||||
core.drawTip("需刷新页面以调整UI清晰度");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------ 状态栏,工具栏等相关 ------ //
|
// ------ 状态栏,工具栏等相关 ------ //
|
||||||
|
|||||||
@ -1876,12 +1876,17 @@ events.prototype._action_resetEnemyOnPoint = function (data, x, y, prefix) {
|
|||||||
events.prototype._precompile_moveEnemyOnPoint = function (data) {
|
events.prototype._precompile_moveEnemyOnPoint = function (data) {
|
||||||
data.from = this.__precompile_array(data.from);
|
data.from = this.__precompile_array(data.from);
|
||||||
data.to = this.__precompile_array(data.to);
|
data.to = this.__precompile_array(data.to);
|
||||||
|
data.dxy = this.__precompile_array(data.dxy);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._action_moveEnemyOnPoint = function (data, x, y, prefix) {
|
events.prototype._action_moveEnemyOnPoint = function (data, x, y, prefix) {
|
||||||
var from = this.__action_getLoc(data.from, x, y, prefix);
|
var from = this.__action_getLoc(data.from, x, y, prefix), to;
|
||||||
var to = this.__action_getLoc(data.to, x, y, prefix);
|
if (data.dxy) {
|
||||||
|
to = [from[0] + (core.calValue(data.dxy[0], prefix) || 0), from[1] + (core.calValue(data.dxy[1], prefix) || 0)];
|
||||||
|
} else {
|
||||||
|
to = this.__action_getLoc(data.to, x, y, prefix);
|
||||||
|
}
|
||||||
this.moveEnemyOnPoint(from[0], from[1], to[0], to[1], data.floorId);
|
this.moveEnemyOnPoint(from[0], from[1], to[0], to[1], data.floorId);
|
||||||
core.doAction();
|
core.doAction();
|
||||||
}
|
}
|
||||||
@ -1944,8 +1949,11 @@ events.prototype.__action_getInput = function (hint, isText, callback) {
|
|||||||
if (core.isReplaying()) {
|
if (core.isReplaying()) {
|
||||||
var action = core.status.replay.toReplay.shift();
|
var action = core.status.replay.toReplay.shift();
|
||||||
try {
|
try {
|
||||||
if (action.indexOf(prefix) != 0)
|
if (action.indexOf(prefix) != 0) {
|
||||||
throw new Error("录像文件出错!当前需要一个 " + prefix + " 项,实际为 " + action);
|
console.warn("警告!当前需要一个 " + prefix + " 项,实际为 " + action);
|
||||||
|
core.status.replay.toReplay.unshift(action);
|
||||||
|
return callback(isText ? '' : 0);
|
||||||
|
}
|
||||||
if (isText) value = core.decodeBase64(action.substring(7));
|
if (isText) value = core.decodeBase64(action.substring(7));
|
||||||
else value = parseInt(action.substring(6));
|
else value = parseInt(action.substring(6));
|
||||||
callback(value);
|
callback(value);
|
||||||
@ -2404,11 +2412,13 @@ events.prototype.__action_wait_afterGet = function (data) {
|
|||||||
if (!data.data) return false;
|
if (!data.data) return false;
|
||||||
var todo = [];
|
var todo = [];
|
||||||
var stop = false;
|
var stop = false;
|
||||||
|
var found = false;
|
||||||
data.data.forEach(function (one) {
|
data.data.forEach(function (one) {
|
||||||
if (one._disabled || stop) return;
|
if (one._disabled || stop) return;
|
||||||
if (one["case"] == "keyboard" && core.getFlag("type") == 0) {
|
if (one["case"] == "keyboard" && core.getFlag("type") == 0) {
|
||||||
(one.keycode + "").split(",").forEach(function (keycode) {
|
(one.keycode + "").split(",").forEach(function (keycode) {
|
||||||
if (core.getFlag("keycode", 0) == keycode) {
|
if (core.getFlag("keycode", 0) == keycode) {
|
||||||
|
found = true;
|
||||||
core.push(todo, one.action);
|
core.push(todo, one.action);
|
||||||
if (one["break"]) stop = true;
|
if (one["break"]) stop = true;
|
||||||
}
|
}
|
||||||
@ -2422,6 +2432,7 @@ events.prototype.__action_wait_afterGet = function (data) {
|
|||||||
var pymax = core.calValue(one.py[1]);
|
var pymax = core.calValue(one.py[1]);
|
||||||
var px = core.getFlag("px", 0), py = core.getFlag("py", 0);
|
var px = core.getFlag("px", 0), py = core.getFlag("py", 0);
|
||||||
if (px >= pxmin && px <= pxmax && py >= pymin && py <= pymax) {
|
if (px >= pxmin && px <= pxmax && py >= pymin && py <= pymax) {
|
||||||
|
found = true;
|
||||||
core.push(todo, one.action);
|
core.push(todo, one.action);
|
||||||
if (one["break"]) stop = true;
|
if (one["break"]) stop = true;
|
||||||
}
|
}
|
||||||
@ -2430,16 +2441,18 @@ events.prototype.__action_wait_afterGet = function (data) {
|
|||||||
var condition = false;
|
var condition = false;
|
||||||
try { condition = core.calValue(one.condition); } catch (e) {}
|
try { condition = core.calValue(one.condition); } catch (e) {}
|
||||||
if (condition) {
|
if (condition) {
|
||||||
|
found = true;
|
||||||
core.push(todo, one.action);
|
core.push(todo, one.action);
|
||||||
if (one["break"]) stop = true;
|
if (one["break"]) stop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (one["case"] == "timeout" && core.getFlag("type") == -1) {
|
if (one["case"] == "timeout" && core.getFlag("type") == -1) {
|
||||||
|
found = true;
|
||||||
core.push(todo, one.action);
|
core.push(todo, one.action);
|
||||||
if (one["break"]) stop = true;
|
if (one["break"]) stop = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (todo.length > 0) {
|
if (found) {
|
||||||
core.insertAction(todo);
|
core.insertAction(todo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2496,7 +2509,10 @@ events.prototype._action_callSave = function (data, x, y, prefix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._action_autoSave = function (data, x, y, prefix) {
|
events.prototype._action_autoSave = function (data, x, y, prefix) {
|
||||||
|
var forbidSave = core.hasFlag('__forbidSave__');
|
||||||
|
core.removeFlag('__forbidSave__');
|
||||||
core.autosave();
|
core.autosave();
|
||||||
|
if (forbidSave) core.setFlag('__forbidSave__', true);
|
||||||
if (!data.nohint) core.drawTip("已自动存档");
|
if (!data.nohint) core.drawTip("已自动存档");
|
||||||
core.doAction();
|
core.doAction();
|
||||||
}
|
}
|
||||||
|
|||||||
10
main.js
10
main.js
@ -763,7 +763,15 @@ main.dom.musicBtn.onclick = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main.dom.enlargeBtn.onclick = function () {
|
main.dom.enlargeBtn.onclick = function () {
|
||||||
|
try {
|
||||||
|
if (main.core) {
|
||||||
|
main.core.setDisplayScale(1);
|
||||||
|
if (!main.core.isPlaying() && main.core.flags.enableHDCanvas) {
|
||||||
|
main.core.domStyle.ratio = Math.max(window.devicePixelRatio || 1, main.core.domStyle.scale);
|
||||||
|
main.core.resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {main.log(e)};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onblur = function () {
|
window.onblur = function () {
|
||||||
|
|||||||
3
runtime.d.ts
vendored
3
runtime.d.ts
vendored
@ -792,6 +792,9 @@ declare class control {
|
|||||||
/** 检查bgm状态 */
|
/** 检查bgm状态 */
|
||||||
checkBgm(): void
|
checkBgm(): void
|
||||||
|
|
||||||
|
/** 设置屏幕放缩 */
|
||||||
|
setDisplayScale(delta: number): void
|
||||||
|
|
||||||
/** 清空状态栏 */
|
/** 清空状态栏 */
|
||||||
clearStatusBar(): void
|
clearStatusBar(): void
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user