37 lines
950 B
Swift
37 lines
950 B
Swift
import Foundation
|
|
import WebSocketKit
|
|
|
|
protocol ManageableTable {
|
|
|
|
/// The unique id of the table
|
|
var id: UUID { get }
|
|
|
|
/// The name of the table
|
|
var name: TableName { get }
|
|
|
|
/// The table is visible in the list of tables and can be joined by anyone
|
|
var isPublic: Bool { get }
|
|
|
|
var leavePenalty: Int { get }
|
|
|
|
var playerNames: [PlayerName] { get }
|
|
|
|
var allPlayers: [Player] { get }
|
|
|
|
var publicInfo: PublicTableInfo { get }
|
|
|
|
func tableInfo(forPlayer player: PlayerName) -> TableInfo
|
|
|
|
func perform(action: PlayerAction, forPlayer: PlayerName) -> (result: PlayerActionResult, table: ManageableTable?)
|
|
|
|
func play(card: Card, player name: PlayerName) -> (result: PlayerActionResult, table: ManageableTable?)
|
|
|
|
func connect(player name: PlayerName, using socket: WebSocket) -> Bool
|
|
|
|
func disconnect(player name: PlayerName)
|
|
|
|
func sendUpdateToAllPlayers()
|
|
|
|
func disconnectAllPlayers()
|
|
}
|