Documentation
¶
Index ¶
- Constants
- func CreateToken(account string, minutes uint16, starttime uint64) string
- func NewProxy(ctx *SessionModule) *proxy
- type Account
- func (a *Account) ChooseRole(session *Session, args c2s.ChooseRole) error
- func (a *Account) CreateRole(session *Session, args c2s.CreateRole) error
- func (a *Account) DeleteRole(session *Session, args c2s.DeleteRole) error
- func (p *Account) EnterRegion(s *Session, r rpc.Mailbox) error
- func (a *Account) FindRegion(session *Session, id int64, fx, fy, fz float64) error
- func (p *Account) LeaveRegion(s *Session) error
- func (a *Account) Logged(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (a *Account) OnChooseRole(p interface{}, err *rpc.Error, ar *utils.LoadArchive)
- func (a *Account) OnCreateRole(p interface{}, e *rpc.Error, ar *utils.LoadArchive)
- func (a *Account) OnDeleteRole(p interface{}, e *rpc.Error, ar *utils.LoadArchive)
- func (p *Account) OnEnterRegion(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
- func (a *Account) OnFindRegion(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
- func (p *Account) OnLeaveRegion(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
- func (p *Account) OnRemovePlayer(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
- func (a *Account) OnRoleInfo(p interface{}, e *rpc.Error, ar *utils.LoadArchive)
- func (a *Account) OnSaveRole(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
- func (a *Account) RegisterCallback(s rpc.Servicer)
- func (p *Account) RemovePlayer(s *Session) error
- func (a *Account) SaveRole(session *Session, stype int) error
- type ChooseRole
- type CreateRole
- type Deleting
- type Idle
- type LandInfo
- type Leaving
- func (s *Leaving) Enter()
- func (s *Leaving) Init(r fsm.StateRegister)
- func (s *Leaving) OnHandle(event int, param interface{}) string
- func (s *Leaving) OnRegionRemove(event int, param interface{}) string
- func (s *Leaving) OnStored(event int, param interface{}) string
- func (s *Leaving) OnTimer() string
- type Logged
- func (s *Logged) Init(r fsm.StateRegister)
- func (s *Logged) OnBreak(event int, param interface{}) string
- func (s *Logged) OnChoose(event int, param interface{}) string
- func (s *Logged) OnCreate(event int, param interface{}) string
- func (s *Logged) OnDelete(event int, param interface{}) string
- func (s *Logged) OnHandle(event int, param interface{}) string
- func (s *Logged) OnRoleInfo(event int, param interface{}) string
- func (s *Logged) OnTimer() string
- type Offline
- type Online
- func (s *Online) Enter()
- func (s *Online) Exit()
- func (s *Online) Init(r fsm.StateRegister)
- func (s *Online) OnBreak(event int, param interface{}) string
- func (s *Online) OnFindRegion(event int, param interface{}) string
- func (s *Online) OnHandle(event int, param interface{}) string
- func (s *Online) OnTimer() string
- func (s *Online) Online(event int, param interface{}) string
- type RoleRegion
- type Session
- func (s *Session) Break()
- func (s *Session) ChooseRole(info c2s.ChooseRole) error
- func (s *Session) CreateRole(info c2s.CreateRole) error
- func (s *Session) DeleteRole(info c2s.DeleteRole) error
- func (s *Session) DestroySelf()
- func (s *Session) EnterRegion(r rpc.Mailbox) error
- func (s *Session) Error(errcode int32)
- func (s *Session) FindRegion() error
- func (s *Session) GameObject() gameobject.GameObject
- func (s *Session) LevelRegion() error
- func (s *Session) QueryRoleInfo() bool
- func (s *Session) RegionRemove() error
- func (s *Session) SaveRole(stype int) error
- func (s *Session) SendRoleInfo(role []*inner.Role)
- func (s *Session) SetGameObject(g gameobject.GameObject)
- func (s *Session) SetLandInfo(scene int64, x, y, z, o float64)
- func (s *Session) SyncData(data []byte) error
- func (s *Session) ValidToken(token string) bool
- type SessionDB
- type SessionModule
- func (s *SessionModule) FindSession(id uint64) *Session
- func (s *SessionModule) Init() bool
- func (s *SessionModule) Name() string
- func (s *SessionModule) OnConnected(evt string, args ...interface{})
- func (s *SessionModule) OnDisconnected(evt string, args ...interface{})
- func (s *SessionModule) OnUpdate(t *service.Time)
- func (s *SessionModule) PerSecondCheck(d time.Duration)
- func (s *SessionModule) Shut()
Constants ¶
View Source
const ( NONE = iota EBREAK // 客户端断开连接 ELOGIN // 客户端登录 EROLEINFO // 角色列表 ECREATE // 创建角色 ECREATED // 创建完成 ECHOOSE // 选择角色 ECHOOSED // 选择角色成功 EDELETE // 删除角色 EDELETED // 删除成功 ESTORED // 存档完成 EONLINE // 进入场景 EFREGION // 查找场景 ESWREGION // 切换场景 EREMAINTIME // 更新离线存活时间 EREGIONREMOVE // 场景已经删除玩家 )
View Source
const ( SIDLE = "idle" SLOGGED = "logged" SCREATE = "create" SCHOOSE = "choose" SDELETE = "delete" SONLINE = "online" SOFFLINE = "offline" SLEAVING = "leaving" )
Variables ¶
This section is empty.
Functions ¶
func CreateToken ¶
token [ 0 ... 7 ] [ 8 ... 9 ] [ 10 ... 13 ] [ 14 ... 21 ]
start time life time random verify code
func NewProxy ¶
func NewProxy(ctx *SessionModule) *proxy
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func NewAccount ¶
func NewAccount(ctx *SessionModule) *Account
func (*Account) ChooseRole ¶
func (a *Account) ChooseRole(session *Session, args c2s.ChooseRole) error
func (*Account) CreateRole ¶
func (a *Account) CreateRole(session *Session, args c2s.CreateRole) error
func (*Account) DeleteRole ¶
func (a *Account) DeleteRole(session *Session, args c2s.DeleteRole) error
func (*Account) FindRegion ¶
func (*Account) LeaveRegion ¶
func (*Account) Logged ¶
func (a *Account) Logged(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
login服务调用
func (*Account) OnChooseRole ¶
func (a *Account) OnChooseRole(p interface{}, err *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnCreateRole ¶
func (a *Account) OnCreateRole(p interface{}, e *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnDeleteRole ¶
func (a *Account) OnDeleteRole(p interface{}, e *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnEnterRegion ¶
func (p *Account) OnEnterRegion(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnFindRegion ¶
func (a *Account) OnFindRegion(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnLeaveRegion ¶
func (p *Account) OnLeaveRegion(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnRemovePlayer ¶
func (p *Account) OnRemovePlayer(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
func (*Account) OnRoleInfo ¶
func (a *Account) OnRoleInfo(p interface{}, e *rpc.Error, ar *utils.LoadArchive)
收到玩家信息
func (*Account) OnSaveRole ¶
func (a *Account) OnSaveRole(param interface{}, replyerr *rpc.Error, ar *utils.LoadArchive)
func (*Account) RegisterCallback ¶
func (*Account) RemovePlayer ¶
type ChooseRole ¶
func (*ChooseRole) Init ¶
func (s *ChooseRole) Init(r fsm.StateRegister)
func (*ChooseRole) OnBreak ¶
func (s *ChooseRole) OnBreak(event int, param interface{}) string
func (*ChooseRole) OnChoose ¶
func (s *ChooseRole) OnChoose(event int, param interface{}) string
func (*ChooseRole) OnHandle ¶
func (s *ChooseRole) OnHandle(event int, param interface{}) string
func (*ChooseRole) OnTimer ¶
func (s *ChooseRole) OnTimer() string
type CreateRole ¶
func (*CreateRole) Init ¶
func (s *CreateRole) Init(r fsm.StateRegister)
func (*CreateRole) OnBreak ¶
func (s *CreateRole) OnBreak(event int, param interface{}) string
func (*CreateRole) OnCreated ¶
func (s *CreateRole) OnCreated(event int, param interface{}) string
func (*CreateRole) OnHandle ¶
func (s *CreateRole) OnHandle(event int, param interface{}) string
func (*CreateRole) OnTimer ¶
func (s *CreateRole) OnTimer() string
type Deleting ¶
func (*Deleting) Init ¶
func (s *Deleting) Init(r fsm.StateRegister)
func (*Deleting) OnDeleting ¶
type Leaving ¶
func (*Leaving) Init ¶
func (s *Leaving) Init(r fsm.StateRegister)
func (*Leaving) OnRegionRemove ¶
type Logged ¶
func (*Logged) Init ¶
func (s *Logged) Init(r fsm.StateRegister)
func (*Logged) OnRoleInfo ¶
type Offline ¶
func (*Offline) Init ¶
func (s *Offline) Init(r fsm.StateRegister)
func (*Offline) OnRemainTime ¶
type Online ¶
func (*Online) Init ¶
func (s *Online) Init(r fsm.StateRegister)
func (*Online) OnFindRegion ¶
type RoleRegion ¶
type RoleRegion struct {
// contains filtered or unexported fields
}
func NewRoleRegion ¶
func NewRoleRegion(m *SessionModule) *RoleRegion
func (*RoleRegion) RegisterCallback ¶
func (s *RoleRegion) RegisterCallback(srv rpc.Servicer)
type Session ¶
type Session struct {
*fsm.FSM
Account string
Mailbox *rpc.Mailbox
// contains filtered or unexported fields
}
session保存当前连接和角色的相关信息
func NewSession ¶
func NewSession(id uint64, ctx *SessionModule) *Session
func (*Session) ChooseRole ¶
func (s *Session) ChooseRole(info c2s.ChooseRole) error
ChooseRole 选择角色
func (*Session) CreateRole ¶
func (s *Session) CreateRole(info c2s.CreateRole) error
CreateRole 创建角色
func (*Session) DeleteRole ¶
func (s *Session) DeleteRole(info c2s.DeleteRole) error
DeleteRole 删除角色
func (*Session) FindRegion ¶
func (*Session) GameObject ¶
func (s *Session) GameObject() gameobject.GameObject
func (*Session) LevelRegion ¶
func (*Session) RegionRemove ¶
func (*Session) SetGameObject ¶
func (s *Session) SetGameObject(g gameobject.GameObject)
func (*Session) SetLandInfo ¶
type SessionModule ¶
登录Session模块 登录信息存储在这里 模块提供功能:
proxy:网关功能,对应的客户端消息在这里进行中转处理 session:登录管理,角色管理 存储客户端对应的entity数据
func New ¶
func New() *SessionModule
func (*SessionModule) FindSession ¶
func (s *SessionModule) FindSession(id uint64) *Session
查找session
func (*SessionModule) Init ¶
func (s *SessionModule) Init() bool
func (*SessionModule) Name ¶
func (s *SessionModule) Name() string
func (*SessionModule) OnConnected ¶
func (s *SessionModule) OnConnected(evt string, args ...interface{})
新客户端连接
func (*SessionModule) OnDisconnected ¶
func (s *SessionModule) OnDisconnected(evt string, args ...interface{})
客户端断线
func (*SessionModule) OnUpdate ¶
func (s *SessionModule) OnUpdate(t *service.Time)
func (*SessionModule) PerSecondCheck ¶
func (s *SessionModule) PerSecondCheck(d time.Duration)
PerSecondCheck 每分钟检查
Click to show internal directories.
Click to hide internal directories.