This commit is contained in:
libccy 2018-01-18 21:30:41 +08:00
parent a8977a3b5a
commit 28d46ca390
2 changed files with 79 additions and 77 deletions

View File

@ -701,14 +701,15 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
if(_status.currentChessFocus){
cancelAnimationFrame(_status.currentChessFocus);
}
var count=12;
var ddx=Math.floor(dx/12);
var ddy=Math.floor(dy/12);
var count=lib.config.low_performance?6:12;
var ddx=Math.floor(dx/count);
var ddy=Math.floor(dy/count);
if(dx||dy){
_status.currentChessFocus=requestAnimationFrame(function(){
var chessFocus=function(){
if(count--){
ui.chessContainer.scrollLeft+=ddx;
ui.chessContainer.scrollTop+=ddy;
_status.currentChessFocus=requestAnimationFrame(chessFocus);
}
else{
ui.chessContainer.scrollLeft+=dx%12;
@ -716,7 +717,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
cancelAnimationFrame(_status.currentChessFocus);
delete _status.currentChessFocus;
}
});
};
_status.currentChessFocus=requestAnimationFrame(chessFocus);
}
},
getXY:function(){

View File

@ -34,7 +34,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
get.chessDistance=result.get.chessDistance;
get.rawAttitude=result.get.rawAttitude;
var toLoad=['addChessPlayer','addObstacle','removeObstacle','isChessNeighbour',
'draw2','updateCanvas2','setChessInfo','modeSwapPlayer'];
'draw2','updateCanvas2','setChessInfo','modeSwapPlayer','initChess'];
for(var i=0;i<toLoad.length;i++){
game[toLoad[i]]=result.game[toLoad[i]];
}