今天來串牌局結果出來之後會顯示輸贏點數,以及顯示勝利的區塊,讓你馬上知道自己贏了沒。
其實牌局在倒數結束之後,就會馬上收到訊息,然後我們就在這邊進行判斷,延遲動畫顯示,浪費生命。不過如果中途重整進入的玩家,將不會看到這些動畫。這問題之後再處理。
大致上就是利用我們之前封裝在各個組件內的方法,統一在這邊一次用好用滿!
並透過await delay延遲動畫顯示。
public async piResult(data: any) {
let pokerPlayer = data.poker_result.player.slice()
let pokerBanker = data.poker_result.banker.slice()
let calcResult = data.calc_result
while (pokerPlayer.length || pokerBanker.length) {
if (pokerPlayer.length) {
let _player = pokerPlayer.splice(0, 1)[0]
this._pokersPlayer.sendPoker(_player.type, _player.symbol)
await delay(1200)
}
if (pokerBanker.length) {
let _banker = pokerBanker.splice(0, 1)[0]
this._pokersBanker.sendPoker(_banker.type, _banker.symbol)
await delay(1200)
}
}
await delay(1500)
this._pokersBanker.displayPokerPoint()
this._pokersPlayer.displayPokerPoint()
if (calcResult.bpair) { this._pokersBanker.displayResult('pair'); this._table.setDeskhover('bpair', true) }
if (calcResult.ppair) { this._pokersPlayer.displayResult('pair'); this._table.setDeskhover('ppair', true) }
if (calcResult.bankerking) { this._pokersBanker.displayResult('king'); this._table.setDeskhover('bankerking', true) }
if (calcResult.playerking) { this._pokersPlayer.displayResult('king'); this._table.setDeskhover('playerking', true) }
if (calcResult.tie) { this._pokersPlayer.displayResult('tie'); this._pokersBanker.displayResult('tie'); this._table.setDeskhover('tie', true) }
if (calcResult.tiepair) { this._pokersPlayer.displayResult('tiepair'); this._pokersBanker.displayResult('tiepair'); this._table.setDeskhover('tiepair', true) }
if (calcResult.banker) { this._pokersBanker.displayWin(); this._table.setDeskhover('banker', true) }
if (calcResult.player) { this._pokersPlayer.displayWin(); this._table.setDeskhover('player', true) }
await delay(10000)
this._table.resetHover()
this._pokersPlayer.reset()
this._pokersBanker.reset()
}