Documentation ¶
Index ¶
- Constants
- Variables
- type ChatMessage
- type ChatRoom
- type ConnectingGameSessionState
- type GameServer
- type GuestSessionState
- type MsgChannel
- type MsgChannelManager
- type NoSessionState
- type Room
- func (r *Room) CheckReady() bool
- func (r *Room) CreateRoomOnGameServer()
- func (r *Room) DeleteRoom() bool
- func (r *Room) EnterRoom(client *Session) bool
- func (r *Room) GetReview() (Review *RoomReview)
- func (r *Room) KickOut(master *Session, client *Session) bool
- func (r *Room) LeaveRoom(s *Session) bool
- func (r *Room) UpdateReview()
- func (r *Room) UpdateRoomContent()
- 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) EndRoom() bool
- func (sb *SessionStateBase) EnterRoom(roomId int64) bool
- func (sb *SessionStateBase) GetStateCode() SessionInfo_SessionState
- 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) 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) StartRoom() bool
- func (sb *SessionStateBase) String() string
- type UserIdleSessionState
- type UserInRoomSessionState
Constants ¶
View Source
const MAX_PORT int = 31000
View Source
const MAX_ROOM_IN_POD = 1
MAX_ROOM_IN_POD maxium rooms in pod
View Source
const MAX_SERVER_AMOUT int = 20
View Source
const MIN_PORT int = 30000
View Source
const NAME_SPACE string = "default"
View Source
const SERVER_AMOUNT int = 1
Variables ¶
View Source
var ClusterManager *clusterManager
ClusterManager clustermanager's instance
View Source
var Manager *sessionManager
View Source
var PodMod *v1.Pod
View Source
var RoomManager *roomManager = &roomManager{ Rooms: make(map[int64]*Room), UserIdleRoomListChan: make(map[*MsgChannel]struct{}), GameServers: make(map[*GameServer]struct{}), }
View Source
var SessionStateFactory *sessionStateFactory
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type ChatRoom ¶
type ChatRoom struct {
ReadingBuffer []*ChatMessage
}
type ConnectingGameSessionState ¶
type ConnectingGameSessionState struct {
SessionStateBase
}
func (*ConnectingGameSessionState) EndRoom ¶
func (ss *ConnectingGameSessionState) EndRoom() bool
type GameServer ¶
type GuestSessionState ¶
type GuestSessionState struct {
SessionStateBase
}
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 NoSessionState ¶
type NoSessionState struct {
SessionStateBase
}
func (*NoSessionState) CreateSession ¶
func (ss *NoSessionState) CreateSession() int64
type Room ¶
type Room struct { Name string GameType string Master *Session Client map[*Session]struct{} Uuid int64 IsFull bool IsCreatOnGameServer bool MaxPlyer int32 PlayerInRoom int32 Review *RoomReview GameServer *GameServer sync.RWMutex }
func (*Room) CheckReady ¶
func (*Room) CreateRoomOnGameServer ¶
func (r *Room) CreateRoomOnGameServer()
func (*Room) DeleteRoom ¶
func (*Room) UpdateReview ¶
func (r *Room) UpdateReview()
func (*Room) UpdateRoomContent ¶
func (r *Room) UpdateRoomContent()
type Session ¶
type Session struct { Info *SessionInfo State SessionState SessionKey int64 User *user.User States []SessionState Room *Room *MsgChannelManager sync.RWMutex PlayerInfo *PlayerInfo TeamNo int32 IsReady bool ServerInfo *ServerInfo }
func NewSession ¶
func NewSession() *Session
func (*Session) GetPlayerInfo ¶
func (s *Session) GetPlayerInfo() *PlayerInfo
func (*Session) GetSessionCache ¶
func (s *Session) GetSessionCache() *SessionCache
func (*Session) GetSessionInfo ¶
func (s *Session) GetSessionInfo() *SessionInfo
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() Unlock() }
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) 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) 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) 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) StartRoom ¶
func (sb *SessionStateBase) StartRoom() bool
func (*SessionStateBase) String ¶
func (sb *SessionStateBase) String() string
type UserIdleSessionState ¶
type UserIdleSessionState struct {
SessionStateBase
}
func (*UserIdleSessionState) CreateRoom ¶
func (ss *UserIdleSessionState) CreateRoom(roomSetting *RoomSetting) bool
func (*UserIdleSessionState) EnterRoom ¶
func (ss *UserIdleSessionState) EnterRoom(roomId int64) bool
type UserInRoomSessionState ¶
type UserInRoomSessionState struct {
SessionStateBase
}
func (*UserInRoomSessionState) CancelReady ¶
func (ss *UserInRoomSessionState) CancelReady() bool
func (*UserInRoomSessionState) DeleteRoom ¶
func (ss *UserInRoomSessionState) DeleteRoom() bool
func (*UserInRoomSessionState) LeaveRoom ¶
func (ss *UserInRoomSessionState) LeaveRoom() bool
func (*UserInRoomSessionState) ReadyRoom ¶
func (ss *UserInRoomSessionState) ReadyRoom() bool
func (*UserInRoomSessionState) SettingCharacter ¶
func (ss *UserInRoomSessionState) SettingCharacter(setting *CharacterSetting) bool
Click to show internal directories.
Click to hide internal directories.