drawAnimate stop

This commit is contained in:
oc 2018-12-26 00:16:08 +08:00
parent 6169c1b092
commit 46f075e996
4 changed files with 20 additions and 4 deletions

View File

@ -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窗口的绘制比如对话框、怪物手册、楼传器、存读档界面等等。

View File

@ -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() {

View File

@ -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);
}
////// 更新领域、夹击、阻击的伤害地图 //////

View File

@ -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) {