色调层变速
This commit is contained in:
parent
3975a0a09d
commit
0e766391be
@ -546,12 +546,13 @@ saveAndStopAutomaticRoute: fn()
|
||||
saveData: fn()
|
||||
存档到本地
|
||||
|
||||
screenFlash: fn(color: [number], time: number, times?: number, callback?: fn())
|
||||
screenFlash: fn(color: [number], time: number, times?: number, moveMode?: string, callback?: fn())
|
||||
画面闪烁
|
||||
例如:core.screenFlash([255, 0, 0, 1], 3); // 红屏一闪而过
|
||||
color: 一行三列(第四列视为1)或一行四列(第四列若大于1则会被视为1,第四列若填负数则会被视为0)的颜色数组,必填
|
||||
time: 单次闪烁时长,实际闪烁效果为先花其三分之一的时间渐变到目标色调,再花剩余三分之二的时间渐变回去
|
||||
times: 闪烁的总次数,不填或填0都视为1
|
||||
moveMode: 渐变方式
|
||||
callback: 闪烁全部完毕后的回调函数,可选
|
||||
|
||||
setAutoHeroMove: fn(steps: [?])
|
||||
@ -578,11 +579,12 @@ setBuff: fn(name: string, value: number)
|
||||
name: 属性的英文名,请注意只能用于数值类属性哦,否则随后的乘法会得到NaN
|
||||
value: 新的百分比修正倍率,不填(效果上)视为1
|
||||
|
||||
setCurtain: fn(color?: [number], time?: number, callback?: fn())
|
||||
setCurtain: fn(color?: [number], time?: number, moveMode?: string, callback?: fn())
|
||||
更改画面色调,不计入存档。如需长期生效请使用core.events._action_setCurtain()函数
|
||||
例如:core.setCurtain(); // 恢复画面色调,用时四分之三秒
|
||||
color: 一行三列(第四列视为1)或一行四列(第四列若大于1则会被视为1,第四列若为负数则会被视为0)的颜色数组,不填视为[0, 0, 0, 0]
|
||||
time: 渐变时间,单位为毫秒。不填视为750ms,负数视为0(无渐变,立即更改)
|
||||
moveMode: 渐变方式
|
||||
callback: 更改完毕后的回调函数,可选。事件流中常取core.doAction
|
||||
|
||||
setDisplayScale: fn(delta: number)
|
||||
@ -938,7 +940,7 @@ confirmRestart: fn()
|
||||
|
||||
doAction: fn()
|
||||
执行下一个事件指令,常作为回调
|
||||
例如:core.setCurtain([0,0,0,1], undefined, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果
|
||||
例如:core.setCurtain([0,0,0,1], undefined, null, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果
|
||||
|
||||
doEvent: fn(data?: ?, x?: number, y?: number, prefix?: string)
|
||||
执行一个自定义事件
|
||||
|
||||
@ -2145,12 +2145,12 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
||||
"!type": "fn()"
|
||||
},
|
||||
"screenFlash": {
|
||||
"!doc": "画面闪烁<br/>例如:core.screenFlash([255, 0, 0, 1], 3); // 红屏一闪而过<br/>color: 一行三列(第四列视为1)或一行四列(第四列若大于1则会被视为1,第四列若填负数则会被视为0)的颜色数组,必填<br/>time: 单次闪烁时长,实际闪烁效果为先花其三分之一的时间渐变到目标色调,再花剩余三分之二的时间渐变回去<br/>times: 闪烁的总次数,不填或填0都视为1<br/>callback: 闪烁全部完毕后的回调函数,可选",
|
||||
"!type": "fn(color: [number], time: number, times?: number, callback?: fn())"
|
||||
"!doc": "画面闪烁<br/>例如:core.screenFlash([255, 0, 0, 1], 3); // 红屏一闪而过<br/>color: 一行三列(第四列视为1)或一行四列(第四列若大于1则会被视为1,第四列若填负数则会被视为0)的颜色数组,必填<br/>time: 单次闪烁时长,实际闪烁效果为先花其三分之一的时间渐变到目标色调,再花剩余三分之二的时间渐变回去<br/>times: 闪烁的总次数,不填或填0都视为1<br/>moveMode: 渐变方式<br/>callback: 闪烁全部完毕后的回调函数,可选",
|
||||
"!type": "fn(color: [number], time: number, times?: number, moveMode?: string, callback?: fn())"
|
||||
},
|
||||
"setCurtain": {
|
||||
"!doc": "更改画面色调,不计入存档。如需长期生效请使用core.events._action_setCurtain()函数<br/>例如:core.setCurtain(); // 恢复画面色调,用时四分之三秒<br/>color: 一行三列(第四列视为1)或一行四列(第四列若大于1则会被视为1,第四列若为负数则会被视为0)的颜色数组,不填视为[0, 0, 0, 0]<br/>time: 渐变时间,单位为毫秒。不填视为750ms,负数视为0(无渐变,立即更改)<br/>callback: 更改完毕后的回调函数,可选。事件流中常取core.doAction",
|
||||
"!type": "fn(color?: [number], time?: number, callback?: fn())"
|
||||
"!doc": "更改画面色调,不计入存档。如需长期生效请使用core.events._action_setCurtain()函数<br/>例如:core.setCurtain(); // 恢复画面色调,用时四分之三秒<br/>color: 一行三列(第四列视为1)或一行四列(第四列若大于1则会被视为1,第四列若为负数则会被视为0)的颜色数组,不填视为[0, 0, 0, 0]<br/>time: 渐变时间,单位为毫秒。不填视为750ms,负数视为0(无渐变,立即更改)<br/>moveMode: 渐变方式<br/>callback: 更改完毕后的回调函数,可选。事件流中常取core.doAction",
|
||||
"!type": "fn(color?: [number], time?: number, moveMode?: string, callback?: fn())"
|
||||
},
|
||||
"updateDamage": {
|
||||
"!doc": "重算并绘制地图显伤<br/>例如:core.updateDamage(); // 更新当前地图的显伤,绘制在显伤层(废话)<br/>floorId: 地图id,不填视为当前地图。预览地图时填写<br/>ctx: 绘制到的画布,如果填写了就会画在该画布而不是显伤层",
|
||||
@ -3817,7 +3817,7 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
||||
"!type": "fn(id?: string, x?: number, y?: number, isGentleClick?: bool)"
|
||||
},
|
||||
"doAction": {
|
||||
"!doc": "执行下一个事件指令,常作为回调<br/>例如:core.setCurtain([0,0,0,1], undefined, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果",
|
||||
"!doc": "执行下一个事件指令,常作为回调<br/>例如:core.setCurtain([0,0,0,1], null, null, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果",
|
||||
"!type": "fn()"
|
||||
},
|
||||
"openBook": {
|
||||
|
||||
@ -2218,49 +2218,52 @@ return code;
|
||||
*/;
|
||||
|
||||
setCurtain_0_s
|
||||
: '更改画面色调' ColorString Colour '动画时间' IntString '持续到下一个本事件' Bool '不等待执行完毕' Bool Newline
|
||||
: '更改画面色调' ColorString Colour '动画时间' IntString? BGNL? Newline '渐变方式' MoveMode_List '持续到下一个本事件' Bool '不等待执行完毕' Bool Newline
|
||||
|
||||
|
||||
/* setCurtain_0_s
|
||||
tooltip : setCurtain: 更改画面色调,动画时间可不填
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : ["255,255,255,1",'rgba(255,255,255,1)',500,true,false]
|
||||
default : ["255,255,255,1",'rgba(255,255,255,1)',500,'',true,false]
|
||||
colour : this.soundColor
|
||||
previewBlock : true
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
MoveMode_List_0 = (MoveMode_List_0!=='') ? (', "moveMode": "'+MoveMode_List_0+'"'):'';
|
||||
Bool_0 = Bool_0 ? ', "keep": true' : '';
|
||||
var async = Bool_1?', "async": true':'';
|
||||
var code = '{"type": "setCurtain", "color": ['+ColorString_0+']'+IntString_0 +Bool_0+async+'},\n';
|
||||
var code = '{"type": "setCurtain", "color": ['+ColorString_0+']'+IntString_0+MoveMode_List_0+Bool_0+async+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
setCurtain_1_s
|
||||
: '恢复画面色调' '动画时间' IntString? '不等待执行完毕' Bool Newline
|
||||
: '恢复画面色调' '动画时间' IntString? '渐变方式' MoveMode_List '不等待执行完毕' Bool Newline
|
||||
|
||||
|
||||
/* setCurtain_1_s
|
||||
tooltip : setCurtain: 恢复画面色调,动画时间可不填
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : [500,false]
|
||||
default : [500,'',false]
|
||||
colour : this.soundColor
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
MoveMode_List_0 = (MoveMode_List_0!=='') ? (', "moveMode": "'+MoveMode_List_0+'"'):'';
|
||||
var async = Bool_0?', "async": true':'';
|
||||
var code = '{"type": "setCurtain"'+IntString_0 +async+'},\n';
|
||||
var code = '{"type": "setCurtain"'+IntString_0+MoveMode_List_0 +async+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
screenFlash_s
|
||||
: '画面闪烁' ColorString Colour '单次时间' Int '执行次数' IntString? '不等待执行完毕' Bool Newline
|
||||
: '画面闪烁' ColorString Colour '单次时间' Int '执行次数' IntString? '渐变方式' MoveMode_List '不等待执行完毕' Bool Newline
|
||||
|
||||
/* screenFlash_s
|
||||
tooltip : screenFlash: 画面闪烁,动画时间可不填
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : ["255,255,255,1",'rgba(255,255,255,1)',500,1,false]
|
||||
default : ["255,255,255,1",'rgba(255,255,255,1)',500,1,'',false]
|
||||
colour : this.soundColor
|
||||
if (ColorString_0 == '') throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
||||
IntString_0 = IntString_0 ? (', "times": '+IntString_0):'';
|
||||
MoveMode_List_0 = (MoveMode_List_0!=='') ? (', "moveMode": "'+MoveMode_List_0+'"'):'';
|
||||
var async = Bool_0?', "async": true':'';
|
||||
var code = '{"type": "screenFlash", "color": ['+ColorString_0+'], "time": '+Int_0 +IntString_0+async+'},\n';
|
||||
var code = '{"type": "screenFlash", "color": ['+ColorString_0+'], "time": '+Int_0 +IntString_0+MoveMode_List_0+async+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
|
||||
@ -605,16 +605,16 @@ ActionParser.prototype.parseAction = function() {
|
||||
if(this.isset(data.color)){
|
||||
data.color = this.Colour(data.color);
|
||||
this.next = MotaActionBlocks['setCurtain_0_s'].xmlText([
|
||||
data.color,'rgba('+data.color+')',data.time,data.keep||false,data.async||false,this.next]);
|
||||
data.color,'rgba('+data.color+')',data.time,data.moveMode,data.keep||false,data.async||false,this.next]);
|
||||
} else {
|
||||
this.next = MotaActionBlocks['setCurtain_1_s'].xmlText([
|
||||
data.time,data.async||false,this.next]);
|
||||
data.time,data.moveMode,data.async||false,this.next]);
|
||||
}
|
||||
break;
|
||||
case "screenFlash": // 画面闪烁
|
||||
data.color = this.Colour(data.color);
|
||||
this.next = MotaActionBlocks['screenFlash_s'].xmlText([
|
||||
data.color,'rgba('+data.color+')',data.time||500,data.times,data.async||false,this.next]);
|
||||
data.color,'rgba('+data.color+')',data.time||500,data.times,data.moveMode,data.async||false,this.next]);
|
||||
break;
|
||||
case "setWeather": // 更改天气
|
||||
this.next = MotaActionBlocks['setWeather_s'].xmlText([
|
||||
|
||||
@ -2679,7 +2679,7 @@ control.prototype._weather_sun = function (level) {
|
||||
}
|
||||
|
||||
////// 更改画面色调 //////
|
||||
control.prototype.setCurtain = function(color, time, callback) {
|
||||
control.prototype.setCurtain = function(color, time, moveMode, callback) {
|
||||
if (time == null) time=750;
|
||||
if (time<=0) time=0;
|
||||
if (!core.status.curtainColor)
|
||||
@ -2697,24 +2697,25 @@ control.prototype.setCurtain = function(color, time, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._setCurtain_animate(core.status.curtainColor, color, time, callback);
|
||||
this._setCurtain_animate(core.status.curtainColor, color, time, moveMode, callback);
|
||||
}
|
||||
|
||||
control.prototype._setCurtain_animate = function (nowColor, color, time, callback) {
|
||||
control.prototype._setCurtain_animate = function (nowColor, color, time, moveMode, callback) {
|
||||
time /= Math.max(core.status.replay.speed, 1)
|
||||
var per_time = 10, step = parseInt(time / per_time);
|
||||
if (step <= 0) step = 1;
|
||||
var per_time = 10, step = 0, steps = parseInt(time / per_time);
|
||||
if (steps <= 0) steps = 1;
|
||||
var moveFunc = core.applyEasing(moveMode);
|
||||
var animate = setInterval(function() {
|
||||
nowColor = [
|
||||
(nowColor[0]*(step-1)+color[0])/step,
|
||||
(nowColor[1]*(step-1)+color[1])/step,
|
||||
(nowColor[2]*(step-1)+color[2])/step,
|
||||
(nowColor[3]*(step-1)+color[3])/step,
|
||||
];
|
||||
step++;
|
||||
var curr = [
|
||||
nowColor[0] + (color[0] - nowColor[0]) * moveFunc(step / steps),
|
||||
nowColor[1] + (color[1] - nowColor[1]) * moveFunc(step / steps),
|
||||
nowColor[2] + (color[2] - nowColor[2]) * moveFunc(step / steps),
|
||||
nowColor[3] + (color[3] - nowColor[3]) * moveFunc(step / steps),
|
||||
]
|
||||
core.clearMap('curtain');
|
||||
core.fillRect('curtain', 0, 0, core.__PIXELS__, core.__PIXELS__, core.arrayToRGBA(nowColor));
|
||||
step--;
|
||||
if (step <= 0) {
|
||||
core.fillRect('curtain', 0, 0, core.__PIXELS__, core.__PIXELS__, core.arrayToRGBA(curr));
|
||||
if (step == steps) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
clearInterval(animate);
|
||||
core.status.curtainColor = color;
|
||||
@ -2726,14 +2727,14 @@ control.prototype._setCurtain_animate = function (nowColor, color, time, callbac
|
||||
}
|
||||
|
||||
////// 画面闪烁 //////
|
||||
control.prototype.screenFlash = function (color, time, times, callback) {
|
||||
control.prototype.screenFlash = function (color, time, times, moveMode, callback) {
|
||||
times = times || 1;
|
||||
time = time / 3;
|
||||
var nowColor = core.clone(core.status.curtainColor);
|
||||
core.setCurtain(color, time, function() {
|
||||
core.setCurtain(nowColor, time * 2, function() {
|
||||
core.setCurtain(color, time, moveMode, function() {
|
||||
core.setCurtain(nowColor, time * 2, moveMode, function() {
|
||||
if (times > 1)
|
||||
core.screenFlash(color, time * 3, times - 1, callback);
|
||||
core.screenFlash(color, time * 3, times - 1, moveMode, callback);
|
||||
else {
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
@ -1662,12 +1662,12 @@ events.prototype._precompile_rotateImage = function (data) {
|
||||
|
||||
events.prototype._action_setCurtain = function (data, x, y, prefix) {
|
||||
if (data.async) {
|
||||
core.setCurtain(data.color, data.time);
|
||||
core.setCurtain(data.color, data.time, data.moveMode);
|
||||
if (data.color == null || data.keep) core.setFlag('__color__', data.color || null);
|
||||
core.doAction();
|
||||
}
|
||||
else {
|
||||
core.setCurtain(data.color, data.time, function () {
|
||||
core.setCurtain(data.color, data.time, data.moveMode, function () {
|
||||
if (data.color == null || data.keep) core.setFlag('__color__', data.color || null);
|
||||
core.doAction();
|
||||
});
|
||||
@ -1675,7 +1675,7 @@ events.prototype._action_setCurtain = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_screenFlash = function (data, x, y, prefix) {
|
||||
this.__action_doAsyncFunc(data.async, core.screenFlash, data.color, data.time, data.times);
|
||||
this.__action_doAsyncFunc(data.async, core.screenFlash, data.color, data.time, data.times, data.moveMode);
|
||||
}
|
||||
|
||||
events.prototype._action_setWeather = function (data, x, y, prefix) {
|
||||
|
||||
6
runtime.d.ts
vendored
6
runtime.d.ts
vendored
@ -572,7 +572,7 @@ declare class control {
|
||||
* @param time 渐变时间,单位为毫秒。不填视为750ms,负数视为0(无渐变,立即更改)
|
||||
* @param callback 更改完毕后的回调函数,可选。事件流中常取core.doAction
|
||||
*/
|
||||
setCurtain(color?: [number, number, number, number?], time?: number, callback?: () => void): void
|
||||
setCurtain(color?: [number, number, number, number?], time?: number, moveMode?: string, callback?: () => void): void
|
||||
|
||||
/**
|
||||
* 画面闪烁
|
||||
@ -582,7 +582,7 @@ declare class control {
|
||||
* @param times 闪烁的总次数,不填或填0都视为1
|
||||
* @param callback 闪烁全部完毕后的回调函数,可选
|
||||
*/
|
||||
screenFlash(color: [number, number, number, number], time: number, times?: number, callback?: () => void): void
|
||||
screenFlash(color: [number, number, number, number], time: number, times?: number, moveMode?: string, callback?: () => void): void
|
||||
|
||||
/**
|
||||
* 播放背景音乐,中途开播但不计入存档且只会持续到下次场景切换。如需长期生效请将背景音乐的文件名赋值给flags.__bgm__
|
||||
@ -900,7 +900,7 @@ declare class events {
|
||||
|
||||
/**
|
||||
* 执行下一个事件指令,常作为回调
|
||||
* @example core.setCurtain([0,0,0,1], undefined, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果
|
||||
* @example core.setCurtain([0,0,0,1], undefined, null, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果
|
||||
* @param keepUI true表示不清除UI画布和选择光标
|
||||
*/
|
||||
doAction(keepUI?: true): void
|
||||
|
||||
Loading…
Reference in New Issue
Block a user