Documentation ¶
Index ¶
- Variables
- func GetTimeStamp() int64
- func NewEntityState(id int64, prefabName string, c *Character) *EntityState
- type ChatMessage
- type ChatRoom
- type MsgChannel
- type MsgChannelManager
- type Room
- func (r *Room) GenerateStartFrame()
- func (r *Room) HandleEntityDestory(input *Input)
- func (r *Room) HandleEntityState(input *Input)
- func (r *Room) HandleInteraction(input *Input)
- func (r *Room) HandleNewEntity(input *Input)
- func (r *Room) PlayerLeave(s *Session)
- func (r *Room) Run()
- func (r *Room) SyncGameFrame()
- func (r *Room) UpdateFrame()
- func (r *Room) WaitPlayerReconnect(s *Session)
- type Session
- type SessionState
- type SessionStateBase
- func (sb *SessionStateBase) CancelReady() bool
- func (sb *SessionStateBase) CreateRoom(setting *RoomSetting) bool
- func (sb *SessionStateBase) CreateSession() int64
- func (sb *SessionStateBase) DeleteRoom() bool
- func (sb *SessionStateBase) End()
- func (sb *SessionStateBase) EndConnection()
- func (sb *SessionStateBase) EndRoom() bool
- func (sb *SessionStateBase) EnterRoom(roomId int64) bool
- func (sb *SessionStateBase) GetStateCode() SessionInfo_SessionState
- func (sb *SessionStateBase) HandleInput(input *Input)
- func (sb *SessionStateBase) LeaveRoom() bool
- func (sb *SessionStateBase) Login(uname string, pswd string) *user.User
- func (sb *SessionStateBase) Logout() bool
- func (sb *SessionStateBase) ReadyRoom() bool
- func (sb *SessionStateBase) Reconnect()
- func (sb *SessionStateBase) Regist(uname string, pswd string, info ...string) bool
- func (sb *SessionStateBase) SetSession(s *Session) bool
- func (sb *SessionStateBase) SetStateCode(code SessionInfo_SessionState)
- func (sb *SessionStateBase) SettingCharacter(*CharacterSetting) bool
- func (sb *SessionStateBase) SettingRoom() bool
- func (sb *SessionStateBase) StartGame()
- func (sb *SessionStateBase) StartRoom() bool
- func (sb *SessionStateBase) String() string
- func (sb *SessionStateBase) WaitReconnect()
- type SessionStateGameOnStart
- type SessionStateGameOver
- type SessionStatePlaying
- type SessionStateWaitingReconnection
Constants ¶
This section is empty.
Variables ¶
View Source
var Manager *sessionManager
View Source
var RoomManager *roomManager = &roomManager{ Rooms: make(map[int64]*Room), UserIdleRoomListChan: make(map[*MsgChannel]struct{}), }
View Source
var SessionStateFactory *sessionStateFactory
Functions ¶
func GetTimeStamp ¶
func GetTimeStamp() int64
func NewEntityState ¶
Types ¶
type ChatMessage ¶
type ChatRoom ¶
type ChatRoom struct {
ReadingBuffer []*ChatMessage
}
type MsgChannel ¶
type MsgChannel struct { DataCh chan (interface{}) StopSignal chan (struct{}) }
func NewMsgChannel ¶
func NewMsgChannel(bufferNumber int32) *MsgChannel
func (*MsgChannel) Close ¶
func (m *MsgChannel) Close()
type MsgChannelManager ¶
type MsgChannelManager struct {
// contains filtered or unexported fields
}
func NewMsgChannelManager ¶
func NewMsgChannelManager() *MsgChannelManager
func (*MsgChannelManager) AddMsgChan ¶
func (m *MsgChannelManager) AddMsgChan(name string, bufferNumber int32) bool
func (*MsgChannelManager) CloseMsgChan ¶
func (m *MsgChannelManager) CloseMsgChan(name string)
func (*MsgChannelManager) GetMsgChan ¶
func (m *MsgChannelManager) GetMsgChan(name string) *MsgChannel
type Room ¶
type Room struct { Name string GameType string Master *Session Client map[*Session]struct{} Uuid int64 GameFrame *GameFrame *MsgChannelManager sync.RWMutex GameStart chan (struct{}) // contains filtered or unexported fields }
func (*Room) GenerateStartFrame ¶
func (r *Room) GenerateStartFrame()
func (*Room) HandleEntityDestory ¶
func (r *Room) HandleEntityDestory(input *Input)
func (*Room) HandleEntityState ¶
func (r *Room) HandleEntityState(input *Input)
func (*Room) HandleInteraction ¶
func (r *Room) HandleInteraction(input *Input)
func (*Room) HandleNewEntity ¶
func (r *Room) HandleNewEntity(input *Input)
func (*Room) PlayerLeave ¶
func (*Room) SyncGameFrame ¶
func (r *Room) SyncGameFrame()
func (*Room) UpdateFrame ¶
func (r *Room) UpdateFrame()
func (*Room) WaitPlayerReconnect ¶
type Session ¶
type Session struct { Info *SessionInfo State SessionState SessionKey int64 User *user.User States []SessionState Room *Room sync.RWMutex PlayerInfo *PlayerInfo TeamNo int32 InputPool *MsgChannel InputStamp int64 *MsgChannelManager }
func NewSession ¶
func NewSession(info *SessionInfo) *Session
func (*Session) GetPlayerInfo ¶
func (s *Session) GetPlayerInfo() *PlayerInfo
type SessionState ¶
type SessionState interface { SetSession(s *Session) bool SetStateCode(SessionInfo_SessionState) GetStateCode() SessionInfo_SessionState CreateSession() int64 Login(uname string, pswd string) *user.User Logout() bool Regist(uname string, pswd string, info ...string) bool CreateRoom(setting *RoomSetting) bool EnterRoom(roomId int64) bool DeleteRoom() bool ReadyRoom() bool LeaveRoom() bool StartRoom() bool SettingCharacter(*CharacterSetting) bool SettingRoom() bool CancelReady() bool EndRoom() bool String() string Lock() HandleInput(input *Input) Unlock() StartGame() Reconnect() EndConnection() WaitReconnect() End() }
type SessionStateBase ¶
func (*SessionStateBase) CancelReady ¶
func (sb *SessionStateBase) CancelReady() bool
func (*SessionStateBase) CreateRoom ¶
func (sb *SessionStateBase) CreateRoom(setting *RoomSetting) bool
func (*SessionStateBase) CreateSession ¶
func (sb *SessionStateBase) CreateSession() int64
func (*SessionStateBase) DeleteRoom ¶
func (sb *SessionStateBase) DeleteRoom() bool
func (*SessionStateBase) End ¶
func (sb *SessionStateBase) End()
func (*SessionStateBase) EndConnection ¶
func (sb *SessionStateBase) EndConnection()
func (*SessionStateBase) EndRoom ¶
func (sb *SessionStateBase) EndRoom() bool
func (*SessionStateBase) EnterRoom ¶
func (sb *SessionStateBase) EnterRoom(roomId int64) bool
func (*SessionStateBase) GetStateCode ¶
func (sb *SessionStateBase) GetStateCode() SessionInfo_SessionState
func (*SessionStateBase) HandleInput ¶
func (sb *SessionStateBase) HandleInput(input *Input)
func (*SessionStateBase) LeaveRoom ¶
func (sb *SessionStateBase) LeaveRoom() bool
func (*SessionStateBase) Login ¶
func (sb *SessionStateBase) Login(uname string, pswd string) *user.User
func (*SessionStateBase) Logout ¶
func (sb *SessionStateBase) Logout() bool
func (*SessionStateBase) ReadyRoom ¶
func (sb *SessionStateBase) ReadyRoom() bool
func (*SessionStateBase) Reconnect ¶
func (sb *SessionStateBase) Reconnect()
func (*SessionStateBase) Regist ¶
func (sb *SessionStateBase) Regist(uname string, pswd string, info ...string) bool
func (*SessionStateBase) SetSession ¶
func (sb *SessionStateBase) SetSession(s *Session) bool
func (*SessionStateBase) SetStateCode ¶
func (sb *SessionStateBase) SetStateCode(code SessionInfo_SessionState)
func (*SessionStateBase) SettingCharacter ¶
func (sb *SessionStateBase) SettingCharacter(*CharacterSetting) bool
func (*SessionStateBase) SettingRoom ¶
func (sb *SessionStateBase) SettingRoom() bool
func (*SessionStateBase) StartGame ¶
func (sb *SessionStateBase) StartGame()
func (*SessionStateBase) StartRoom ¶
func (sb *SessionStateBase) StartRoom() bool
func (*SessionStateBase) String ¶
func (sb *SessionStateBase) String() string
func (*SessionStateBase) WaitReconnect ¶
func (sb *SessionStateBase) WaitReconnect()
type SessionStateGameOnStart ¶
type SessionStateGameOnStart struct {
SessionStateBase
}
func (*SessionStateGameOnStart) StartGame ¶
func (ssgos *SessionStateGameOnStart) StartGame()
type SessionStateGameOver ¶
type SessionStateGameOver struct {
SessionStateBase
}
func (*SessionStateGameOver) End ¶
func (ssgo *SessionStateGameOver) End()
type SessionStatePlaying ¶
type SessionStatePlaying struct {
SessionStateBase
}
func (*SessionStatePlaying) EndConnection ¶
func (sb *SessionStatePlaying) EndConnection()
func (*SessionStatePlaying) HandleInput ¶
func (sb *SessionStatePlaying) HandleInput(input *Input)
func (*SessionStatePlaying) WaitReconnect ¶
func (sb *SessionStatePlaying) WaitReconnect()
type SessionStateWaitingReconnection ¶
type SessionStateWaitingReconnection struct {
SessionStateBase
}
func (*SessionStateWaitingReconnection) EndConnection ¶
func (sswr *SessionStateWaitingReconnection) EndConnection()
func (*SessionStateWaitingReconnection) Reconnect ¶
func (sswr *SessionStateWaitingReconnection) Reconnect()
func (*SessionStateWaitingReconnection) StartGame ¶
func (sswr *SessionStateWaitingReconnection) StartGame()
func (*SessionStateWaitingReconnection) Waiting ¶
func (sswr *SessionStateWaitingReconnection) Waiting()
Click to show internal directories.
Click to hide internal directories.