Documentation ¶
Index ¶
- type Communicator
- type FingerPoint
- type LogCommunicator
- type MockCommunicator
- type Player
- func (p *Player) AddView(v *View)
- func (p *Player) Message(t server.MessageType, payload interface{}) error
- func (p *Player) Play()
- func (p *Player) Reconnect(c Communicator)
- func (p *Player) Reveal() *server.RevealedPlayer
- func (p *Player) SetGameChannel(gc gamechannel.GameChannel)
- func (p *Player) SetName(name string)
- func (p *Player) SetRole(r *role.Role)
- func (p *Player) String() string
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Communicator ¶ added in v0.7.0
type Communicator interface { ReadMessage() (messageType int, p []byte, err error) WriteMessage(messageType int, data []byte) error Close() error }
A Communicator is an interface that is satisfied by github.com/gorilla/websocket and can be implemented by mocked/stubbed structs for testing and web-independent purposes.
type FingerPoint ¶ added in v0.4.0
A FingerPoint represents one player "pointing" at another in a real-life game of Werewolf. It can be used for both votes and night actions.
func (*FingerPoint) String ¶ added in v0.6.0
func (fp *FingerPoint) String() string
type LogCommunicator ¶ added in v0.20.0
type LogCommunicator struct { }
func NewLogCommunicator ¶ added in v0.20.0
func NewLogCommunicator() *LogCommunicator
func (*LogCommunicator) Close ¶ added in v0.20.0
func (mc *LogCommunicator) Close() error
func (*LogCommunicator) ReadMessage ¶ added in v0.20.0
func (mc *LogCommunicator) ReadMessage() (int, []byte, error)
func (*LogCommunicator) WriteMessage ¶ added in v0.20.0
func (mc *LogCommunicator) WriteMessage(messageType int, data []byte) error
type MockCommunicator ¶ added in v0.7.0
func NewMockCommunicator ¶ added in v0.7.0
func NewMockCommunicator() *MockCommunicator
func (*MockCommunicator) Close ¶ added in v0.7.0
func (mc *MockCommunicator) Close() error
func (*MockCommunicator) ReadMessage ¶ added in v0.7.0
func (mc *MockCommunicator) ReadMessage() (int, []byte, error)
func (*MockCommunicator) WriteMessage ¶ added in v0.7.0
func (mc *MockCommunicator) WriteMessage(messageType int, data []byte) error
type Player ¶
type Player struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Role *role.Role `json:"-"` Views []*View `json:"-"` // contains filtered or unexported fields }
func NewPlayer ¶ added in v0.2.0
func NewPlayer(socket Communicator) *Player
func (*Player) Message ¶ added in v0.7.0
func (p *Player) Message(t server.MessageType, payload interface{}) error
Message handles sending a message to the client, wrapping it in error handling
func (*Player) Reconnect ¶ added in v0.9.0
func (p *Player) Reconnect(c Communicator)
func (*Player) Reveal ¶
func (p *Player) Reveal() *server.RevealedPlayer
func (*Player) SetGameChannel ¶ added in v0.13.0
func (p *Player) SetGameChannel(gc gamechannel.GameChannel)
type View ¶ added in v0.2.0
A View represents a player's knowledge of another's role. It can be both a nighttime viewing (such as a seer viewing for max evil) or a generic "this player now knows the roles of one or more other players" (such as the wolves at the start of the game). It may not be successful, as in the case of a seer viewing a non-max, and it may even be incorrect, if there are tinkers!