添加手动管理座位信息的函数,默认改为手动管理,添加自动管理的可选项

This commit is contained in:
kercylan98
2023-05-12 10:28:25 +08:00
parent 9a58405f70
commit c8d701bea5
3 changed files with 97 additions and 43 deletions
+12 -3
View File
@@ -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的方式获取座位号