代码拉取完成,页面将自动刷新
package engine
import (
"sync"
)
type Controller interface {
GetSession(areaName []byte, name string) (Session, bool) //通过accId得到客户端的连接Id
GetNet() *Engine //获得连接到本地的计算机连接
SetAttribute(name string, value interface{}) //设置共享数据,实现业务模块之间通信
GetAttribute(name string) interface{} //得到共享数据,实现业务模块之间通信
// GetGroupManager() MsgGroup //获得消息组管理器
}
type ControllerImpl struct {
lock *sync.RWMutex
engine *Engine
attributes map[string]interface{}
// msgGroup *msgGroupManager
}
// 得到net模块,用于给用户发送消息
func (this *ControllerImpl) GetNet() *Engine {
this.lock.RLock()
defer this.lock.RUnlock()
return this.engine
}
func (this *ControllerImpl) SetAttribute(name string, value interface{}) {
this.lock.Lock()
defer this.lock.Unlock()
this.attributes[name] = value
}
func (this *ControllerImpl) GetAttribute(name string) interface{} {
this.lock.RLock()
defer this.lock.RUnlock()
return this.attributes[name]
}
func (this *ControllerImpl) GetSession(areaName []byte, name string) (Session, bool) {
this.lock.RLock()
defer this.lock.RUnlock()
return this.engine.GetSession(areaName, name)
}
// func (this *ControllerImpl) GetGroupManager() MsgGroup {
// return this.msgGroup
// }
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。