|
|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
"log/slog"
|
|
|
|
"log/slog"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/EngoEngine/ecs"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@ -16,15 +17,23 @@ type Session struct {
|
|
|
|
p Printer
|
|
|
|
p Printer
|
|
|
|
l *slog.Logger
|
|
|
|
l *slog.Logger
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w *ecs.World
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sessionID uuid.UUID
|
|
|
|
userID uint64
|
|
|
|
userID uint64
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewSession(ctx context.Context, c net.Conn, p Printer, l *slog.Logger) *Session {
|
|
|
|
func NewSession(ctx context.Context, c net.Conn, p Printer, l *slog.Logger, w *ecs.World) *Session {
|
|
|
|
sid := uuid.New()
|
|
|
|
sid := uuid.New()
|
|
|
|
return &Session{
|
|
|
|
return &Session{
|
|
|
|
ctx: ctx,
|
|
|
|
ctx: ctx,
|
|
|
|
|
|
|
|
|
|
|
|
l: l.With(slog.String("sid", sid.String())),
|
|
|
|
l: l.With(slog.String("sid", sid.String())),
|
|
|
|
c: c,
|
|
|
|
c: c,
|
|
|
|
|
|
|
|
w: w,
|
|
|
|
|
|
|
|
p: p,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sessionID: sid,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|