game/common/baseroom/interface.go

48 lines
874 B
Go
Raw Normal View History

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