game/common/baseroom/interface.go
2025-06-07 22:53:54 +08:00

48 lines
874 B
Go

package baseroom
import (
"game/common/proto/pb"
"github.com/fox/fox/service"
)
type IRoom interface {
Id() int
RoomType() int // 房间配置id
PlayType() int
OnInit()
// SeatPlayerNum() int
// HasEmptySeat() bool
// HasPlayer(uid int64) bool
Unmarshal(cmd int32, data []byte) (any, error)
Dispatch(user IPlayer, cmd int32, params ...any) error
// ReleaseRoom()
}
type ISeat interface {
No() int
Empty() bool
Player() IPlayer
SetPlayer(player IPlayer)
Status() SeatStatus
SetStatus(status SeatStatus)
}
type IPlayer interface {
Id() int64
Robot() IRobot
GateTopicName() string
RoomId() int
}
type IRobot interface {
OnMessage(cmd pb.MsgId, params ...any)
}
type ICreateRoom interface {
CreateRoom(id, roomType int, service service.IService) (IRoom, pb.ErrCode)
}
type ICreatePlayer interface {
CreatePlayer(id int64) (IPlayer, pb.ErrCode)
}