Merge pull request #356 from ckcz123/v2.x
SL 1000 longClick && tip icon && replaySpeed && \b followers
This commit is contained in:
commit
b6a3a05601
@ -209,17 +209,28 @@
|
||||
- `\b[up]` 直接显示在当前点上方。同样把这里的up换成down则为下方。
|
||||
- 如果不存在当前点(如在firstArrive或eachArrive中调用),则显示在屏幕最上方(最下方)
|
||||
- `\b[up,hero]` 显示在勇士上方。同样把这里的up换成down则为下方。
|
||||
- `\b[up,x,y]` 显示在(x,y)点的上方(下方);x和y都为整数且在0到12之间。
|
||||
- 从V2.6开始,也允许写`\b[hero]`来根据勇士位置自动决定上方还是下方
|
||||
- `\b[up,x,y]` 显示在(x,y)点的上方(下方);x和y都为整数且在0到12之间
|
||||
- 从V2.6开始,也允许写`\b[null,x,y]`来根据(x,y)位置自动决定上方还是下方
|
||||
- `\b[up,x]` 显示在勇士的第x个跟随的行走图的上方(下方);也允许把up换成null来自动适配
|
||||
|
||||
``` js
|
||||
[
|
||||
"\b[up]这段文字显示在当前点上方",
|
||||
"\b[down]这段文字显示在当前点上方",
|
||||
"\t[hero]\b[up,hero]这是一段勇士说的话,会显示在勇士上方",
|
||||
"\t[hero]\b[hero]这是一段勇士说的话,根据勇士位置自动适配上下",
|
||||
"\t[小妖精,fairy]\b[down,2,2]这是一段小妖精说的话,会显示在(2,2)点下方",
|
||||
"\t[null,1,3]根据坐标位置自动适配上下",
|
||||
"\t[up,1]"显示在勇士第一个跟随的行走图上方",
|
||||
"\t[null,2]显示在勇士第二个跟随的行走图,自动适配上下",
|
||||
]
|
||||
```
|
||||
|
||||
从V2.6开始,`\b`提供了更多功能,包括:
|
||||
|
||||
- `\b[hero]`
|
||||
|
||||
!> `\t[...]`必须在`\b[...]`前面!不然两者都无法正常显示。
|
||||
|
||||
还可以使用`\r[...]`来调整剧情文本的颜色。
|
||||
@ -366,11 +377,13 @@ time为可选项,表示文字添加的速度。若此项设置为0将直接全
|
||||
|
||||
``` js
|
||||
[
|
||||
{"type": "tip", "text": "这段话将在左上角以气泡形式显示"}
|
||||
{"type": "tip", "text": "这段话将在左上角以气泡形式显示", "icon": "book"}
|
||||
]
|
||||
```
|
||||
|
||||
值得注意的是,提示的text内容也是可以使用`${ }`来计算表达式的值的。
|
||||
text必填,为显示的内容,支持`${}`的表达式计算。
|
||||
|
||||
icon是可选的,如果设置则会绘制图标,其可以是一个有效的ID,或者`core.statusBar.icons`中的系统图标。
|
||||
|
||||
### comment:添加注释
|
||||
|
||||
|
||||
@ -483,14 +483,15 @@ return code;
|
||||
*/;
|
||||
|
||||
tip_s
|
||||
: '显示提示' ':' EvalString Newline
|
||||
: '显示提示' ':' EvalString '图标ID' IdString? Newline
|
||||
|
||||
|
||||
/* tip_s
|
||||
tooltip : tip:显示一段提示文字
|
||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=tip%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%8F%90%E7%A4%BA%E6%96%87%E5%AD%97
|
||||
default : ["这段话将在左上角以气泡形式显示"]
|
||||
var code = '{"type": "tip", "text": "'+EvalString_0+'"},\n';
|
||||
default : ["这段话将在左上角以气泡形式显示",""]
|
||||
IdString_0 = IdString_0 && (', "icon": "' + IdString_0 + '"');
|
||||
var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -2337,7 +2338,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "tip":
|
||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||
data.text,this.next]);
|
||||
data.text,data.icon||"",this.next]);
|
||||
break;
|
||||
case "show": // 显示
|
||||
data.loc=data.loc||[];
|
||||
|
||||
@ -744,11 +744,18 @@ actions.prototype._sys_longClick_lockControl = function (x, y) {
|
||||
}
|
||||
// 长按楼传器的箭头可以快速翻页
|
||||
if (core.status.event.id == 'fly') {
|
||||
if ((x == 10 || x == 11) && (y == 5 || y == 9)) {
|
||||
if ((x == this.SIZE-2 || x == this.SIZE-3) && (y == this.HSIZE - 1 || y == this.HSIZE+3)) {
|
||||
this._clickFly(x, y);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 长按SL快速翻页
|
||||
if (["save","load","replayLoad"].indexOf(core.status.event.id) >= 0) {
|
||||
if ([this.HSIZE-2, this.HSIZE-3, this.HSIZE+2, this.HSIZE+3].indexOf(x) >= 0 && y == this.LAST) {
|
||||
this._clickSL(x, y);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 长按可以跳过等待事件
|
||||
if (core.status.event.id == 'action' && core.status.event.data.type == 'sleep'
|
||||
&& !core.status.event.data.current.noSkip) {
|
||||
|
||||
@ -1098,9 +1098,10 @@ control.prototype.speedUpReplay = function () {
|
||||
if (core.status.replay.speed==12) core.status.replay.speed=24;
|
||||
else if (core.status.replay.speed==6) core.status.replay.speed=12;
|
||||
else if (core.status.replay.speed==3) core.status.replay.speed=6;
|
||||
else if (core.status.replay.speed<3) {
|
||||
var toAdd = core.status.replay.speed>=2?2:1;
|
||||
core.status.replay.speed = parseInt(10*core.status.replay.speed + toAdd)/10;
|
||||
else if (core.status.replay.speed==2.5) core.status.replay.speed=3;
|
||||
else if (core.status.replay.speed==2) core.status.replay.speed=2.5;
|
||||
else {
|
||||
core.status.replay.speed = parseInt(10*core.status.replay.speed + 2)/10;
|
||||
}
|
||||
core.drawTip("x"+core.status.replay.speed+"倍");
|
||||
}
|
||||
@ -1108,14 +1109,15 @@ control.prototype.speedUpReplay = function () {
|
||||
////// 减速播放 //////
|
||||
control.prototype.speedDownReplay = function () {
|
||||
if (!core.isPlaying() || !core.isReplaying()) return;
|
||||
if (core.status.replay.speed==24) core.status.replay.speed=12.0;
|
||||
else if (core.status.replay.speed==12) core.status.replay.speed=6.0;
|
||||
else if (core.status.replay.speed==6) core.status.replay.speed=3.0;
|
||||
if (core.status.replay.speed==24) core.status.replay.speed=12;
|
||||
else if (core.status.replay.speed==12) core.status.replay.speed=6;
|
||||
else if (core.status.replay.speed==6) core.status.replay.speed=3;
|
||||
else if (core.status.replay.speed==3) core.status.replay.speed=2.5;
|
||||
else if (core.status.replay.speed==2.5) core.status.replay.speed=2;
|
||||
else {
|
||||
var toAdd = core.status.replay.speed>=2?2:1;
|
||||
core.status.replay.speed = parseInt(10*core.status.replay.speed - toAdd)/10;
|
||||
core.status.replay.speed = parseInt(10*core.status.replay.speed - 2)/10;
|
||||
}
|
||||
if (core.status.replay.speed<0.3) core.status.replay.speed=0.3;
|
||||
if (core.status.replay.speed<0.2) core.status.replay.speed=0.2;
|
||||
core.drawTip("x"+core.status.replay.speed+"倍");
|
||||
}
|
||||
|
||||
|
||||
@ -952,7 +952,7 @@ events.prototype._action_setText = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_tip = function (data, x, y, prefix) {
|
||||
core.drawTip(core.replaceText(data.text));
|
||||
core.drawTip(core.replaceText(data.text), data.icon);
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
|
||||
18
libs/ui.js
18
libs/ui.js
@ -380,6 +380,7 @@ ui.prototype._getTitleAndIcon = function (content) {
|
||||
var blockInfo = core.getBlockInfo(s4);
|
||||
if (blockInfo != null) {
|
||||
if (core.material.enemys[s4]) title = core.material.enemys[s4].name;
|
||||
else title = s4;
|
||||
image = blockInfo.image;
|
||||
icon = blockInfo.posY;
|
||||
height = blockInfo.height;
|
||||
@ -409,9 +410,9 @@ ui.prototype._getPosition = function (content) {
|
||||
py = core.status.event.data.y;
|
||||
}
|
||||
content = content.replace("\b", "\\b")
|
||||
.replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+))?]/g, function (s0, s1, s2, s3) {
|
||||
.replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+|\d+))?]/g, function (s0, s1, s2, s3) {
|
||||
pos = s1;
|
||||
if (s3 == 'hero' || s1=='hero') {
|
||||
if (s3 == 'hero' || s1=='hero' && !s3) {
|
||||
px = core.status.hero.loc.x;
|
||||
py = core.status.hero.loc.y;
|
||||
}
|
||||
@ -420,8 +421,17 @@ ui.prototype._getPosition = function (content) {
|
||||
}
|
||||
else if (s3) {
|
||||
var str = s3.split(',');
|
||||
px = parseInt(str[0]);
|
||||
py = parseInt(str[1]);
|
||||
px = py = null;
|
||||
if (str.length == 1) {
|
||||
var follower = (core.status.hero.followers||[])[parseInt(str[0])-1];
|
||||
if (follower) {
|
||||
px = follower.x;
|
||||
py = follower.y;
|
||||
}
|
||||
} else{
|
||||
px = parseInt(str[0]);
|
||||
py = parseInt(str[1]);
|
||||
}
|
||||
}
|
||||
if(pos=='hero' || pos=='null'){
|
||||
pos = py==null?'center':(py>=core.__HALF_SIZE__? 'up':'down');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user