Merge remote-tracking branch 'refs/remotes/ckcz123/master' into dev-2.0-functions-20180227

This commit is contained in:
YouWei Zhao 2018-02-28 20:15:09 +08:00
commit b48b361a15
6 changed files with 43 additions and 8 deletions

View File

@ -58,6 +58,7 @@ HTML5 canvas制作的魔塔样板支持全平台游戏
* [x] 现在可以支持滑冰和推箱子事件了。
* [x] 地图中每个块的可通行方向控制(悬崖效果)。
* [x] 动画支持带旋转和翻转的帧。
* [x] 长按屏幕可跳过对话。
* [x] 现在可以允许用户丢弃道具了(例如不会再使用的装备)。
* [x] 修复行走时按键会发生动画抖动问题。
* [x] 修复无法打开战斗动画的Bug。

View File

@ -303,7 +303,7 @@ position为可选项表示设置文字显示位置。只能为upc
bold为可选项如果设置则为true或false表示正文是否使用粗体。 默认值:`false`
time为可选项表示文字滚动的速度。若此项设置为0将直接全部显示若大于0则会设置为相邻字符依次显示的时间间隔。 默认值:`50`
time为可选项表示文字添加的速度。若此项设置为0将直接全部显示若大于0则会设置为相邻字符依次显示的时间间隔。 默认值:`0`
### tip显示一段提示文字

View File

@ -17,12 +17,14 @@ function core() {
this.timeout = {
'getItemTipTimeout': null,
'turnHeroTimeout': null,
'onDownTimeout': null,
}
this.interval = {
'heroMoveInterval': null,
"tipAnimate": null,
'openDoorAnimate': null,
'animateInterval': null,
'onDownInterval': null,
}
this.animateFrame = {
'background': null,
@ -132,7 +134,7 @@ function core() {
"background": [0,0,0,0.85],
"text": [255,255,255,1],
"bold": false,
"time": 50,
"time": 0,
},
'curtainColor': null,
'usingCenterFly':false,
@ -777,8 +779,13 @@ core.prototype.clearStatus = function() {
core.prototype.resetStatus = function(hero, hard, floorId, route, maps) {
// 停止各个Timeout和Interval
for (var i in core.timeout) {
clearTimeout(core.timeout[i]);
core.timeout[i] = null;
}
for (var i in core.interval) {
clearInterval(core.interval[i]);
core.interval[i] = null;
}
// 初始化status
@ -1231,6 +1238,18 @@ core.prototype.ondown = function (x ,y) {
if (core.isset(core.status.replay)&&core.status.replay.replaying) return;
if (!core.status.played || core.status.lockControl) {
core.onclick(x, y, []);
if (core.timeout.onDownTimeout==null) {
core.timeout.onDownTimeout = setTimeout(function () {
if (core.interval.onDownInterval == null) {
core.interval.onDownInterval = setInterval(function () {
if (!core.events.longClick()) {
clearInterval(core.interval.onDownInterval);
core.interval.onDownInterval = null;
}
}, 40)
}
}, 500);
}
return;
}
@ -1273,6 +1292,12 @@ core.prototype.onmove = function (x ,y) {
////// 当点击(触摸)事件放开时 //////
core.prototype.onup = function () {
if (core.isset(core.status.replay)&&core.status.replay.replaying) return;
clearTimeout(core.timeout.onDownTimeout);
core.timeout.onDownTimeout = null;
clearInterval(core.interval.onDownInterval);
core.interval.onDownInterval = null;
// core.status.holdingPath=0;
if(core.status.stepPostfix.length>0){
var stepPostfix = [];
@ -1292,7 +1317,10 @@ core.prototype.onup = function () {
// 长按
if (!core.status.lockControl && stepPostfix.length==0 && core.status.downTime!=null && new Date()-core.status.downTime>=1000) {
core.events.longClick();
core.waitHeroToStop(function () {
// 绘制快捷键
core.ui.drawKeyBoard();
});
}
else {
//posx,posy是寻路的目标点,stepPostfix是后续的移动

View File

@ -904,10 +904,15 @@ events.prototype.afterLoadData = eventdata.afterLoadData
////// 长按 //////
events.prototype.longClick = function () {
core.waitHeroToStop(function () {
// 绘制快捷键
core.ui.drawKeyBoard();
});
if (core.status.event.id=='text') {
core.drawText();
return true;
}
if (core.status.event.id=='action' && core.status.event.data.type=='text') {
this.doAction();
return true;
}
return false;
}
////// 按下Ctrl键时快捷跳过对话 //////

View File

@ -1417,7 +1417,7 @@ ui.prototype.drawHelp = function () {
"点任意块并拖动: 指定寻路路线\n"+
"单击勇士: 转向\n"+
"双击勇士: 轻按(仅在轻按开关打开时有效)\n"+
"长按任意位置:打开虚拟键盘"
"长按任意位置:跳过剧情对话或打开虚拟键盘\n"
]);
}

View File

@ -9,6 +9,7 @@
现在可以支持滑冰和推箱子事件了。
地图中每个块的可通行方向控制(悬崖效果)。
动画支持带旋转和翻转的帧。
长按屏幕可跳过对话。
现在可以允许用户丢弃道具了(例如不会再使用的装备)。
修复行走时按键会发生动画抖动问题。
修复无法打开战斗动画的Bug。