commit
0ffd8d46d9
@ -270,6 +270,7 @@ action
|
|||||||
| showGif_1_s
|
| showGif_1_s
|
||||||
| setFg_0_s
|
| setFg_0_s
|
||||||
| setFg_1_s
|
| setFg_1_s
|
||||||
|
| screenFlash_s
|
||||||
| setWeather_s
|
| setWeather_s
|
||||||
| move_s
|
| move_s
|
||||||
| moveHero_s
|
| moveHero_s
|
||||||
@ -1155,6 +1156,29 @@ var code = '{"type": "setFg"'+Int_0 +async+'},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
screenFlash_s
|
||||||
|
: '画面闪烁' Number ',' Number ',' Number '强度' Number '单次时间' Int '执行次数' Int? '不等待执行完毕' Bool Newline
|
||||||
|
|
||||||
|
/* screenFlash_s
|
||||||
|
tooltip : screenFlash: 画面闪烁,动画时间可不填
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=screenFlash%EF%BC%9A%E7%94%BB%E9%9D%A2%E9%97%AA%E7%83%81
|
||||||
|
default : [255,255,255,1,500,1,false]
|
||||||
|
colour : this.soundColor
|
||||||
|
var limit = function(v,min,max) {
|
||||||
|
if(v>max) return max;
|
||||||
|
if(v<min) return min;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
Number_0 = limit(Number_0,0,255);
|
||||||
|
Number_1 = limit(Number_1,0,255);
|
||||||
|
Number_2 = limit(Number_2,0,255);
|
||||||
|
Number_3 = limit(Number_3,0,1);
|
||||||
|
Int_1 = Int_1!=='' ?(', "times": '+Int_1):'';
|
||||||
|
var async = Bool_0?', "async": true':'';
|
||||||
|
var code = '{"type": "screenFlash", "color": ['+Number_0+','+Number_1+','+Number_2+','+Number_3+'], "time": '+Int_0 +Int_1+async+'},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
setWeather_s
|
setWeather_s
|
||||||
: '更改天气' Weather_List '强度' Int Newline
|
: '更改天气' Weather_List '强度' Int Newline
|
||||||
|
|
||||||
@ -2140,6 +2164,10 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
data.time||0,data.async||false,this.next]);
|
data.time||0,data.async||false,this.next]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "screenFlash": // 画面闪烁
|
||||||
|
this.next = MotaActionBlocks['screenFlash_s'].xmlText([
|
||||||
|
data.color[0],data.color[1],data.color[2],data.color[3]||1,data.time||500,data.times||1,data.async||false,this.next]);
|
||||||
|
break;
|
||||||
case "setWeather": // 更改天气
|
case "setWeather": // 更改天气
|
||||||
this.next = MotaActionBlocks['setWeather_s'].xmlText([
|
this.next = MotaActionBlocks['setWeather_s'].xmlText([
|
||||||
data.name||'无',data.level||1,this.next]);
|
data.name||'无',data.level||1,this.next]);
|
||||||
|
|||||||
@ -140,6 +140,7 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['hideStatusBar_s'].xmlText(),
|
MotaActionBlocks['hideStatusBar_s'].xmlText(),
|
||||||
MotaActionBlocks['setFg_0_s'].xmlText(),
|
MotaActionBlocks['setFg_0_s'].xmlText(),
|
||||||
MotaActionBlocks['setFg_1_s'].xmlText(),
|
MotaActionBlocks['setFg_1_s'].xmlText(),
|
||||||
|
MotaActionBlocks['screenFlash_s'].xmlText(),
|
||||||
MotaActionBlocks['setWeather_s'].xmlText(),
|
MotaActionBlocks['setWeather_s'].xmlText(),
|
||||||
MotaActionBlocks['playBgm_s'].xmlText(),
|
MotaActionBlocks['playBgm_s'].xmlText(),
|
||||||
MotaActionBlocks['pauseBgm_s'].xmlText(),
|
MotaActionBlocks['pauseBgm_s'].xmlText(),
|
||||||
|
|||||||
@ -1061,6 +1061,27 @@ time为可选的,如果指定,则会作为更改画面色调的时间。
|
|||||||
|
|
||||||
async可选,如果为true则会异步执行(即不等待当前事件执行完毕,立刻执行下一个事件)。
|
async可选,如果为true则会异步执行(即不等待当前事件执行完毕,立刻执行下一个事件)。
|
||||||
|
|
||||||
|
### screenFlash:画面闪烁
|
||||||
|
|
||||||
|
我们可以使用 `{"type": "screenFlash"}` 来进行画面闪烁。
|
||||||
|
|
||||||
|
``` js
|
||||||
|
"x,y": [ // 实际执行的事件列表
|
||||||
|
{"type": "screenFlash", "color": [255,255,255,0.6], "time": 500, "times": 1}, // 闪光为白色,不透明度0.6,动画时间1000毫秒
|
||||||
|
{"type": "screenFlash", "color": [255,0,0,1], "time": 100, "times": 2, "async": true}, // 闪光为红色,强度最大,动画时间100毫秒,闪烁两次且异步执行
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
color为闪光的颜色。它是一个数组,分别指定目标颜色的R,G,B,A值。
|
||||||
|
- 常见RGB颜色: 纯黑[0,0,0],纯白[255,255,255],纯红[255,0,0],等等。
|
||||||
|
A即闪光的不透明度,为一个0到1之间的数,值越高闪烁效果越强。默认为1
|
||||||
|
|
||||||
|
time为闪烁时间,默认值为500
|
||||||
|
|
||||||
|
times为闪烁次数,两次闪烁会连续进行,默认值为1
|
||||||
|
|
||||||
|
async可选,如果为true则会异步执行(即不等待当前事件执行完毕,立刻执行下一个事件)。
|
||||||
|
|
||||||
### setWeather:更改天气
|
### setWeather:更改天气
|
||||||
|
|
||||||
我们可以使用 `{"type": "setWeather"}` 来更改天气。
|
我们可以使用 `{"type": "setWeather"}` 来更改天气。
|
||||||
|
|||||||
@ -1333,7 +1333,7 @@ control.prototype.setFg = function(color, time, callback) {
|
|||||||
core.status.curtainColor = [0,0,0,0];
|
core.status.curtainColor = [0,0,0,0];
|
||||||
}
|
}
|
||||||
|
|
||||||
var fromColor = core.status.curtainColor;
|
var nowColor = core.status.curtainColor;
|
||||||
|
|
||||||
if (!core.isset(color))
|
if (!core.isset(color))
|
||||||
color = [0,0,0,0];
|
color = [0,0,0,0];
|
||||||
@ -1349,19 +1349,20 @@ control.prototype.setFg = function(color, time, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var per_time = 10, step=0, steps = parseInt(time / per_time);
|
var per_time = 10, step = parseInt(time / per_time);
|
||||||
|
|
||||||
var changeAnimate = setInterval(function() {
|
var changeAnimate = setInterval(function() {
|
||||||
step++;
|
nowColor = [
|
||||||
|
parseInt(nowColor[0]*(step-1)+color[0])/step,
|
||||||
var nowA = fromColor[3]+(color[3]-fromColor[3])*step/steps;
|
parseInt(nowColor[1]*(step-1)+color[1])/step,
|
||||||
var nowR = parseInt(fromColor[0]+(color[0]-fromColor[0])*step/steps);
|
parseInt(nowColor[2]*(step-1)+color[2])/step,
|
||||||
var nowG = parseInt(fromColor[1]+(color[1]-fromColor[1])*step/steps);
|
(nowColor[3]*(step-1)+color[3])/step,
|
||||||
var nowB = parseInt(fromColor[2]+(color[2]-fromColor[2])*step/steps);
|
];
|
||||||
core.clearMap('curtain');
|
core.clearMap('curtain');
|
||||||
core.fillRect('curtain', 0, 0, 416, 416, core.arrayToRGBA([nowR,nowG,nowB,nowA]));
|
core.fillRect('curtain', 0, 0, 416, 416, core.arrayToRGBA(nowColor));
|
||||||
|
step--;
|
||||||
|
|
||||||
if (step>=steps) {
|
if (step <= 0) {
|
||||||
delete core.animateFrame.asyncId[changeAnimate];
|
delete core.animateFrame.asyncId[changeAnimate];
|
||||||
clearInterval(changeAnimate);
|
clearInterval(changeAnimate);
|
||||||
core.status.curtainColor = color;
|
core.status.curtainColor = color;
|
||||||
|
|||||||
@ -921,6 +921,11 @@ core.prototype.setFg = function(color, time, callback) {
|
|||||||
core.control.setFg(color, time, callback);
|
core.control.setFg(color, time, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 画面闪烁 //////
|
||||||
|
core.prototype.screenFlash = function (color, time, times, callback) {
|
||||||
|
core.ui.screenFlash(color, time, times, callback);
|
||||||
|
}
|
||||||
|
|
||||||
////// 更新全地图显伤 //////
|
////// 更新全地图显伤 //////
|
||||||
core.prototype.updateDamage = function () {
|
core.prototype.updateDamage = function () {
|
||||||
core.control.updateDamage();
|
core.control.updateDamage();
|
||||||
|
|||||||
@ -822,6 +822,17 @@ events.prototype.doAction = function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "screenFlash": // 画面闪烁
|
||||||
|
if (data.async) {
|
||||||
|
core.screenFlash(data.color, data.time, data.times);
|
||||||
|
this.doAction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.screenFlash(data.color, data.time, data.times, function() {
|
||||||
|
core.events.doAction();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "setWeather": // 更改天气
|
case "setWeather": // 更改天气
|
||||||
core.setWeather(data.name, data.level);
|
core.setWeather(data.name, data.level);
|
||||||
if (core.isset(data.name))
|
if (core.isset(data.name))
|
||||||
|
|||||||
16
libs/ui.js
16
libs/ui.js
@ -2833,6 +2833,22 @@ ui.prototype.drawHelp = function () {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 画面闪烁 //////
|
||||||
|
ui.prototype.screenFlash = function (color, time, times, callback) {
|
||||||
|
times = times || 1;
|
||||||
|
time = time/3;
|
||||||
|
var nowColor = core.clone(core.status.curtainColor);
|
||||||
|
core.setFg(color, time, function() {
|
||||||
|
core.setFg(nowColor, time * 2, function() {
|
||||||
|
if (times > 1)
|
||||||
|
core.screenFlash(color, time * 3, times - 1, callback);
|
||||||
|
else {
|
||||||
|
if (core.isset(callback)) callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
////// 动态canvas //////
|
////// 动态canvas //////
|
||||||
|
|
||||||
////// canvas创建 //////
|
////// canvas创建 //////
|
||||||
|
|||||||
@ -27,7 +27,8 @@ main.floors.sample0=
|
|||||||
"firstArrive": [
|
"firstArrive": [
|
||||||
{
|
{
|
||||||
"type": "setText",
|
"type": "setText",
|
||||||
"background": "winskin.png"
|
"background": "winskin.png",
|
||||||
|
"time": 0
|
||||||
},
|
},
|
||||||
"\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:",
|
"\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:",
|
||||||
"\t[hero]\b[up,hero]我是谁?我从哪来?我又要到哪去?",
|
"\t[hero]\b[up,hero]我是谁?我从哪来?我又要到哪去?",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user