diff --git a/game/builtin/player.go b/game/builtin/player.go index 876178a..5013174 100644 --- a/game/builtin/player.go +++ b/game/builtin/player.go @@ -34,11 +34,11 @@ func (slf *Player[ID]) UseConn(conn *server.Conn) { } // Send 向该玩家发送数据 -func (slf *Player[ID]) Send(packet []byte) { - slf.conn.Write(packet) +func (slf *Player[ID]) Send(packet []byte, callback ...func(err error)) { + slf.conn.Write(packet, callback...) } // Close 关闭玩家 -func (slf *Player[ID]) Close() { - slf.conn.Close() +func (slf *Player[ID]) Close(err ...error) { + slf.conn.Close(err...) } diff --git a/game/player.go b/game/player.go index f322136..b069374 100644 --- a/game/player.go +++ b/game/player.go @@ -11,5 +11,5 @@ type Player[ID comparable] interface { // UseConn 指定连接 UseConn(conn *server.Conn) // Close 关闭玩家并且释放其资源 - Close() + Close(err ...error) }