dobule sided resona UI

This commit is contained in:
WEBXOSS 2016-10-25 19:40:54 +08:00
parent a309b946d2
commit f881366379
4 changed files with 20 additions and 13 deletions

13
Card.js
View file

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

View file

@ -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;
};

View file

@ -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);
}

View file

@ -223,12 +223,12 @@
<script src="./CardInfo.js" defer="defer"></script>
<script src="./CardInfo_ru.js" defer="defer"></script>
<script src="./Localize.min.js" defer="defer"></script>
<!-- <script src="./Localize.min.js" defer="defer"></script>
<script src="./ImageAndDetail.min.js" defer="defer"></script>
<script src="./DeckEditor/Deck.min.js" defer="defer"></script>
<script src="./webxoss.js" defer="defer"></script>
<script src="./webxoss.js" defer="defer"></script> -->
<!-- <script src="./Localize.js" defer="defer"></script>
<script src="./Localize.js" defer="defer"></script>
<script src="./ImageFileCache.js" defer="defer"></script>
<script src="./ImageManager.js" defer="defer"></script>
<script src="./Detail.js" defer="defer"></script>
@ -253,6 +253,6 @@
<script src="./DeckManager.js" defer="defer"></script>
<script src="./DeckEditor/Rules.js" defer="defer"></script>
<script src="./DeckEditor/Searcher.js" defer="defer"></script>
<script src="./RoomManager.js" defer="defer"></script> -->
<script src="./RoomManager.js" defer="defer"></script>
</body>
</html>