34 lines
618 B
Swift
34 lines
618 B
Swift
import Foundation
|
|
|
|
struct TableInfo: ClientMessage {
|
|
|
|
static let type: ClientMessageType = .tableInfo
|
|
|
|
let id: String
|
|
|
|
let name: String
|
|
|
|
let players: [PlayerState]
|
|
|
|
let tableIsFull: Bool
|
|
|
|
struct PlayerState: Codable, Equatable {
|
|
|
|
let name: PlayerName
|
|
|
|
let connected: Bool
|
|
|
|
init(name: PlayerName, connected: Bool) {
|
|
self.name = name
|
|
self.connected = connected
|
|
}
|
|
}
|
|
}
|
|
|
|
extension TableInfo: Comparable {
|
|
|
|
static func < (lhs: TableInfo, rhs: TableInfo) -> Bool {
|
|
lhs.name < rhs.name
|
|
}
|
|
}
|