diff --git a/Card.js b/Card.js index 0009d5e..f8d1ed4 100644 --- a/Card.js +++ b/Card.js @@ -12,6 +12,7 @@ function Card (game,isWhiteBack) { this.zone = null; this.zIndex = 0; this.changed = true; + this.isSide = false; // 双面共鸣, isSide 为 true 时,不计入区域卡片数量,不显示动画. // 渲染层 // 因为EasleJS没有位置偏移(translate), @@ -96,8 +97,9 @@ Card.prototype.facedown = function () { this.style.transit('scaleX',-1,0.2); }; -Card.prototype.move = function (pid,zone,up,faceup,bottom) { +Card.prototype.move = function (pid,zone,up,faceup,bottom,isSide) { this.pid = pid; + this.isSide = isSide; this.floatdown(); if (this.zone) this.zone.removeCard(this); @@ -109,14 +111,15 @@ Card.prototype.move = function (pid,zone,up,faceup,bottom) { }; Card.prototype.moveTo = function (x,y,coveredMoving,coveredSettaled) { - this.style.transit('x',x,0.2); - this.style.transit('y',y,0.2); + var duration = this.isSide? 0 : 0.2; + this.style.transit('x',x,duration); + this.style.transit('y',y,duration); if (x !== this.x || y !== this.y) { this.style.set('top',true); - this.style.transit('top',false,0.2); + this.style.transit('top',false,duration); } this.style.set('covered',coveredMoving); - this.style.transit('covered',coveredSettaled,0.2); + this.style.transit('covered',coveredSettaled,duration); }; Card.prototype.floatup = function () { diff --git a/Game.js b/Game.js index 6b00b2c..3fc58cf 100644 --- a/Game.js +++ b/Game.js @@ -118,7 +118,8 @@ Game.prototype.handleInit = function (msg) { zones.lrigDeckCards.forEach(function (sid,i) { var card = new Card(this,true); this.setSid(card,sid); - card.move(zones.lrigDeckCardIds[i],player.lrigDeck,true,false,false); + var info = zones.lrigDeckCardInfos[i]; + card.move(info.pid,player.lrigDeck,true,false,false,info.isSide); },this); } @@ -163,7 +164,7 @@ Game.prototype.handlePackedMsgEnd = function () { Game.prototype.handleMoveCard = function (msg) { var card = this.getObjBySid(msg.card); var zone = this.getObjBySid(msg.zone); - card.move(msg.pid,zone,msg.up,msg.faceup,msg.bottom); + card.move(msg.pid,zone,msg.up,msg.faceup,msg.bottom,msg.isSide); return false; }; diff --git a/Zone.js b/Zone.js index af6f89e..10084aa 100644 --- a/Zone.js +++ b/Zone.js @@ -59,8 +59,11 @@ Zone.prototype.getCardIndex = function (card) { }; Zone.prototype.updateCardPosition = function () {}; Zone.prototype.update = function () { - if (this.showAmount && (this._amount !== this.cards.length)) { - this._amount = this.cards.length; + var len = this.cards.filter(function (card) { + return !card.isSide; + },this).length; + if (this.showAmount && (this._amount !== len)) { + this._amount = len; var txt = (this._amount === 0)? '' : this._amount; this.setText(txt); } diff --git a/index.html b/index.html index 448a35b..d3179c8 100644 --- a/index.html +++ b/index.html @@ -223,12 +223,12 @@ - + - + \ No newline at end of file