27 lines
485 B
Swift
27 lines
485 B
Swift
import Foundation
|
|
import WebSocketKit
|
|
|
|
class AbstractPlayer {
|
|
|
|
let name: PlayerName
|
|
|
|
var socket: WebSocket?
|
|
|
|
init(name: PlayerName, socket: WebSocket? = nil) {
|
|
self.name = name
|
|
self.socket = socket
|
|
}
|
|
|
|
init(player: Player) {
|
|
self.name = player.name
|
|
self.socket = player.socket
|
|
}
|
|
}
|
|
|
|
extension AbstractPlayer: Equatable {
|
|
|
|
static func == (lhs: AbstractPlayer, rhs: AbstractPlayer) -> Bool {
|
|
lhs.name == rhs.name
|
|
}
|
|
}
|