drawAnimate stop
This commit is contained in:
parent
6169c1b092
commit
46f075e996
14
docs/api.md
14
docs/api.md
@ -330,9 +330,15 @@ control.js主要用来进行游戏控制,比如行走控制、自动寻路、
|
||||
core.control.setGameCanvasTranslate(canvasId, x, y)
|
||||
设置大地图的偏移量
|
||||
|
||||
|
||||
core.control.updateViewport()
|
||||
更新大地图的可见区域
|
||||
|
||||
|
||||
core.control.gatherFollowers()
|
||||
立刻聚集所有的跟随者
|
||||
|
||||
|
||||
core.control.replay()
|
||||
回放下一个操作
|
||||
|
||||
@ -463,6 +469,14 @@ core.maps.removeBlockByIds(floorId, ids)
|
||||
根据索引删除或禁用若干块。
|
||||
|
||||
|
||||
core.maps.drawAnimate(name, x, y, callback)
|
||||
播放一段动画,name为动画名(需在全塔属性注册),x和y为坐标(0-12之间),callback可选,为播放完毕的回调函数。
|
||||
播放过程是异步的,如需等待播放完毕请使用insertAction插入一条type:waitAsync事件。
|
||||
此函数将随机返回一个数字id。将 "stopAnimate_"+id 这个flag置为true则可以立刻停止该动画的播放,如:
|
||||
var id = core.maps.drawAnimate("zone", 3, 3);
|
||||
core.setFlag("stopAnimate_"+id, true); // 立刻停止动画的播放
|
||||
|
||||
|
||||
========== core.ui.XXX 和对话框绘制相关的函数 ==========
|
||||
ui.js主要用来进行UI窗口的绘制,比如对话框、怪物手册、楼传器、存读档界面等等。
|
||||
|
||||
|
||||
@ -122,9 +122,10 @@ control.prototype.setRequestAnimationFrame = function () {
|
||||
var animateObjs = [];
|
||||
for (var i=0;i<core.status.animateObjs.length;i++) {
|
||||
var obj = core.status.animateObjs[i];
|
||||
if (obj.index == obj.animate.frames.length) {
|
||||
if (obj.index == obj.animate.frames.length || core.hasFlag("stopAnimate_"+obj.id)) {
|
||||
// 绘制完毕
|
||||
delete core.animateFrame.asyncId[obj.id];
|
||||
core.removeFlag("stopAnimate_"+obj.id);
|
||||
// 异步执行回调...
|
||||
(function(callback) {
|
||||
setTimeout(function() {
|
||||
|
||||
@ -892,7 +892,7 @@ core.prototype.drawBoxAnimate = function () {
|
||||
|
||||
////// 绘制动画 //////
|
||||
core.prototype.drawAnimate = function (name, x, y, callback) {
|
||||
core.maps.drawAnimate(name, x, y, callback);
|
||||
return core.maps.drawAnimate(name, x, y, callback);
|
||||
}
|
||||
|
||||
////// 更新领域、夹击、阻击的伤害地图 //////
|
||||
|
||||
@ -1359,13 +1359,13 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
||||
// 正在播放录像:不显示动画
|
||||
if (core.isset(core.status.replay) && core.status.replay.replaying) {
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 检测动画是否存在
|
||||
if (!core.isset(core.material.animates[name]) || !core.isset(x) || !core.isset(y)) {
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 开始绘制
|
||||
@ -1384,6 +1384,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
||||
});
|
||||
|
||||
core.animateFrame.asyncId[animateId] = true;
|
||||
return animateId;
|
||||
}
|
||||
|
||||
maps.prototype.setFloorImage = function (type, loc, floorId, callback) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user