You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
56 lines
1.3 KiB
|
1 year ago
|
package game
|
||
|
|
|
||
|
|
// 错误码
|
||
|
|
const (
|
||
|
|
CodeOk = iota
|
||
|
|
CodeSeverError // 内部错误
|
||
|
|
CodeCashNotEnough // 金币不足
|
||
|
|
CodeBetInvalid // 投注金额不合法
|
||
|
|
CodeBetLimit // 投注金额超出限额
|
||
|
|
CodePlaying // 游戏中不能退出
|
||
|
|
CodeSeatIDInvalid // 座位号不合法
|
||
|
|
CodeSeatInvalid // 座位已有人
|
||
|
|
CodeNoSeat // 当前没有座位
|
||
|
|
CodePayBet // 未充值不能下注
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
MaxWatchCount = 10 // 最大观看局数
|
||
|
|
)
|
||
|
|
|
||
|
|
var (
|
||
|
|
ThisGameID int
|
||
|
|
ThisGameType int
|
||
|
|
NewTable func() SubTable
|
||
|
|
)
|
||
|
|
|
||
|
|
func ModuleOnDestroy() {
|
||
|
|
// AllPlayers.Range(func(key, value interface{}) bool {
|
||
|
|
// uid := key.(int)
|
||
|
|
// p := value.(*Player)
|
||
|
|
// p.Debug("destroy remove")
|
||
|
|
// if p.IsRobot() {
|
||
|
|
// db.Redis().DelRobot(p.Robot.ID)
|
||
|
|
// } else {
|
||
|
|
// db.Redis().Delkey(common.GetRedisKeyPlayerStatus(uid))
|
||
|
|
// }
|
||
|
|
// return true
|
||
|
|
// })
|
||
|
|
// AllRobots.Range(func(key, value interface{}) bool {
|
||
|
|
// id := key.(int)
|
||
|
|
// p := value.(*Player)
|
||
|
|
// p.Robot.Debug("destroy remove robot %v", id)
|
||
|
|
// db.Redis().DelRobot(p.Robot.ID)
|
||
|
|
// return true
|
||
|
|
// })
|
||
|
|
RoomMap.Range(func(key, value interface{}) bool {
|
||
|
|
r := value.(*GameRoom)
|
||
|
|
r.Tables.Range(func(key, value interface{}) bool {
|
||
|
|
t := value.(*Table)
|
||
|
|
t.Finish()
|
||
|
|
return true
|
||
|
|
})
|
||
|
|
return true
|
||
|
|
})
|
||
|
|
}
|