From 540a4e438a0d8480c46e5ee02ed45737a6d62299 Mon Sep 17 00:00:00 2001 From: libccy Date: Sat, 11 Feb 2017 11:43:16 +0800 Subject: [PATCH] m --- game/game.js | 170 +++++++++++++++++++++++++------------- layout/default/layout.css | 3 + 2 files changed, 116 insertions(+), 57 deletions(-) diff --git a/game/game.js b/game/game.js index 5e33cf3d2..1e5a456e7 100644 --- a/game/game.js +++ b/game/game.js @@ -13,7 +13,8 @@ ai:{}, lastdragchange:[], skillaudio:[], - dieClose:[] + dieClose:[], + dragline:[], }; var lib={ configprefix:'noname_0.9_', @@ -19254,6 +19255,7 @@ var opacity=1; var color=[255,255,255]; var dashed=false; + var drag=false; if(typeof arguments[1]=='object'){ for(var i in arguments[1]){ switch(i){ @@ -19276,11 +19278,33 @@ else if(color=='green'){ color=[141, 255, 216]; } - var node=ui.create.div('.linexy.hidden'); - node.style.transitionDuration=(total/3000)+'s'; - node.style.left=from[0]+'px'; - node.style.top=from[1]+'px'; - node.style.background='linear-gradient(transparent,rgba('+color.toString()+','+opacity+'),rgba('+color.toString()+','+opacity+'))'; + var node; + if(arguments[1]=='drag'){ + color=[236, 201, 71]; + drag=true; + if(arguments[2]){ + node=arguments[2] + } + else{ + node=ui.create.div('.linexy.drag'); + node.style.left=from[0]+'px'; + node.style.top=from[1]+'px'; + node.style.background='linear-gradient(transparent,rgba('+color.toString()+','+opacity+'),rgba('+color.toString()+','+opacity+'))'; + if(game.chess){ + ui.chess.appendChild(node); + } + else{ + ui.arena.appendChild(node); + } + } + } + else{ + node=ui.create.div('.linexy.hidden'); + node.style.left=from[0]+'px'; + node.style.top=from[1]+'px'; + node.style.background='linear-gradient(transparent,rgba('+color.toString()+','+opacity+'),rgba('+color.toString()+','+opacity+'))'; + node.style.transitionDuration=(total/3000)+'s'; + } var dy=to[1]-from[1]; var dx=to[0]-from[0]; var deg=Math.atan(Math.abs(dy)/Math.abs(dx))/Math.PI*180; @@ -19300,23 +19324,30 @@ deg+=270; } } - node.style.transform='rotate('+(-deg)+'deg) scaleY(0)'; - node.style.height=get.xyDistance(from,to)+'px'; - if(game.chess){ - ui.chess.appendChild(node); + if(drag){ + node.style.transform='rotate('+(-deg)+'deg)'; + node.style.height=get.xyDistance(from,to)+'px'; } else{ - ui.arena.appendChild(node); + node.style.transform='rotate('+(-deg)+'deg) scaleY(0)'; + node.style.height=get.xyDistance(from,to)+'px'; + if(game.chess){ + ui.chess.appendChild(node); + } + else{ + ui.arena.appendChild(node); + } + ui.refresh(node); + node.show(); + node.style.transform='rotate('+(-deg)+'deg) scaleY(1)'; + node.listenTransition(function(){ + setTimeout(function(){ + if(node.classList.contains('removing')) return; + node.delete(); + },total/3); + }); } - ui.refresh(node); - node.show(); - node.style.transform='rotate('+(-deg)+'deg) scaleY(1)'; - node.listenTransition(function(){ - setTimeout(function(){ - if(node.classList.contains('removing')) return; - node.delete(); - },total/3); - }); + return node; }, _linexy:function(path){ var from=[path[0],path[1]]; @@ -20899,6 +20930,9 @@ for(var i=0;i