添加手动管理座位信息的函数,默认改为手动管理,添加自动管理的可选项
This commit is contained in:
+12
-3
@@ -3,12 +3,21 @@ package game
|
||||
// RoomSeat 带有座位号的房间实现
|
||||
type RoomSeat[PlayerID comparable, P Player[PlayerID]] interface {
|
||||
Room[PlayerID, P]
|
||||
// SetSeat 设置玩家座位号
|
||||
// AddSeat 将玩家添加到座位号中
|
||||
AddSeat(id PlayerID)
|
||||
// AddSeatWithAssign 将玩家添加到座位号中,并分配特定的座位号
|
||||
AddSeatWithAssign(id PlayerID, seat int)
|
||||
// RemovePlayerSeat 移除玩家的座位号
|
||||
RemovePlayerSeat(id PlayerID)
|
||||
// RemoveSeat 移除特定座位号
|
||||
RemoveSeat(seat int)
|
||||
// SetSeat 设置玩家座位号,当玩家没有座位号时,将会返回错误信息
|
||||
// - 如果座位号有其他玩家,他们的位置将互换
|
||||
SetSeat(id PlayerID, seat int) error
|
||||
// GetSeat 获取玩家座位号
|
||||
GetSeat(id PlayerID) (int, error)
|
||||
// GetPlayerWithSeat 根据座位号获取玩家
|
||||
GetPlayerWithSeat(seat int) (P, error)
|
||||
// GetPlayerIDWithSeat 根据座位号获取玩家ID
|
||||
GetPlayerIDWithSeat(seat int) (PlayerID, error)
|
||||
// GetSeatInfo 获取座位信息,空缺的位置将为空
|
||||
GetSeatInfo() []*PlayerID
|
||||
// GetSeatInfoMap 以map的方式获取座位号
|
||||
|
||||
Reference in New Issue
Block a user