Clean up code
Update WeddingPlayer.swift
This commit is contained in:
parent
f10c3dc8c9
commit
707c6d03de
@ -293,21 +293,13 @@ function setInfoForPlayer(player, position, game) {
|
|||||||
const layer = player.position
|
const layer = player.position
|
||||||
setTableCard(position, card, layer)
|
setTableCard(position, card, layer)
|
||||||
setTablePlayerName(position, player.name, player.active)
|
setTablePlayerName(position, player.name, player.active)
|
||||||
// if (!player.connected) {
|
|
||||||
// showPlayerDisconnected(position)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
var state = player.state
|
var state = player.state
|
||||||
if (game != null && state.indexOf("selects") > -1) {
|
if (game != null && state.indexOf("selects") > -1) {
|
||||||
const i = state.indexOf("selects")
|
const i = state.indexOf("selects")
|
||||||
state[i] = game
|
state[i] = game
|
||||||
}
|
}
|
||||||
|
|
||||||
// const double = doubleText(player.doubles)
|
|
||||||
// if (double) {
|
|
||||||
// state.push(double)
|
|
||||||
// }
|
|
||||||
|
|
||||||
const text = state.map(x => convertStateToString(x)).join("<br>")
|
const text = state.map(x => convertStateToString(x)).join("<br>")
|
||||||
showPlayerState(position, text)
|
showPlayerState(position, text)
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,6 @@ struct PlayerInfo: Codable, Equatable {
|
|||||||
/// The number of times the player doubled the game cost (initial double and raises)
|
/// The number of times the player doubled the game cost (initial double and raises)
|
||||||
var numberOfDoubles = 0
|
var numberOfDoubles = 0
|
||||||
|
|
||||||
var leadsGame = false
|
|
||||||
|
|
||||||
var state: [PlayerStateId] = []
|
var state: [PlayerStateId] = []
|
||||||
|
|
||||||
init(name: PlayerName) {
|
init(name: PlayerName) {
|
||||||
@ -39,7 +37,6 @@ struct PlayerInfo: Codable, Equatable {
|
|||||||
case playedCard = "card"
|
case playedCard = "card"
|
||||||
case positionInTrick = "position"
|
case positionInTrick = "position"
|
||||||
case numberOfDoubles = "doubles"
|
case numberOfDoubles = "doubles"
|
||||||
case leadsGame = "leads"
|
|
||||||
case state = "state"
|
case state = "state"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,4 @@ final class WeddingPlayer: CardHoldingPlayer {
|
|||||||
func replace(_ card: Card, with trumpCard: Card) {
|
func replace(_ card: Card, with trumpCard: Card) {
|
||||||
cards = (cards.filter { $0 != card } + [trumpCard]).sortedCards(forGame: .hochzeit)
|
cards = (cards.filter { $0 != card } + [trumpCard]).sortedCards(forGame: .hochzeit)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var info: PlayerInfo {
|
|
||||||
var info = super.info
|
|
||||||
info.leadsGame = offersWedding || selectsGame
|
|
||||||
return info
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user