Browse Source

1 修改给的桌子信息

dev
MoQingYu 4 months ago
parent
commit
c2621a9150
  1. 12
      game-server/game/AndarBahar/app/core/game/game.go
  2. 20
      game-server/game/AndarBahar/app/core/game/game_bet.go
  3. 2
      game-server/game/AndarBahar/app/core/game/game_comm.go
  4. 12
      game-server/game/AndarBahar/app/core/game/game_copy.go
  5. 2
      game-server/game/AndarBahar/app/core/game/game_disconnect.go
  6. 2
      game-server/game/AndarBahar/app/core/game/game_get_room_info.go
  7. 4
      game-server/game/AndarBahar/app/core/game/game_join_room.go
  8. 14
      game-server/game/AndarBahar/app/core/game/game_logic.go
  9. 2
      game-server/game/AndarBahar/app/core/game/game_new.go
  10. 35
      game-server/game/AndarBahar/app/core/game/game_out_room.go
  11. 16
      game-server/game/AndarBahar/app/core/game/game_over.go
  12. 12
      game-server/game/AndarBahar/app/core/game/game_repeat_room.go
  13. 25
      game-server/game/AndarBahar/app/core/game/game_robot.go
  14. 6
      game-server/game/AndarBahar/app/core/game/game_update_gold.go
  15. 44
      game-server/game/AndarBahar/app/core/protocol/protocol_msg.go
  16. 15
      game-server/game/AndarBahar/app/core/room/roommgr.go
  17. 11
      game-server/game/AndarBahar/app/gamemanage/gamemanage.go
  18. 2
      game-server/game/AndarBahar/app/route/route.go

12
game-server/game/AndarBahar/app/core/game/game.go

@ -70,7 +70,7 @@ type Room struct {
PersonalRate int64 // 个人倍率
RoomRate int64 // 房间倍率
RoomLimit decimal.Decimal //int64// 房间进入条件
playerMap map[int32]*Player //
PlayerMap map[int32]*Player //
MaxPlayerNum int32 //
State int32 //房间状态 0空闲,1准备开始,2花色下注,3花色结算,4二轮下注,5二轮结算
PokerIndex int32 //
@ -145,13 +145,13 @@ func (rr *Room) OnPlayerReady(userId int64, p interface{}) {
// GetRoomPlayer 获取玩家-chairId==椅子号
func (rr *Room) GetRoomPlayer(chairId int32) *Player {
return rr.playerMap[chairId]
return rr.PlayerMap[chairId]
}
// GetRoomPlayerCount 房间人数
func (rr *Room) GetRoomPlayerCount() int32 {
// count := int32(0)
// for _, v := range rr.playerMap {
// for _, v := range rr.PlayerMap {
// //玩家掉线也好还是主动退出房间也好,并不会在房间中消除该玩家对象,一律视为掉线状态
// //掉线状态表示不在房间
// if v.OnlineState != 0 {
@ -159,12 +159,12 @@ func (rr *Room) GetRoomPlayerCount() int32 {
// }
// }
// return count
return int32(len(rr.playerMap))
return int32(len(rr.PlayerMap))
}
func (rr *Room) GetRoomRealPlayerCount() int32 {
count := int32(0)
for _, v := range rr.playerMap {
for _, v := range rr.PlayerMap {
if !v.IsRobot {
count++
}
@ -174,7 +174,7 @@ func (rr *Room) GetRoomRealPlayerCount() int32 {
// GetRoomPlayerByUid 通过uid取player_obj
func (rr *Room) GetRoomPlayerByUid(uid int64) *Player {
for _, p := range rr.playerMap {
for _, p := range rr.PlayerMap {
if p.Uid == uid {
return p
}

20
game-server/game/AndarBahar/app/core/game/game_bet.go

@ -17,7 +17,7 @@ func (rr *Room) OnUserBet(uid int64, msg interface{}) { // 用户下注
NotifyBet := &protocol.NotifyBet{}
ChairId := int32(-1)
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if player.Uid == uid {
ChairId = player.ChairId
break
@ -36,7 +36,7 @@ func (rr *Room) OnUserBet(uid int64, msg interface{}) { // 用户下注
// 下注区域判断
CurrentBetState := 1
player := rr.playerMap[ChairId]
player := rr.PlayerMap[ChairId]
for _, TempBetInfo := range message.BetInfo {
if rr.CurrentGameState == protocol.STATE_COLOR_BET {
if TempBetInfo.BetArea < protocol.AREA_HONG || TempBetInfo.BetArea > protocol.AREA_FANG {
@ -64,7 +64,7 @@ func (rr *Room) OnUserBet(uid int64, msg interface{}) { // 用户下注
// 个人限红
UserPersonLimit := int64(0)
UserCurrentBet := int64(0)
for _, tempBetWin := range rr.playerMap[ChairId].BetWin {
for _, tempBetWin := range rr.PlayerMap[ChairId].BetWin {
UserPersonLimit += tempBetWin.BetAmount
}
for _, info := range message.BetInfo {
@ -79,10 +79,10 @@ func (rr *Room) OnUserBet(uid int64, msg interface{}) { // 用户下注
return
}
if !player.IsRobot && UserCurrentBet > rr.playerMap[ChairId].Gold.IntPart() {
log.Debug("玩家", ChairId, "个人下注总值", UserCurrentBet, " 拥有的钱: ", rr.playerMap[ChairId].Gold.IntPart())
if !player.IsRobot && UserCurrentBet > rr.PlayerMap[ChairId].Gold.IntPart() {
log.Debug("玩家", ChairId, "个人下注总值", UserCurrentBet, " 拥有的钱: ", rr.PlayerMap[ChairId].Gold.IntPart())
BetRes.Code = protocol.ErrorCodeBetError
BetRes.CodeMsg = "玩家最多再下注 " + strconv.Itoa(int(rr.playerMap[ChairId].Gold.IntPart()))
BetRes.CodeMsg = "玩家最多再下注 " + strconv.Itoa(int(rr.PlayerMap[ChairId].Gold.IntPart()))
rr.Send(player, route.BetRes, BetRes)
return
}
@ -145,11 +145,11 @@ func (rr *Room) OnUserBet(uid int64, msg interface{}) { // 用户下注
}
// 下过注
rr.playerMap[ChairId].CurrentRoundBet = true
rr.PlayerMap[ChairId].CurrentRoundBet = true
BetRes.ChairID = ChairId
BetRes.TableTotalWin = rr.playerMap[ChairId].TableWin
BetRes.UserScore = rr.playerMap[ChairId].Gold.IntPart()
BetRes.TableTotalWin = rr.PlayerMap[ChairId].TableWin
BetRes.UserScore = rr.PlayerMap[ChairId].Gold.IntPart()
BetRes.BetInfo = message.BetInfo
NotifyBet.ChairID = BetRes.ChairID
@ -159,7 +159,7 @@ func (rr *Room) OnUserBet(uid int64, msg interface{}) { // 用户下注
NotifyBet.BetInfo[key].AreaTotalAmount = rr.AreaAmount[info.BetArea-1].AreaTotalAmount
}
for _, TempPlayer := range rr.playerMap {
for _, TempPlayer := range rr.PlayerMap {
if TempPlayer.ChairId == ChairId {
rr.Send(TempPlayer, route.BetRes, BetRes)
} else {

2
game-server/game/AndarBahar/app/core/game/game_comm.go

@ -31,7 +31,7 @@ func (rr *Room) ColorGroup(arr []int) map[int][]int {
func (rr *Room) GetInRoomRobotCount() int32 {
unm := int32(0)
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if player.IsRobot == true {
unm++
}

12
game-server/game/AndarBahar/app/core/game/game_copy.go

@ -88,22 +88,22 @@ func (rr *Room) Copy(SrcRoom *Room, Uid int64) {
rr.RobotMgr.OnInit("", rr)
// 复制桌子上的人过来
for i, i2 := range SrcRoom.playerMap {
for i, i2 := range SrcRoom.PlayerMap {
if i2.IsRobot {
rr.playerMap[i] = i2
rr.PlayerMap[i] = i2
rr.RobotMgr.CopyRobotsEnterGameRoom(i2)
}
if Uid == i2.Uid {
rr.playerMap[i] = i2
rr.PlayerMap[i] = i2
}
}
// 删除挪过来的人
for i, i2 := range SrcRoom.playerMap {
for i, i2 := range SrcRoom.PlayerMap {
if Uid == i2.Uid {
SrcRoom.playerMap[i] = nil
delete(SrcRoom.playerMap, i)
SrcRoom.PlayerMap[i] = nil
delete(SrcRoom.PlayerMap, i)
break
}
}

2
game-server/game/AndarBahar/app/core/game/game_disconnect.go

@ -13,7 +13,7 @@ func (rr *Room) OnDisconnect(userId int64) {
log.Debug(" 桌子号", rr.RId, "玩家", userId, "离线")
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if player != nil {
if player.Uid == userId {
player.OnlineState = USER_OFF_LINE

2
game-server/game/AndarBahar/app/core/game/game_get_room_info.go

@ -38,7 +38,7 @@ func (rr *Room) OnGetRoomInfo(uid int64, ctx *node.Context) interface{} {
})
}
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if player.Uid == uid {
pPlayer = player
}

4
game-server/game/AndarBahar/app/core/game/game_join_room.go

@ -88,9 +88,9 @@ func (rr *Room) JoinRoom(pPlayer *Player) int32 {
SitDownRes.PlayerInfo = TableSeat
NotifySitDown.PlayerInfo = TableSeat
rr.playerMap[pPlayer.ChairId] = pPlayer
rr.PlayerMap[pPlayer.ChairId] = pPlayer
for temChairID, temPlayer := range rr.playerMap {
for temChairID, temPlayer := range rr.PlayerMap {
if temChairID != pPlayer.ChairId {
rr.Send(temPlayer, route.NotifySitDown, NotifySitDown)
}

14
game-server/game/AndarBahar/app/core/game/game_logic.go

@ -14,7 +14,7 @@ func (rr *Room) UpdateCtx(uid int64, ctx *node.Context) {
rr.roomRWLock.Lock()
defer rr.roomRWLock.Unlock()
for _, p := range rr.playerMap {
for _, p := range rr.PlayerMap {
if p.Uid == uid {
log.Debug("桌子ID", rr.RId, "User ", uid, " 用户名字 ", p.Nickname, "原来的 ", p.Ctx, "新的 Ctx", ctx)
p.OnlineState = USER_ON_LINE
@ -28,9 +28,9 @@ func (rr *Room) UpdateUserOut(uid int64) { // 更新用户退出状态
rr.roomRWLock.Lock()
defer rr.roomRWLock.Unlock()
for Index, p := range rr.playerMap {
for Index, p := range rr.PlayerMap {
if p.Uid == uid {
rr.playerMap[Index].UserNeedOut = true
rr.PlayerMap[Index].UserNeedOut = true
break
}
}
@ -55,13 +55,13 @@ func (rr *Room) run() {
//为点控玩家创建的房间 玩家走了 就销毁
//定时器只有在创建房间的时候和销毁房间的时候 开启或者停止
for _, p := range rr.playerMap {
for _, p := range rr.PlayerMap {
if rr.CreatorId != 0 && p.Uid == rr.CreatorId && p.OnlineState != USER_ON_LINE {
rr.GronTimer.Stop()
rr.RobotMgr.GronTimer.Stop()
log.Debug(" 桌子号", rr.RId, "点控玩家离开,解散房间")
for _, p := range rr.playerMap {
for _, p := range rr.PlayerMap {
rr.QuitRoomFunc(p.Uid)
}
rr.DestroyRoomFunc(rr.RId)
@ -154,7 +154,7 @@ func (rr *Room) run() {
log.Debug("------------------------------等待开始", rr.RId)
// 踢出连续五局没下注的用户
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if !player.IsRobot && player.NoBetCount > 0 {
log.Debug("用户 ", player.Nickname, " 已经连续 ", player.NoBetCount, " 局没下注 ", rr.RId)
}
@ -241,7 +241,7 @@ func (rr *Room) SendAllMessage(msgId int32, message interface{}) {
rr.NotifyFunc(route.NotifyDTStateTime, message)
}
for _, pPlayer := range rr.playerMap {
for _, pPlayer := range rr.PlayerMap {
if pPlayer != nil {
rr.Send(pPlayer, msgId, message)
}

2
game-server/game/AndarBahar/app/core/game/game_new.go

@ -19,7 +19,7 @@ func New(Uid, rid int64, RoomID, GameID, AgentID int32, destory comm.DestoryCB,
GameID: GameID,
ReasonString: strconv.Itoa(int(GameID)) + "|" + strconv.Itoa(int(RoomID)),
AgentID: AgentID,
playerMap: make(map[int32]*Player),
PlayerMap: make(map[int32]*Player),
RobotMgr: NewRobotManager(),
Round: 0,
WinPlayer: INVALID_VALUE,

35
game-server/game/AndarBahar/app/core/game/game_out_room.go

@ -9,14 +9,14 @@ import (
func (rr *Room) UpdateSeat() {
l := rr.GetRoomPlayerCount()
for i := int32(0); i < l; i++ {
p := rr.playerMap[i]
p := rr.PlayerMap[i]
if p == nil {
ChairId := rr.MakeChairId()
rr.playerMap[ChairId].ChairId = ChairId
rr.PlayerMap[ChairId].ChairId = ChairId
}
}
for _, pPlayer := range rr.playerMap {
for _, pPlayer := range rr.PlayerMap {
if pPlayer == nil {
continue
}
@ -36,14 +36,14 @@ func (rr *Room) OnGetOutRoom(uid int64, Code int32) bool {
ret := false
var tempPlayerMap = map[int32]*Player{}
for seatId, pPlayer := range rr.playerMap {
for seatId, pPlayer := range rr.PlayerMap {
if pPlayer == nil {
continue
}
tempPlayerMap[seatId] = pPlayer
}
for _, pPlayer := range rr.playerMap {
for _, pPlayer := range rr.PlayerMap {
if pPlayer == nil {
continue
}
@ -55,10 +55,23 @@ func (rr *Room) OnGetOutRoom(uid int64, Code int32) bool {
pPlayer.OnlineState = USER_LEAVE
pPlayer.Ctx = nil
//为了下面的rr.playerMap = tempPlayerMap这个表达式
//为了下面的rr.PlayerMap = tempPlayerMap这个表达式
tempPlayerMap[pPlayer.ChairId].OnlineState = USER_LEAVE
tempPlayerMap[pPlayer.ChairId].Ctx = nil
rr.QuitRoomFunc(pPlayer.Uid)
// 通知大厅有人离开
NotifySitDown := &protocol.NotifyDTSitDown{
Uid: pPlayer.Uid,
RoomID: rr.RoomID,
TableID: rr.RId,
ChairID: pPlayer.ChairId,
Avatar: pPlayer.Avatar,
State: rr.CurrentGameState,
CurrentCount: rr.GetRoomPlayerCount() - 1,
}
rr.NotifyFunc(route.NotifyDTStandUp, NotifySitDown)
delete(tempPlayerMap, pPlayer.ChairId)
} else {
//针对机器人的删除
@ -71,9 +84,9 @@ func (rr *Room) OnGetOutRoom(uid int64, Code int32) bool {
}
}
rr.playerMap = tempPlayerMap
rr.PlayerMap = tempPlayerMap
//for i, v := range rr.playerMap {
//for i, v := range rr.PlayerMap {
// log.Debug(" 桌子号", rr.RId, "退出房间后,房间中的玩家", i, "的信息", v.Uid, ":", v)
//}
@ -91,12 +104,12 @@ func (rr *Room) OnGetOutRoom(uid int64, Code int32) bool {
rr.RobotMgr.GronTimer.Stop()
for i := int32(0); i < playerCount; i++ {
p := rr.playerMap[i]
p := rr.PlayerMap[i]
if p == nil {
continue
}
rr.playerMap[i] = nil
delete(rr.playerMap, i)
rr.PlayerMap[i] = nil
delete(rr.PlayerMap, i)
//这里面来全是机器人的,所有不需要调用 rr.QuitRoomFunc
}

16
game-server/game/AndarBahar/app/core/game/game_over.go

@ -42,7 +42,7 @@ func (rr *Room) OnEventGameConclude() { // 结束-结算
rr.UserCtlGear = 0
PlayerCount := rr.GetRoomPlayerCount()
for i := int32(0); i < PlayerCount; i++ {
p := rr.playerMap[i]
p := rr.PlayerMap[i]
if p == nil || p.IsRobot {
continue
}
@ -79,7 +79,7 @@ func (rr *Room) OnEventGameConclude() { // 结束-结算
{BetArea: protocol.AREA_FANG},
} // AreaTotalAmount 记录开这个区域总赢的钱
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if !player.IsRobot {
if len(sPlayers) == 0 {
sPlayers = sPlayers + player.UserNo
@ -192,7 +192,7 @@ func (rr *Room) OnEventGameConclude() { // 结束-结算
WinArea: []int32{WinArea},
}
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
TableSeat := &protocol.RoomPlayer{}
//输赢
@ -318,7 +318,7 @@ func (rr *Room) OnBuildOtherResultPoker() { //计算第二阶段扑克
rr.UserCtlGear = 0
PlayerCount := rr.GetRoomPlayerCount()
for i := int32(0); i < PlayerCount; i++ {
p := rr.playerMap[i]
p := rr.PlayerMap[i]
if p == nil || p.IsRobot {
continue
}
@ -373,7 +373,7 @@ func (rr *Room) OnBuildOtherResultPoker() { //计算第二阶段扑克
{BetArea: protocol.AREA_BANHAR},
} // AreaTotalAmount 记录开这个区域总赢的钱
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if !player.IsRobot {
for _, BetWinArea := range player.BetWin {
for index, TempUserWinArea := range UserWinArea {
@ -438,7 +438,7 @@ func (rr *Room) OnBuildOtherResultPoker() { //计算第二阶段扑克
{BetArea: protocol.AREA_99},
} // AreaTotalAmount 记录开这个区域总赢的钱
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if !player.IsRobot {
for _, BetWinArea := range player.BetWin {
for index, TempUserWinArea := range UserWinArea {
@ -691,7 +691,7 @@ func (rr *Room) OnEventGameConclude2() { // 结束-结算
var sArea string
var sPlayers string
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
if !player.IsRobot {
if len(sPlayers) == 0 {
sPlayers = sPlayers + player.UserNo
@ -701,7 +701,7 @@ func (rr *Room) OnEventGameConclude2() { // 结束-结算
}
}
for _, player := range rr.playerMap {
for _, player := range rr.PlayerMap {
player.PlayCount++
if !player.CurrentRoundBet {
player.NoBetCount++

12
game-server/game/AndarBahar/app/core/game/game_repeat_room.go

@ -30,15 +30,15 @@ func (rr *Room) RepeatRoom() {
}
func (rr *Room) RepeatRoomUser() { //复位玩家的数据
for index, _ := range rr.playerMap {
for index, _ := range rr.PlayerMap {
if rr.State == EN_TABLE_STATE_READY_TO_START {
rr.playerMap[index].CurrentRoundBet = false
rr.PlayerMap[index].CurrentRoundBet = false
}
rr.playerMap[index].BetScore = 0
rr.playerMap[index].WinScore = 0
rr.playerMap[index].BetWin = rr.playerMap[index].BetWin[:0]
rr.PlayerMap[index].BetScore = 0
rr.PlayerMap[index].WinScore = 0
rr.PlayerMap[index].BetWin = rr.PlayerMap[index].BetWin[:0]
for i := 1; i < 11; i++ {
rr.playerMap[index].BetWin = append(rr.playerMap[index].BetWin, protocol.BetAreaInfo{
rr.PlayerMap[index].BetWin = append(rr.PlayerMap[index].BetWin, protocol.BetAreaInfo{
BetArea: int32(i),
BetAmount: 0,
AreaTotalAmount: 0,

25
game-server/game/AndarBahar/app/core/game/game_robot.go

@ -122,6 +122,19 @@ func (r *RobotManager) RobotsEnterGameRoom() {
log.Debug(" 桌子号", r.GameRoom.RId, "机器人加入房间失败")
return
}
// 通知大厅有机器人坐下
NotifySitDown := &protocol.NotifyDTSitDown{
Uid: pPlayer.Uid,
RoomID: r.GameRoom.RoomID,
TableID: r.GameRoom.RId,
ChairID: pPlayer.ChairId,
Avatar: pPlayer.Avatar,
State: r.GameRoom.CurrentGameState,
CurrentCount: r.GameRoom.GetRoomPlayerCount(),
}
r.GameRoom.NotifyFunc(route.NotifyDTSitDown, NotifySitDown)
r.playerMaps[pPlayer.ChairId] = pPlayer
r.playerStat[pPlayer.ChairId] = 1
r.playerBetCtrl[pPlayer.ChairId] = &RobotBetCtrlInfo{}
@ -428,6 +441,18 @@ func (r *RobotManager) OnRobotMessage(msgId int32, player *Player, msg interface
}
if r.GameRoom.GetInRoomRobotCount() > int32(LeastMin) && rand.Intn(10000) < LeavePro {
// 通知大厅有人离开
NotifySitDown := &protocol.NotifyDTSitDown{
Uid: player.Uid,
RoomID: r.GameRoom.RoomID,
TableID: r.GameRoom.RId,
ChairID: player.ChairId,
Avatar: player.Avatar,
State: r.GameRoom.CurrentGameState,
CurrentCount: r.GameRoom.GetRoomPlayerCount() - 1,
}
r.GameRoom.NotifyFunc(route.NotifyDTStandUp, NotifySitDown)
r.GameRoom.OnGetOutRoom(player.Uid, 0)
log.Debug(r.GameRoom.RId, " 机器人 ", player.Uid, " 需要离开 当前机器人个数", r.GameRoom.GetInRoomRobotCount())
}

6
game-server/game/AndarBahar/app/core/game/game_update_gold.go

@ -11,7 +11,7 @@ func (rr *Room) OnUpdateGold(userId int64) { // 更新用户的钱
rr.roomRWLock.Lock()
defer rr.roomRWLock.Unlock()
for i, player := range rr.playerMap {
for i, player := range rr.PlayerMap {
if player.Uid == userId {
client2, err := assetservice.NewClient(player.Ctx.Proxy.NewServiceClient)
@ -28,9 +28,9 @@ func (rr *Room) OnUpdateGold(userId int64) { // 更新用户的钱
return
}
rr.playerMap[i].Gold = decimal.NewFromFloat(float64(reply3.Gold))
rr.PlayerMap[i].Gold = decimal.NewFromFloat(float64(reply3.Gold))
log.Debug("更新玩家 ", player.Uid, " 名字:", player.Nickname, " 金币:", rr.playerMap[i].Gold)
log.Debug("更新玩家 ", player.Uid, " 名字:", player.Nickname, " 金币:", rr.PlayerMap[i].Gold)
break
}
}

44
game-server/game/AndarBahar/app/core/protocol/protocol_msg.go

@ -87,17 +87,31 @@ type NotifyGameConclude struct { // 通知游戏结束结算
Record HistoryRecord `json:"record"` //历史记录
}
type EnterHallTableUserInfo struct {
ChairID int32 `json:"chairId"` //座位号
Avatar string `json:"avatar"` //头像
}
type EnterHallAreaConfig struct {
AreaID int32 `json:"AreaID"` //区域ID
AreaName string `json:"AreaName"` //区域名字
AreaPro float64 `json:"AreaPro"` //区域赔率
AreaLimit int64 `json:"AreaLimit"` //区域限制
}
type EnterHallRes struct { // 登陆大厅返回所有记录
Code int32 `json:"code"` //错误码
CodeMsg string `json:"codeMsg"` //错误内容
MinBet int64 `json:"minBet"` //最小下注
PlayerCount int32 `json:"playerCount"` //游戏人数
GameState int32 `json:"gameState"` //游戏阶段
NextTimestamp int64 `json:"nextTimestamp"` //下阶段开始时间戳
AAreaCount int32 `json:"aAreaCount"` //A区域记录个数
BAreaCount int32 `json:"bAreaCount"` //B区域记录个数
RecordTotalCount int32 `json:"recordTotalCount"` //记录总个数
ABArea []int32 `json:"record,omitempty"` //0 A区域 1 B区域
Code int32 `json:"code"` //错误码
CodeMsg string `json:"codeMsg"` //错误内容
MinBet int64 `json:"minBet"` //最小下注
PlayerCount int32 `json:"playerCount"` //游戏人数
GameState int32 `json:"gameState"` //游戏阶段
NextTimestamp int64 `json:"nextTimestamp"` //下阶段开始时间戳
AAreaCount int32 `json:"aAreaCount"` //A区域记录个数
BAreaCount int32 `json:"bAreaCount"` //B区域记录个数
RecordTotalCount int32 `json:"recordTotalCount"` //记录总个数
ABArea []int32 `json:"record,omitempty"` //0 A区域 1 B区域
AreaPro []EnterHallAreaConfig `json:"areaPro,omitempty"` //区域的赔率
UserList []EnterHallTableUserInfo `json:"userList,omitempty"` //玩家列表 16个
}
type NotifySingleGameRecord struct { // 通知最新一条记录
@ -167,3 +181,13 @@ type RecordInfo struct { // 通知最新一条记录
AreaPro float64 `json:"areaPro"`
IsWin bool `json:"isWin"`
}
type NotifyDTSitDown struct { //通知大厅玩家坐下
Uid int64 `json:"uid"` // userId
RoomID int32 `json:"roomID"` // 房间ID 0初级场 1中级场 2高级场
TableID int64 `json:"tableID"` // 桌子ID 快速加入时桌子ID用0 不然用TableInfo里的TableID
ChairID int32 `json:"chairId"` // 座位号
Avatar string `json:"avatar"` // 玩家头像
State int32 `json:"state"` // 房间状态
CurrentCount int32 `json:"currentCount"` //当前总人数
}

15
game-server/game/AndarBahar/app/core/room/roommgr.go

@ -119,6 +119,21 @@ func (h *Home) EnterHall(uid int64, ctx *node.Context) { //进入大厅
EnterHallRes.BAreaCount++
}
}
for _, player := range GameRoom.PlayerMap {
EnterHallRes.UserList = append(EnterHallRes.UserList, protocol.EnterHallTableUserInfo{
ChairID: player.ChairId,
Avatar: player.Avatar,
})
if len(EnterHallRes.UserList) >= 16 {
break
}
}
for _, i2 := range GameRoom.BloodCtrl.AreaConfig {
EnterHallRes.AreaPro = append(EnterHallRes.AreaPro, i2)
}
ctx.Request.Message.Route = route.EnterHallRes
if err := ctx.Response(EnterHallRes); err != nil {
log.Debugf("EnterGame ==> response message failed: %v", err)

11
game-server/game/AndarBahar/app/gamemanage/gamemanage.go

@ -174,6 +174,17 @@ func EnterGame(ctx *node.Context) {
room.Gh.RhbEx[Ctx.Request.UID] = roomObj.GetRId()
roomObj.OnGetRoomInfo(Ctx.Request.UID, Ctx)
NotifySitDown := &protocol.NotifyDTSitDown{
Uid: _player.Uid,
RoomID: req.RoomID,
TableID: roomObj.GetRId(),
ChairID: _player.ChairId,
Avatar: _player.Avatar,
State: roomObj.GetState(),
CurrentCount: roomObj.GetRoomPlayerCount(),
}
room.Gh.Send(route.NotifyDTSitDown, NotifySitDown)
//message := roomObj.OnGetRoomInfo(Ctx.Request.UID)
//Ctx.Request.Message.Route = route.Enter
//if err := Ctx.Response(message); err != nil {

2
game-server/game/AndarBahar/app/route/route.go

@ -29,6 +29,8 @@ const (
EnterHallRes int32 = 2000550 // 登陆回复
// 服务端通知
NotifyDTSitDown int32 = 2000530 // 通知大厅玩家坐下
NotifyDTStandUp int32 = 2000531 // 通知大厅玩家离开
NotifySingleGameRecord int32 = 2000560 // 通知最新一条记录
NotifyDTStateTime int32 = 2000561 // 大厅通知阶段倒计时
)

Loading…
Cancel
Save