转变图块带淡入淡出时间和异步效果
This commit is contained in:
parent
b45afe0ae4
commit
91e4e40fc0
@ -848,14 +848,14 @@ return code;
|
||||
*/;
|
||||
|
||||
setBlock_s
|
||||
: '转变图块为' EvalString 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
|
||||
: '转变图块为' EvalString 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' IntString? '不等待执行完毕' Bool Newline
|
||||
|
||||
|
||||
/* setBlock_s
|
||||
tooltip : setBlock:设置某个图块,忽略坐标楼层则为当前事件
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
|
||||
colour : this.mapColor
|
||||
default : ["yellowDoor","","",""]
|
||||
default : ["yellowDoor","","","","",false]
|
||||
var floorstr = '';
|
||||
if (EvalString_1 && EvalString_2) {
|
||||
var pattern1 = MotaActionFunctions.pattern.id;
|
||||
@ -874,7 +874,9 @@ if (EvalString_1 && EvalString_2) {
|
||||
floorstr = ', "loc": ['+EvalString_1.join(',')+']';
|
||||
}
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
var code = '{"type": "setBlock", "number": "'+EvalString_0+'"'+floorstr+IdString_0+'},\n';
|
||||
IntString_0 = IntString_0 && (', "time": ' + IntString_0);
|
||||
Bool_0 = Bool_0 ? (', "async": true') : '';
|
||||
var code = '{"type": "setBlock", "number": "'+EvalString_0+'"'+floorstr+IdString_0+IntString_0+Bool_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
y_str.push(t[1]);
|
||||
})
|
||||
this.next = MotaActionBlocks['setBlock_s'].xmlText([
|
||||
data.number||0,x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
|
||||
data.number||0,x_str.join(','),y_str.join(','),data.floorId||'',data.time,data.async||false,this.next]);
|
||||
break;
|
||||
case "turnBlock": // 事件转向
|
||||
data.loc=data.loc||[];
|
||||
|
||||
@ -1306,10 +1306,16 @@ events.prototype._action_hide = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_setBlock = function (data, x, y, prefix) {
|
||||
data.loc = this.__action_getLoc2D(data.loc, x, y, prefix);
|
||||
data.loc.forEach(function (t) {
|
||||
core.setBlock(data.number, t[0], t[1], data.floorId);
|
||||
});
|
||||
core.doAction();
|
||||
data.time = data.time || 0;
|
||||
data.floorId = data.floorId || core.status.floorId;
|
||||
if (data.time > 0 && data.floorId == core.status.floorId) {
|
||||
this.__action_doAsyncFunc(data.async, core.animateSetBlocks, data.number, data.loc, data.floorId, data.time);
|
||||
} else {
|
||||
data.loc.forEach(function (loc) {
|
||||
core.setBlock(data.number, loc[0], loc[1], data.floorId);
|
||||
});
|
||||
core.doAction();
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype._action_turnBlock = function (data, x, y, prefix) {
|
||||
|
||||
97
libs/maps.js
97
libs/maps.js
@ -1638,6 +1638,103 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype.animateSetBlock = function (number, x, y, floorId, time, callback) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
time = time || 0;
|
||||
if (floorId != core.status.floorId || time == 0) {
|
||||
// 不在当前楼层,直接忽略
|
||||
this.setBlock(number, x, y, floorId);
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
if (typeof number == 'string') {
|
||||
if (/^\d+$/.test(number)) number = parseInt(number);
|
||||
else number = core.getNumberById(number);
|
||||
}
|
||||
var originBlock = core.getBlock(x, y, floorId, true);
|
||||
var block = this.initBlock(x, y, number, true, core.floors[floorId]);
|
||||
|
||||
// 如果原本是启用的
|
||||
if (originBlock != null && !originBlock.block.disable) {
|
||||
return this._animateSetBlock_originEnabled(block, number, x, y, floorId, time, callback);
|
||||
}
|
||||
|
||||
// 如果原本不存在
|
||||
if (originBlock == null) {
|
||||
return this._animateSetBlock_originNotExists(block, number, x, y, floorId, time, callback);
|
||||
}
|
||||
|
||||
// 如果原本存在且禁用;应当直接设置,没有动画
|
||||
if (originBlock != null && originBlock.block.disable) {
|
||||
return this._animateSetBlock_originDisabled(number, x, y, floorId, callback);
|
||||
}
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
maps.prototype._animateSetBlock_originEnabled = function (block, number, x, y, floorId, time, callback) {
|
||||
// 情况1:设置到0
|
||||
if (block.id == 0) {
|
||||
// 如果该点红点没有事件 - 直接删除
|
||||
if (!block.event.trigger) {
|
||||
return this.animateBlock([x, y], 'remove', time, callback);
|
||||
} else {
|
||||
// 如果该点红点有事件;则设置到0,但是需启用
|
||||
return this.animateBlock([x, y], 'hide', time, function () {
|
||||
core.setBlock(0, x, y, floorId);
|
||||
core.showBlock(x, y, floorId);
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
// 情况2:设置到非0
|
||||
else {
|
||||
return this.animateBlock([x, y], 'hide', time / 2, function () {
|
||||
core.setBlock(number, x, y, floorId);
|
||||
core.animateBlock([x, y], 'show', time / 2, callback);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype._animateSetBlock_originNotExists = function (block, number, x, y, floorId, time, callback) {
|
||||
// 情况1:设置到0;没有动画效果
|
||||
if (block.id == 0) {
|
||||
core.setBlock(number, x, y, floorId);
|
||||
if (callback) callback();
|
||||
}
|
||||
else {
|
||||
// 情况2:设置到非0,有淡入动画
|
||||
core.setBlock(number, x, y, floorId);
|
||||
core.hideBlock(x, y, floorId);
|
||||
core.animateBlock([x, y], 'show', time, callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype._animateSetBlock_originDisabled = function (number, x, y, floorId, callback) {
|
||||
core.setBlock(number, x, y, floorId);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
maps.prototype.animateSetBlocks = function (number, locs, floorId, time, callback) {
|
||||
if (!(locs instanceof Array)) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
if (typeof locs[0] == 'number' && typeof locs[1] == 'number')
|
||||
locs = [locs];
|
||||
|
||||
var count = locs.length;
|
||||
var _afterSet = function () {
|
||||
count--;
|
||||
if (count == 0) {
|
||||
if (callback) callback();
|
||||
}
|
||||
}
|
||||
locs.forEach(function (loc) {
|
||||
core.animateSetBlock(number, loc[0], loc[1], floorId, time, _afterSet);
|
||||
});
|
||||
}
|
||||
|
||||
////// 事件转向 //////
|
||||
maps.prototype.turnBlock = function (direction, x, y, floorId) {
|
||||
var id = core.getBlockId(x, y, floorId, true);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
(已完成!) 7. 建议把core.playBgm(bgm, startTime)的startTime参数在事件中也提供出来,以用于一些演出(比如适当的剧情处直接从高潮开始)。同理可以让“暂停背景音乐”记录下当前播放到了第几秒,并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
|
||||
(已完成!) 8. 系统设置菜单中“音量”和“步时”的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
|
||||
(已完成!) 9. 建议给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”,用来实现一些如新新2的QTE,录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
|
||||
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
|
||||
(已完成!) 10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
|
||||
(已完成!) 11. 建议修复勇士后退时跟随者的鬼畜行为,并推出一套能够对跟随者位置和朝向进行读写的API甚至事件,且允许这些信息被计入存档,以实现一些演出效果甚至游戏要素,如新新2用公主占位防冰块
|
||||
(已完成!) 12. “设置怪物属性”事件的下拉框目前只支持一部分,另一部分只能通过手敲json再解析来得到,希望提供完整支持
|
||||
(已完成!) 13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
|
||||
@ -49,6 +49,7 @@
|
||||
(已完成!) 素材列表选择
|
||||
(已完成!) 油漆桶,动态更改地图大小
|
||||
地图拉框选择复制剪切删除
|
||||
额外素材区拖动选择一个区域
|
||||
(已完成!) 素材替换
|
||||
大屏幕下放大游戏界面
|
||||
(已完成!) 最近使用/最常使用的图块
|
||||
@ -116,7 +117,7 @@
|
||||
(已修复!) 49. 系统设置菜单中音量和步时的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
|
||||
(不处理) 50. 建议给录像播放时的N键提供一个对应的移动端操作,以方便移动端作者
|
||||
(已完成!) 51. 希望给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”,用来实现一些QTE,录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
|
||||
52. 希望给“转变图块”加一个淡入时间参数(显隐和转变图层块也希望加个淡入淡出时间参数,图层块也希望提供移动和跳跃事件),专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点,然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题,且会导致core.removeBlock()(隐藏事件)退化为core.hideBlock()
|
||||
(已完成!) 52. 希望给“转变图块”加一个淡入时间参数(显隐和转变图层块也希望加个淡入淡出时间参数,图层块也希望提供移动和跳跃事件),专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点,然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题,且会导致core.removeBlock()(隐藏事件)退化为core.hideBlock()
|
||||
(不处理) 53. 希望“移动事件”的移速和淡出速度拆开成两个参数,目前这样捆绑在一起不太自由
|
||||
(已完成) 54. 建议把图块属性的noPass改为勾选框而不是下拉框,因为null一定表示不可通行(道具根本没有noPass)
|
||||
(不处理,可以转变图块) 55. “移动事件”和“跳跃事件”会导致本来勾选了不显伤的怪物突然有了显伤,非常难看,建议优化
|
||||
|
||||
Loading…
Reference in New Issue
Block a user