"为Player结构添加Context支持并优化登录信息字段命名"

This commit is contained in:
1
2025-08-11 08:01:59 +00:00
parent d075ec0676
commit 917fc30f97
2 changed files with 7 additions and 2 deletions

View File

@@ -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