"为Player结构添加Context支持并优化登录信息字段命名"
This commit is contained in:
@@ -12,10 +12,11 @@ import (
|
||||
type Player struct {
|
||||
MainConn Conn
|
||||
UserID uint32 //用户ID
|
||||
IsLogin bool //是否登录
|
||||
IsLogin bool //是否登录
|
||||
mu sync.Mutex
|
||||
|
||||
loginChan chan struct{} // 登录完成通知通道
|
||||
context.Context
|
||||
}
|
||||
|
||||
// PlayerOption 定义配置 Player 的函数类型
|
||||
@@ -48,6 +49,10 @@ func (p *Player) GetUserID() uint32 {
|
||||
return p.UserID
|
||||
}
|
||||
|
||||
func (p *Player) SetData(key any) uint32 {
|
||||
|
||||
return p.UserID
|
||||
}
|
||||
func (p *Player) SendPack(b []byte) error {
|
||||
err := p.MainConn.SendPack(b)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user