Documentation ¶
Index ¶
Constants ¶
View Source
const ( MessageTypeDefault = "message" MessageTypeEnterRoom = "enterRoom" MessageTypeCreateCharacter = "createCharacter" MessageTypeSelectCharacter = "selectCharacter" MessageTypeCharacterSelected = "characterSelected" MessageTypePing = "ping" )
View Source
const ( MessageAudienceOrigin = iota + 1 MessageAudienceUser MessageAudienceRoom MessageAudienceRoomWithoutOrigin MessageAudienceGlobal MessageAudienceSystem )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharacterJoinedRoom ¶
type CharacterJoinedRoom struct {
MessageResponse
}
CharacterJoinedRoom ... asdd
type CharacterLeftRoom ¶
type CharacterLeftRoom struct {
MessageResponse
}
CharacterLeftRoom ... asdd
type CharacterSelected ¶
type CharacterSelected struct { MessageResponse Character *characters.Character `json:"character"` }
CharacterSelected ...
type EnterRoomMessage ¶
type EnterRoomMessage struct { MessageResponse Room rooms.Room `json:"room"` }
EnterRoomMessage ... Define our message object
func NewEnterRoomMessage ¶
func NewEnterRoomMessage(room *rooms.Room, user *entities.User, game def.GameCtrl) *EnterRoomMessage
NewEnterRoomMessage ...
type IncomingMessage ¶
type IncomingMessage struct {
Message string `json:"message"`
}
IncomingMessage ...
type Message ¶
type Message struct { FromUser *e.User Character *characters.Character Data string }
Message ... main message container to pass data from e to server and back
func NewMessage ¶
NewMessage ... creates a new message
type MessageResponder ¶
type MessageResponder interface { GetAudience() AudienceType GetAudienceID() string GetOriginID() string GetMessage() string }
MessageResponder ...
type MessageResponse ¶
type MessageResponse struct { Audience AudienceType `json:"-"` AudienceID string `json:"-"` OriginID string `json:"-"` Type MessageType `json:"type"` Username string `json:"username"` Message string `json:"message"` }
MessageResponse ... Define our message object
func NewCreateCharacterMessage ¶
func NewCreateCharacterMessage(user string) MessageResponse
NewCreateCharacterMessage ...
func NewRoomBasedMessage ¶
func NewRoomBasedMessage(user string, message string) MessageResponse
NewRoomBasedMessage ... creates a new Websocket message
func Reply ¶
func Reply(userID string, message string) MessageResponse
Reply ... creates a reply message
func (MessageResponse) GetAudience ¶
func (m MessageResponse) GetAudience() AudienceType
GetAudience ,,,
func (MessageResponse) GetAudienceID ¶
func (m MessageResponse) GetAudienceID() string
GetAudienceID ,,,
type MultiResponse ¶
type MultiResponse struct {
Responses []MessageResponse
}
MultiResponse ...
func NewMultiResponse ¶
func NewMultiResponse(responses ...MessageResponse) MultiResponse
NewMultiResponse ...
type UserJoined ¶
UserJoined ... player joined event
func NewUserJoined ¶
func NewUserJoined(user *e.User) *UserJoined
NewUserJoined ... creates a new User Joined event
Click to show internal directories.
Click to hide internal directories.