55 lines
1022 B
Go
55 lines
1022 B
Go
package baseroom
|
|
|
|
import (
|
|
"game/common/proto/pb"
|
|
"github.com/golang/protobuf/proto"
|
|
"time"
|
|
)
|
|
|
|
type IRoom interface {
|
|
Id() int
|
|
RoomType() int // 房间配置id
|
|
PlayType() int
|
|
// SeatPlayerNum() int
|
|
// HasEmptySeat() bool
|
|
// HasPlayer(uid int64) bool
|
|
OnMessage(cmd int32, params ...any)
|
|
// 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
|
|
}
|
|
|
|
type IRobot interface {
|
|
OnMessage(cmd pb.MsgId, params ...any)
|
|
}
|
|
|
|
type ITimer interface {
|
|
OnTimer(timerType TimerType, args ...interface{})
|
|
NewTimer(duration time.Duration, cb func(), needLog bool, desc ...string) uint32
|
|
CancelTimer(timerId uint32)
|
|
}
|
|
|
|
type ISender interface {
|
|
SendMsg(user IPlayer, msgId pb.MsgId, msg proto.Message)
|
|
}
|
|
|
|
type ICreateRoom interface {
|
|
CreateRoom(id, roomType int) (IRoom, pb.ErrCode)
|
|
}
|
|
|
|
type ICreatePlayer interface {
|
|
CreatePlayer(id int64) (IPlayer, pb.ErrCode)
|
|
}
|