From 6e6f09b5e7fa3c0ed369a98b1b8ac93adfbfa3c1 Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Wed, 11 Oct 2017 18:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20implement=20card.beforeMove()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Card.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Card.js b/Card.js index 35a72cb..ae20553 100644 --- a/Card.js +++ b/Card.js @@ -100,6 +100,9 @@ function Card (game,player,zone,pid,side) { this.sideB = info.sideB? new Card(game,player,zone,info.sideB,this) : null; } + // 特殊钩子 + this.beforeMove = info.beforeMove; + // Lostorage this.coin = info.coin || 0; this.bet = info.bet || 0; @@ -1009,6 +1012,9 @@ Card.prototype.moveTo = function (zone,arg) { } // 移动卡片 + if (card.beforeMove) { + card.beforeMove() + } removeFromArr(card,card.zone.cards); card.isUp = arg.up; card.isFaceup = arg.faceup;