basecell

package
v0.0.0-...-26c2032 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterFunc

func AfterFunc(qid int, d time.Duration, f func()) *time.Timer

AfterFunc 定时调用

func GetQidByKey

func GetQidByKey(key string) int

GetQidByKey 获取qid

func InitAuthMessage

func InitAuthMessage(authMessage interface{})

初始化认证信息 应该是客户端发的第一个消息

func Post

func Post(qid int, f func())

Post 事件推送

func PostAsync

func PostAsync(qid int, f func() interface{}, cb func(ret interface{}))

PostAsync 异步调用

func PostSync

func PostSync(qid int, f func() interface{}) interface{}

PostSync 投递

func RegisterMessage

func RegisterMessage(msg interface{}, f func(ev cellnetEx.Event))

RegisterMessage 注册默认消息响应

func RegisterObjMessge

func RegisterObjMessge(player interface{})

RegisterObjMessge 注册玩家相关的模块消息响应

func RegitserPlayerPBMessage

func RegitserPlayerPBMessage(player interface{})

RegitserPlayerPBMessage 注册默认消息响应

Types

type BaseCell

type BaseCell struct {
	MsgQueueLen int
	// contains filtered or unexported fields
}

BaseCell 基础服务

var DefaultCell *BaseCell = nil

DefaultCell 默认服务

func New

func New(msgQueLen int) *BaseCell

New 创建新服务

func (*BaseCell) AfterFunc

func (bcell *BaseCell) AfterFunc(qid int, d time.Duration, f func()) *time.Timer

AfterFunc 定时调用

func (*BaseCell) GetQidByKey

func (bcell *BaseCell) GetQidByKey(key string) int

GetQidByKey 获取qid

func (*BaseCell) InitAuthMessage

func (bcell *BaseCell) InitAuthMessage(authMessage interface{})

初始化认证信息 应该是客户端发的第一个消息

func (*BaseCell) NewWsClient

func (bcell *BaseCell) NewWsClient(addr string)

NewWsClient 创建ws客户端

func (*BaseCell) NewWsServer

func (bcell *BaseCell) NewWsServer(addr string)

NewWsServer 创建ws服务器

func (*BaseCell) Post

func (bcell *BaseCell) Post(qid int, f func())

Post 事件推送

func (*BaseCell) PostAsync

func (bcell *BaseCell) PostAsync(qid int, f func() interface{}, cb func(ret interface{}))

PostAsync 异步调用

func (*BaseCell) PostSync

func (bcell *BaseCell) PostSync(qid int, f func() interface{}) interface{}

PostSync 投递

func (*BaseCell) RegisterMessage

func (bcell *BaseCell) RegisterMessage(msg interface{}, f func(ev cellnetEx.Event))

RegisterMessage 注册消息回调

func (*BaseCell) RegisterObjMessge

func (bcell *BaseCell) RegisterObjMessge(obj interface{})

RegisterObjMessge 注册玩家下对象处理的消息

func (*BaseCell) RegitserPlayerPBMessage

func (bcell *BaseCell) RegitserPlayerPBMessage(player interface{})

RegitserPlayerPBMessage 注册玩家处理的消息

func (*BaseCell) Start

func (bcell *BaseCell) Start(mods ...IModule)

Start 服务开始

func (*BaseCell) Stop

func (bcell *BaseCell) Stop()

Stop 服务停止

type IModule

type IModule interface {
	Init()
	Name() string
	OnDestory()
}

IModule 模块接口

type IUserData

type IUserData interface {
	QID() int
	UID() string
}

iUserData 用户数据接口

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL