|
- local RoomCmd=MJFramework.MJImport("mj.luaScript.Protocol.MJCmd")
- local MJMessage=MJFramework.MJImport("mj.luaScript.Protocol.MJMessage")
- local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine")
-
- local Room = class("Room" , require("luaScript.Protocol.ProtocolRoomBase"))
-
- function Room:initRoomInfo()
- -- 房间信息
- self.roomInfo ={
- memberList={},
- }-- MJMessage.RoomInfoLocal:new()
-
- self.seatShowList = {} -- [seatShowId] = nUserId
-
- self:resetDismissData()
- --手牌数据
- self.cards = {}
- end
-
- function Room:resetDismissData()
- --玩家解散数据(userId 为Key,解散类型为value)
- self.dismissInfo = {}
- --解散总时间
- self.roomInfo.nDismissToTalTime = nil
- -- 解散倒计时
- self.roomInfo.nDismissStateTime = nil
- -- 解散显示
- self.roomInfo.nShowDismiss = false
- end
-
- -- 游戏正式开始
- function Room:onGameStartResponse(status, response)
- logD("-------------------- 新的一局开始了 ------------------------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- logD("Room:onGameStartResponse(), ", table.tostring(response))
-
- self.roomInfo.nGameStartCount = response.nGameStartCount;
- self.roomInfo.nTotalGameNum = response.nTotalGameNum;
- self.roomInfo.nRoomOwnedUid = response.nRoomOwnedUid;
- self.roomInfo.nBankSeatId = response.nBankSeatId;
- self.roomInfo.shuffleList = response.shuffleList;
- self.roomInfo.shuffleNum = response.shuffleNum;
- self.roomInfo.nLeaveCardNum = 0
-
- -- 清空上一局的手牌信息
- self.cards = {}
-
- -- 发送广播通知,游戏开始了
- self:dispatchEvent({name = MJDefine.MJEvent.GameStartResponse});
- end
-
- -- 游戏发牌结果
- function Room:onGameSendCardResponse(status, response)
- logD("-------------------- 游戏发牌 ------------------------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- --[[ -- 用户uid
- , defVar("nUserId", VT_Int, 0)
- -- 庄家第一张摸的牌
- , defVar("nbankFirstGrabCard", VT_UChar, 0)
- -- 牌值类型列表
- , defVar("cardList", VT_Vector(CardSendListData), {})--]]
-
- logD("Room:onGameSendCardResponse(), ", table.tostring(response))
-
- -- self.roomInfo.nbankFirstGrabCard = response.nbankFirstGrabCard
-
- --目前server只发自己过来,后续战绩回放考虑到会发所有玩家来,故以userid为key于扩展
- -- local cardData = self:serverCardToMyCard(response.cardList)
- -- logD("Room:onGameSendCardResponse : "..table.tostring(cardData))
- for k,v in pairs(response.playerCards) do
- self.roomInfo.memberList[v.nUserId].handCards = v.handCards
- end
-
- -- self.cards[response.nUserId] = cardData
-
- -- 发送广播通知,发牌开始了
- self:dispatchEvent({name = MJDefine.MJEvent.GameSendCardResponse});
- end
-
- -- 系统发牌后发来的自动提操作
- function Room:onSystemOperationStart(status, response)
- logD("-------------------- 游戏提结果 ------------------------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- logD("Room:onSystemOperationStart(), ", table.tostring(response))
-
- -- 发送广播通知,游戏开始了
- self:dispatchEvent({name = "onSystemOperationStart",response = response});
- end
-
- -- 广播桌子上所有玩家庄家起手操作
- --[[若庄家可以胡牌, 则客户端显示胡牌, 过两个按钮,若不能胡牌,则判断用户是否要出牌,
- 若能出牌,则显示出牌提示,若庄家既不能胡牌,也不能出牌,客户端无需处理,
- 此种情况下server会自动跳转到下家抓牌, 强制胡牌的情况下必胡
- ]]
- function Room:onBankerOutCard(status, response)
- logD("-------------------- 游戏庄家起手操作------------------------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
- self.roomInfo.nLeaveCardNum = response.nLeaveCardNum
- self.roomInfo.needOutCardId = response.nUserId
-
- --logD("Room:onBankerOutCard(), ", table.tostring(response))
- local myUserId = self:getMyUserId()
- if response.nUserId==myUserId then
- --这里自己摸牌后,不隐藏听牌提示
- --self.roomInfo.memberList[myUserId].nTingStatus=MJDefine.MJTingStatus.NoTing
- -- dump(self.roomInfo.memberList[myUserId])
- --self:dispatchEvent({name = MJDefine.MJEvent.TingSatus})
- end
- -- 发送广播通知,游戏开始了
- self:dispatchEvent({name = MJDefine.MJEvent.BankerOutCard ,response = response});
- end
-
- function Room:onQiangGangHu(status,response)
- logD("-------------------- 抢杠胡 ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
-
- logD("Room:onQiangGangHu(), response = ", table.tostring(response))
- self:dispatchEvent({name = MJDefine.MJEvent.QiangGangHu , response = response});
- end
-
-
- function Room:onQiPai(status,response)
- logD("-------------------- 弃牌 ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
- logD("Room:onQiPai(), response = ", table.tostring(response))
-
- self:dispatchEvent({name = MJDefine.MJEvent.OutCardResponse ,response = response});
- end
-
-
- function Room:onOutCardError(status,response)
- logD("-------------------- 出牌错误 ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
- logD("Room:onOutCardError(), response = ", table.tostring(response))
- --[[错误码说明:
- OUT_CARD_SUCCESS = 0, //正常
- OUT_CARD_ON_NEED = 1, //不需要出牌
- OUT_CARD_INVALID = 2, //出牌非法--]]
- local errorCode = response.result
- -- if errorCode == LHQ_OUT_CARD_ERROR_TIP.OUT_CARD_SUCCESS then
- showTooltip("出牌无效")
- -- elseif errorCode == LHQ_OUT_CARD_ERROR_TIP.OUT_CARD_SUCCESS then
- -- showTooltip("不需要出牌")
- -- else
- -- showTooltip("出牌未知")
- -- end
- self:dispatchEvent({name = MJDefine.MJEvent.OutCardError });
- end
-
- function Room:onOutCardSuccess(status,response)
- logD("-------------------- 出牌成功 ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
- logD("Room:onOutCardSuccess(), response = ", table.tostring(response))
-
-
- self:dispatchEvent({name = MJDefine.MJEvent.OutCardSuccess , response = response});
- end
-
- function Room:onTurnOutCard(status,response)
- logD("-------------------- 指示出牌 ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
- logD("Room:onTurnOutCard(), response = ", table.tostring(response))
-
-
- self:dispatchEvent({name = MJDefine.MJEvent.TurnOutCard});
- end
-
-
- --小局结算
- function Room:onGameXiaoJuResponse(status, response)
- logD("--------------------小局结算 ------------------------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- -- 一局结束的原因
- self.roomInfo.stopFlag=response.stopFlag
- -- 房间信息
- self.roomInfo.strGameInfo=response.strGameInfo
- --结算信息
- self.roomInfo.strResultInfo=response.strResultInfo
- --玩家信息
- for k,v in pairs(response.playerInfos) do
- if self.roomInfo.memberList[v.nUserId] then
- --当前局分数
- self.roomInfo.memberList[v.nUserId].nTurnScore=v.nTurnScore
- --总分
- self.roomInfo.memberList[v.nUserId].nTotalMoney=v.nTotalMoney
-
- --玩家本局输赢情况 0不胡不输 1胡,2点炮或者输
- self.roomInfo.memberList[v.nUserId].result=v.result
- -- 胡牌牌类型-7对胡、平胡,0为输或者不胡不输
- self.roomInfo.memberList[v.nUserId].huType=v.huType
-
- self.roomInfo.memberList[v.nUserId].gruoupCards = v.gruoupCards
- self.roomInfo.memberList[v.nUserId].outCards = v.outCards
- self.roomInfo.memberList[v.nUserId].handCards = v.handCards
- end
- -- self.roomInfo.memberList[v.nUserId].nTotalMoney=v.nTotalMoney
- -- self.roomInfo.memberList[v.nUserId].
- -- local viewId = app.room:getViewIdByUserId(k)
- -- local nScore = v.nTotalMoney
- -- local memberInfo = app.room.roomInfo.memberList[k]
- -- memberInfo.nTotalMoney = nScore
- -- self.allNodes[viewId].score:setText(tostring(nScore))
- end
- -- self.roomInfo.playerInfos",VT_Vector(message.XiaojuPlayerInfo),{})
-
- --是否大局结束,结束是1
- self.roomInfo.isGameOver=response.isGameOver
-
- --操作统计
- self.roomInfo.opsCntMapString=response.opsCntMapString
-
-
- self.roomInfo.scoreCntMap=json.decode(response.soreCntMapString)
-
- logD("Room:onGameXiaoJuResponse() :", table.tostring(response))
- self:dispatchEvent({name = MJDefine.MJEvent.GameXiaoJuResponse,response = response});
- end
-
- --大局结算
- function Room:onGameDaJuResponse(status, response)
- logD("-------------------- 大局结算 ------------------------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- for k,v in pairs(response.nTotalPlayerInfos) do
- if self.roomInfo.memberList[v.nUserId] then
- self.roomInfo.memberList[v.nUserId].nTotalInfo=json.decode(v.nTotalInfo)
- end
- end
-
- logD("Room:onGameDaJuResponse() :", table.tostring(response))
- self:dispatchEvent({name = MJDefine.MJEvent.GameDaJuResponse ,response = response});
- end
-
-
-
- -- 玩家进入桌子成功
- function Room:onSitDownSuccessResponse(status, response)
- logD("--------------------玩家进入桌子成功--------------------")
- logD("Room:onSitDownSuccessResponse(), ", table.tostring(response))
-
- app.net:onMsgClear()
- app.net:onMsgPause()
-
- -- 记录当前桌子号
- self:initRoomInfo()
-
- -- 获取到的房间信息
- -- self.gameId = response.gameId
- self.roomInfo.gameId = response.gameId
- self.roomInfo.nShowTableId = response.nShowTableId
- self.roomInfo.nMaxPlayCount = response.nMaxPlayCount
- self.roomInfo.nRoomOwnedUid = response.nRoomOwnedUid
- self.roomInfo.nTotalGameNum = response.nTotalGameNum
- self.roomInfo.strGameInfo = response.strGameInfo
- self.roomInfo.nGameStartCount = response.nGameStartCount or 0
- self.roomInfo.nLeaveCardNum = response.nLeaveCardNum or 0
-
- -- 桌子上其他玩家的信息
- for k,v in pairs(response.memberList) do
- self.roomInfo.memberList[v.nUserId] = v
- -- self.roomInfo.memberList[v.nUserId].nTingStatus=MJDefine.MJTingStatus.NoTing
- end
-
- -- 更新椅子号
- self:updateUserSeateShowId()
-
- logD("Room:onSitDownSuccessResponse() roomInfo = ", table.tostring(self.roomInfo))
-
- -- 发送通知
- self:dispatchEvent({name = MJDefine.MJEvent.EnterRoomSuccess, gameId = self.roomInfo.gameId, gameType = self.roomInfo.strGameInfo.gamerule})
- end
-
- -- 玩家进入桌子失败
- function Room:onSitDownFailedResponse(status, response)
- logD("--------------------玩家进入桌子失败--------------------")
- local errorCode = response.nErrorCode
- local errorString = ENTER_ROOM_RET_STR[errorCode] or string.format("坐下失败 errorCode = %s", errorCode);
- showTooltip(errorString);
- end
-
- -- 更新玩家的相对椅子号
- function Room:updateUserSeateShowId()
- local myUserId = self:getMyUserId()
-
- local mySeatId
- self.isOnLooker = false
- if self.isOnLooker then
- mySeatId = 3
- else
- mySeatId = self.roomInfo.memberList[myUserId].nSeatId
- end
-
- self.roomInfo.nUserId = myUserId
- self.roomInfo.nSeatId = mySeatId
-
-
- --[视图椅子号] = userID
- --[座位号] = userID
- --[userID] = 视图椅子号
-
- self.seatList = {}
- self.userList = {}
-
- local playerCount=self.roomInfo.nMaxPlayCount or 4
-
- --[[local gameInfo = json.decode(self.roomInfo.strGameInfo)
- if gameInfo.isfaststart ~= 1 then
- playerCount = gameInfo.playnum
- end--]]
-
- for k,v in pairs(self.roomInfo.memberList) do
-
- local config=MJDefine.MJRoomPlayerSitConfig[playerCount]
-
- local num=(v.nSeatId - mySeatId + playerCount) % playerCount
-
- local nSeatShowId = config[num+1]
- -- if nSeatShowId == 0 then
- -- nSeatShowId = 4
- -- end
- self.seatShowList[nSeatShowId] = v.nUserId
- self.seatList[v.nSeatId] = v.nUserId
- self.userList[v.nUserId] = nSeatShowId
- end
- logD("User:updateUserSeateShowId(), playerCount", playerCount)
- logD("User:updateUserSeateShowId(), seatShowList", table.tostring(self.seatShowList))
- logD("User:updateUserSeateShowId(),seatList ", table.tostring(self.seatList))
- logD("User:updateUserSeateShowId(),userList ", table.tostring(self.userList))
- --logD("User:updateUserSeateShowId(), ")
- end
-
- -- 服务器下发玩家的准备状态
- function Room:onUserReadyResponse(status, response)
- logD("Room:onUserReadyResponse(), ", table.tostring(response))
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
- local nUserId = response.nUserId
-
- local memberInfo = self.roomInfo.memberList[nUserId]
- --准备的时候设置听
- memberInfo.nTingStatus=MJDefine.MJTingStatus.NoTing
- --标记准备了
- if memberInfo then
- memberInfo.nPlayerFlag = 1
- end
-
- self:dispatchEvent({name = MJDefine.MJEvent.UserReadyResponse ,nUserId=nUserId});
- end
-
- -- 我发起请求解散房间
- function Room:requestDismissRoom(opType)
- --1: 表示发起解散 2:同意解散 3:不同意解散
- local request = MJMessage.DismissRequest:new()
- request.operateType = opType
- self:sendResponse{cmd = RoomCmd.GAME_COMMAND_DISBAND_GAME , sender = request};
- end
-
- --8012
- function Room:onDismissResponse(status, response)
- --[[-- nUserId
- , defVar("nUserId", VT_Int, 0)
- -- 1: 表示发起解散 2:同意解散 3:不同意解散
- , defVar("operateType", VT_UChar, 0)
- -- 剩余解散超时时间
- , defVar("timeLeft", VT_Short, 0) --]]
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- local nUserId = response.nUserId
- local operateType = response.operateType
-
- -- 收到玩家发起请求时,数据重置
- if response.operateType == 1 then
- self:resetDismissData()
- end
-
- --数据记录
- self.dismissInfo[nUserId] = operateType;
- self:dispatchEvent({name = MJDefine.MJEvent.DismissResponse , response = response});
- end
-
- -- 发起请求回复 8011
- function Room:onUserDismissResultResponse(status, response)
- logD("User:onUserDismissResultResponse, ", table.tostring(response))
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
- --[[
- -- 0:成功
- -- 1:operateType取值范围不对
- -- 2:当前没人发起解散
- -- 3:已经有人申请解散
- , defVar("errorCode", VT_Short, 0)
- -- 玩家操作
- , defVar("operateType", VT_Int, 0)
-
- -- 桌子上其他用户数量
- , defVar("memberList", VT_VectorToMap(UserDismissResult, "nUserId"))
- -- 剩余解散超时时间
- , defVar("timeLeft", VT_Short, 0) --]]
-
- logD("30000000--runUserDismissResultResponse")
- if response.errorCode == 1 then
- showTooltip("operateType取值范围不对")
- elseif response.errorCode == 2 then
- showTooltip("当前没人发起解散")
- elseif response.errorCode == 3 then
- showTooltip("已经有人申请解散")
- elseif response.errorCode == 4 then
- showTooltip("用户已经操作过")
- else
- -- 其他玩家的解散状态
- for uid, value in pairs(response.memberList) do
- self.dismissInfo[uid] = value.dismissState
- end
- self:dispatchEvent({name = MJDefine.MJEvent.DismissResponse, response = response});
- end
- end
-
- -- 其他玩家退出房间
- function Room:onOtherLogoutResponse(status, response)
- logD("Room:onOtherLogoutResponse(), response = ", table.tostring(response))
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
- local nUserId = response.nUserId
- local nSeatShowId = self.userList[nUserId]
-
- if not self.roomInfo.isGameOver then
- local memberList = self.roomInfo.memberList
- memberList[nUserId]=nil
- end
- self:updateGpsUserInfo(nil,false)
- self.roomInfo.nStartGameUid = response.nStartGameUid
- logD("30000000--runOtherLogoutResponse")
- self:dispatchEvent({name = MJDefine.MJEvent.OtherLogoutResponse , nUserId = nUserId, nSeatShowId = nSeatShowId});
- end
-
- -- 其他玩家进入桌子
- function Room:onOtherSitDownResponse(status, response)
- logD("Room:onOtherSitDownResponse(), response = ", table.tostring(response))
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- local other = MJMessage.RoomMemberInfo:new()
- other.nUserId = response.nUserId
- other.nSeatId = response.nSeatId
- other.userInfo = response.userInfo
- other.nTotalMoney = response.nTotalMoney
- other.nPlayerFlag = response.nPlayerFlag
-
-
- local memberList = self.roomInfo.memberList
- -- 添加其他玩家的用户ID
- if memberList[other.nUserId] then
- memberList[other.nUserId] = other:updateTo(memberList[other.nUserId])
- else
- memberList[other.nUserId] = other
- end
-
- -- 更新椅子号
- self:updateUserSeateShowId()
-
- local nSeatShowId = self.userList[other.nUserId]
-
- --检测GPS
- self:updateGpsUserInfo(response.nUserId,true)
-
- -- 发送广播通知,某个位置有人坐下了
- self:dispatchEvent({name = MJDefine.MJEvent.OtherSitDownResponse , nSeatShowId = nSeatShowId});
-
-
- end
-
- function Room:onUserExitResponse(status, response)
- logD("Room:onUserExitResponse(), ", table.tostring(response))
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- local ttExtInfo = string.split(response.userInfo, ",")
- app.user.loginInfo.historyCardNum = ttExtInfo[1];
- app.user.loginInfo.curCardNum = ttExtInfo[2];
-
- self:dispatchEvent({name = MJDefine.MJEvent.UserExitResponseRoom ,response = response});
- end
-
-
- function Room:onTingCardStatus(status, response)
- logD("Room:onTingCardStatus(), ", table.tostring(response))
- print("--------onTingCardStatus--------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- local myUserId = app.user.loginInfo.uid
- self.roomInfo.memberList[myUserId].nTingStatus=response.nTingStatus
-
- self:dispatchEvent({name = MJDefine.MJEvent.TingSatus})
- end
-
- function Room:onTingCardResult( status, response )
- logD("Room:onTingCardResult(), ", table.tostring(response))
- print("--------onTingCardResult--------")
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- self:dispatchEvent({name = MJDefine.MJEvent.TingResult,response = response})
- end
-
- function Room:pushTing( status, response )
- print("--------pushTing--------")
- logD("Room:pushTing, ", table.tostring(response))
- if not self.roomInfo then
- logD("self.roomInfo no exist,容错处理!")
- return
- end
-
- self.roomInfo.tings={}
- for k,v in pairs(response.tings) do
- -- print(v)
- self.roomInfo.tings[v.card]=v.tingCards
- -- if v.card~=0 then
- -- print(v.card)
-
- -- end
- end
-
- --摸到牌不隐藏听牌提示
- --[[if table.nums(self.roomInfo.tings)>0 then
- local myUserId = self:getMyUserId()--app.user.loginInfo.uid
- self.roomInfo.memberList[myUserId].nTingStatus=MJDefine.MJTingStatus.NoTing--response.nTingStatus
- self:dispatchEvent({name = MJDefine.MJEvent.TingSatus})
- end--]]
-
- self:dispatchEvent({name = MJDefine.MJEvent.PushTing})
- end
-
- -- function Room:onDaiXing(status, response)
- -- logD("Room:onTingCardResult(), ", table.tostring(response))
- -- if not self.roomInfo then
- -- logD("self.roomInfo no exist,容错处理!")
- -- return
- -- end
-
- -- self:dispatchEvent({name = "onDaiXing",response = response});
- -- end
-
- -- function Room:onQiHuSelfResponese(status, response)
- -- logD("Room:onQiHuSelfResponese(), ", table.tostring(response))
- -- if not self.roomInfo then
- -- logD("self.roomInfo no exist,容错处理!")
- -- return
- -- end
-
- -- self:dispatchEvent({name = "onQiHuSelfResponese",response = response});
- -- end
-
- -- function Room:onOtherQiHuTongZhi(status, response)
- -- logD("Room:onOtherQiHuTongZhi(), ", table.tostring(response))
- -- if not self.roomInfo then
- -- logD("self.roomInfo no exist,容错处理!")
- -- return
- -- end
-
- -- self:dispatchEvent({name = "onOtherQiHuTongZhi",response = response});
- -- end
-
- function Room:resetRound()
- self.roomInfo.quickStartInfo = nil
- --self.roomInfo.hosting = 0--重置托管
- end
-
- function Room:resetFastInfo()
- self.roomInfo.quickStartInfo = nil
- end
-
- --断线重连
- function Room:onGameReconnection(status,response)
- logD("===============重连成功,清空之前所有存在的队列==================")
-
- app.net:onMsgClear()
- app.net:onMsgPause()
- logD("Room:onGameReconnection(), response = ", table.tostring(response))
- self:initRoomInfo();
-
- -- 获取到的房间信息
- self.roomInfo.gameId = response.gameId
- self.roomInfo.nShowTableId = response.nShowTableId
- self.roomInfo.nMaxPlayCount = response.nMaxPlayCount
- self.roomInfo.nRoomOwnedUid = response.nRoomOwnedUid
- self.roomInfo.nTotalGameNum = response.nTotalGameNum
- self.roomInfo.nBaseChips = response.nBaseChips
- self.roomInfo.strGameInfo = response.strGameInfo
- self.roomInfo.nGameStartCount = response.nGameStartCount
- self.roomInfo.nStatus = response.nStatus
- self.roomInfo.nBankSeatId = response.nBankSeatId
- self.roomInfo.nMySeatId = response.nMySeatId
- self.roomInfo.bUserDisbandGame = response.bUserDisbandGame
- self.roomInfo.nDismissStateTime = response.nDismissStateTime
- self.roomInfo.leaveCards = response.leaveCards
- self.roomInfo.nLeaveCardNum = #self.roomInfo.leaveCards
- self.roomInfo.outCardUserId = response.outCardUserId
- self.roomInfo.outCardSeatId = response.outCardSeatId
- self.roomInfo.lastOpCard = response.lastOpCard
-
- self.roomInfo.operates = response.operates
-
- self.roomInfo.needOutCardId = response.needOutCardId
- self.roomInfo.lastOutCardId = response.lastOutCardId
- self.roomInfo.lastOutCard = response.lastOutCard
- self.roomInfo.stopFlag = response.stopFlag
- self.roomInfo.strResultInfo = response.strResultInfo
- self.roomInfo.resultInfos = response.resultInfos
- self.roomInfo.opsCntMapString = response.opsCntMapString
- self.roomInfo.scoreCntMap = json.decode(response.soreCntMapString)
- self.roomInfo.tableGroupCards = response.tableGroupCards
-
-
- -- 桌子上其他玩家的信息
- for k,v in pairs(response.playerInfos) do
- self:setMemberInfo(v)
- -- if not self.roomInfo.memberList[v.nUserId] then
- -- self.roomInfo.memberList[v.nUserId] = {}
- -- end
- -- self.roomInfo.memberList[v.nUserId].nUserId = v.nUserId
- -- self.roomInfo.memberList[v.nUserId].nSeatId = v.nSeatId
- -- self.roomInfo.memberList[v.nUserId].nPlayerFlag = v.nPlayerFlag
- -- self.roomInfo.memberList[v.nUserId].userInfo = v.userInfo
- -- self.roomInfo.memberList[v.nUserId].nTurnScore = v.nTurnScore
- -- self.roomInfo.memberList[v.nUserId].nTotalMoney = v.nTotalMoney
- -- self.roomInfo.memberList[v.nUserId].nTingStatus = v.nTingStatus
- -- self.roomInfo.memberList[v.nUserId].gruoupCards = v.gruoupCards
- -- self.roomInfo.memberList[v.nUserId].outCards = v.outCards
- -- self.roomInfo.memberList[v.nUserId].handCards = v.handCards
- -- self.roomInfo.memberList[v.nUserId].nOnlineStatus = v.nOnlineStatus
- -- self.roomInfo.memberList[v.nUserId].nDisbandStatus = v.nDisbandStatus
-
-
- self.dismissInfo[v.nUserId] = v.nDisbandStatus
- --这里只记录,暂时没用到。可能战绩回放的时候是需要用的
- -- local cardData = self:serverCardToMyCard(v.handCard)
- -- self.roomInfo.memberList[v.nUserId].cardList = {}
- -- self.roomInfo.memberList[v.nUserId].cardList = cardData
- end
-
- --结算信息
- for k,v in pairs(response.resultInfos) do
- --番数
- self.roomInfo.memberList[v.nUserId].fanshu=v.fanshu
- --玩家本局输赢情况 0不胡不输 1胡,2点炮或者输
- self.roomInfo.memberList[v.nUserId].result=v.result
- -- 胡牌牌类型-7对胡、平胡,0为输或者不胡不输
- self.roomInfo.memberList[v.nUserId].huType=v.huType
- end
-
- self:addExtendData(response)
-
- --[[local extInfo = json.decode(response.extJson or "")
- local uid = self:getMyUserId()
- if extInfo and type(extInfo) == 'table' and extInfo[tostring(uid)] then
- local myInfo = extInfo[tostring(uid)]
- --self.roomInfo.hosting = myInfo.hosted or 0--托管状态
- self.roomInfo.quickStartInfo = extInfo.faststart
- end--]]
-
- --更新自己的数据
- -- local myUserId = app.user.loginInfo.uid
- -- self.cards[myUserId] = self.roomInfo.memberList[myUserId].handCards
-
- print("self.cards[myUserId]:"..table.tostring(self.cards[myUserId]))
-
- self:updateGpsUserInfo(nil,false)
-
- -- 更新椅子号
- self:updateUserSeateShowId()
- local jsonInfo = json.decode(self.roomInfo.strGameInfo)
- -- 发送通知
- self:dispatchEvent({name = MJDefine.MJEvent.EnterRoomSuccess, gameId = app.gameId, gameType = jsonInfo.gamerule})
- end
-
- --更新额外数据 便于子游戏改写数据
- function Room:addExtendData()
-
- end
-
- function Room:setMemberInfo(v)
- if not self.roomInfo.memberList[v.nUserId] then
- self.roomInfo.memberList[v.nUserId] = {}
- end
- self.roomInfo.memberList[v.nUserId].nUserId = v.nUserId
- self.roomInfo.memberList[v.nUserId].nSeatId = v.nSeatId
- self.roomInfo.memberList[v.nUserId].nPlayerFlag = v.nPlayerFlag
- self.roomInfo.memberList[v.nUserId].nDisbandStatus = v.nDisbandStatus
- self.roomInfo.memberList[v.nUserId].nOnlineStatus = v.nOnlineStatus
- self.roomInfo.memberList[v.nUserId].userInfo = v.userInfo
- self.roomInfo.memberList[v.nUserId].nTurnScore = v.nTurnScore
- self.roomInfo.memberList[v.nUserId].nTotalMoney = v.nTotalMoney
-
- self.roomInfo.memberList[v.nUserId].nTingStatus = v.nTingStatus
- self.roomInfo.memberList[v.nUserId].gruoupCards = v.gruoupCards
- self.roomInfo.memberList[v.nUserId].handCards = v.handCards
- self.roomInfo.memberList[v.nUserId].outCards = v.outCards
-
-
- if self.roomInfo.tableGroupCards then
- for i,k in pairs(self.roomInfo.tableGroupCards) do
- if v.nUserId == k.nUserId then
- self.roomInfo.memberList[v.nUserId].gruoupCards = k.operates
- end
- end
- else
- self.roomInfo.memberList[v.nUserId].gruoupCards = v.gruoupCards
- end
- end
-
-
- -- 其他玩家是否掉线
- function Room:onOtherDroppedResponse(status, response)
- if not self.roomInfo then return end
- logD("User:onOtherDroppedResponse(), response = ", table.tostring(response))
- logD("30000000--runOtherDroppedResponse")
- local nUserId = response.nUserId
- local nOnlineStatus = response.nOnlineStatus
- if nOnlineStatus== MJDefine.PlayOnlineStatus.offline and self.roomInfo.memberList[nUserId] then
- self.roomInfo.memberList[nUserId].offlinetime = 0
- end
- self:dispatchEvent({name = MJDefine.MJEvent.OtherDroppedResponse , response = response});
- end
-
- --如果多家可以操作,先操作的会收到通知要等待其他人
- -- function Room:onOperationFirst(status,response)
- -- logD("-------------------- 如果多家可以操作,先操作的会收到通知要等待其他人 ------------------------")
- -- if not self.roomInfo then
- -- print("容错处理")
- -- return
- -- end
- -- self:dispatchEvent({name = "onOperationFirst",response = response})
- -- end
-
- --操作错误
- function Room:onOperationError(status)
- logD("-------------------- onOperationError ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
- showTooltip("操作发生了错误...")
- --错误的时候如何处理
- self:dispatchEvent({name = "onOperationError"})
- end
-
- --操作成功
-
- --[[
- 说明:用户自己收到操作结果时, 要判断操作者他是否要出牌,若要出牌,则需提示出牌
- 若不用出牌,客户端无需处理, server会广播下家抓牌
- ]]
- function Room:onOperationCodeSuccess(status,response)
- logD("-------------------- 操作成功 ------------------------")
- if not self.roomInfo then
- print("容错处理")
- return
- end
- logD("Room:onOperationCodeSuccess(), response = ", table.tostring(response))
-
-
- self:dispatchEvent({name = MJDefine.MJEvent.OperationCodeSuccess ,response = response});
- end
-
- -- 服务器下发玩家的准备状态
- -- function Room:onUserReadyResponse(status, response)
- -- print("Room:onUserReadyResponse(), ", table.tostring(response))
- -- if not self.roomInfo then
- -- print("self.roomInfo no exist,容错处理!")
- -- return
- -- end
- -- local nUserId = response.nUserId
-
- -- local memberInfo = self.roomInfo.memberList[nUserId]
-
- -- --标记准备了
- -- if memberInfo then
- -- memberInfo.nPlayerFlag = 1
- -- end
-
- -- self:dispatchEvent({name = "onUserReadyResponse"});
- -- end
-
- -- 通知服务器玩家GPS数据发生变化
- -- function Room:onGpsChangeRequest()
- -- print("Room:onUserInfoChangeRequest()")
-
- -- local request = StringPacket:new()
- -- request.stringValue = app.user.userInfo or ""
-
- -- logD("Room:onGpsChangeRequest()", table.tostring(request))
- -- self:sendResponse{cmd = RoomCmd.GAME_COMMAND_CLIENT_CHANGE_USERINFO , sender = request};
-
- -- end
-
- -- -- 服务器下发玩家GPS数据发生变化
- -- function Room:onGpsChangeResponse(status, response)
- -- print("Room:onGpsChangeResponse()", table.tostring(response))
-
-
- -- --server收到0x8060协议后,广播当前桌子上所有用户
- -- ServerChangeUserInfo = defClass("ServerChangeUserInfo"
- -- --更新信息的用户uid
- -- , defVar("uid", VT_Int, -1)
- -- --用户信息
- -- , defVar("userInfo", VT_String, "")
- -- --保留字段,暂不使用
- -- , defVar("reserved", VT_String, "")
- -- )
-
-
- -- print("Room:onGpsChangeResponse()", table.tostring(response))
-
- -- local nUserId = response.uid
- -- local memberInfo = self.roomInfo.memberList[nUserId]
- -- if memberInfo then
- -- memberInfo.userInfo = response.userInfo
- -- end
-
- -- self:dispatchEvent({name = MJDefine.MJEvent.GpsChangeResponse , nUserId = nUserId});
- -- end
-
-
- -- 更新托管倒计时
- function Room:onUpdateDirectionTime( status, response )
- self:dispatchEvent({name = MJDefine.MJEvent.UpdateDirectionTime ,response = response})
- end
-
- -- 游戏快速开始,更新玩家座位号
- function Room:onFastStartSucc( status, response )
- self.roomInfo.nMaxPlayCount = #response.pList
- local gameInfo = json.decode(self.roomInfo.strGameInfo)
- gameInfo.playnum = self.roomInfo.nMaxPlayCount
- self.roomInfo.strGameInfo = json.encode(gameInfo)
- for _,v in pairs(response.pList) do
- self.roomInfo.memberList[v.nUserId].nSeatId = v.nSeatId
- end
- -- 更新椅子号
- self.seatShowList = {}
- self:updateUserSeateShowId()
- self:dispatchEvent({name = MJDefine.MJEvent.FastStartSucc ,response = response})
- end
-
- -- 快速开始操作广播 0x8201
- function Room:onBroadcastFastRequest( status, response )
- if not self.roomInfo then return end
- for _,v in pairs(response.pList) do
- self.roomInfo.memberList[v.nUserId].nStatus = v.nStatus
- end
- self.roomInfo.timeOut = response.timeOut
- self:dispatchEvent({name = MJDefine.MJEvent.BraodcastFastStart ,response = response})
- end
-
- -- 快速开始请求失败
- function Room:onUserRequestFastError( status, response )--快速开始请求错误提示错误
- local errTxt ={
- [1] = "人数不够",
- [2] = "其他人已请求",
- [3] = "房间人数已满",
- [4] = "非法操作"
- }
- local txt = errTxt[response.result]
- if txt then
- showTooltip(txt)
- end
- end
-
- -- 托管
- function Room:onHostingRequest( status, response )
- -- 是否托管
- if response.nUserId == self:getMyUserId() then
- self.roomInfo.hosting = response.status
- end
- self:dispatchEvent({name = MJDefine.MJEvent.HostingRequest, response = response});
- end
-
- -- 收到服务器下发PASS操作
- function Room:onUserPassRequest( status, response )
- self:dispatchEvent({name = MJDefine.MJEvent.USER_PASS ,response = response});
- end
-
- function Room:ctor(net)
- Room.super.ctor(self , net);
-
- -- GPS信息发生变化的时候主动给服务器发消息
- -- app:addEventListener( MJDefine.MJEvent.UpdateLoctionSuccessed , handler(self, self.onGpsChangeRequest))
-
- --发送
- -- 请求准备
- self:defMsgFunc{name = MJDefine.MJEvent.CallReadyRequest , cmd = RoomCmd.GAME_COMMAND_USER_READY};
- -- 离开房间
- self:defMsgFunc{name = MJDefine.MJEvent.CallLeaveRequest , cmd = RoomCmd.GAME_COMMAND_USER_LEAVE};
- -- 玩家请求解散房间,获取其他玩家回复解散房间
- self:defMsgFunc{name = MJDefine.MJEvent.DismissRoomRequest, cmd = RoomCmd.GAME_COMMAND_DISBAND_GAME, sender = MJMessage.DismissRequest};
-
- --GAME
- -- --发送操作码
- self:defMsgFunc{name = MJDefine.MJEvent.Operate , cmd = RoomCmd.GAME_COMMAND_SEND_CODE_RESPONSE, sender = MJMessage.OperateCard};
- -- --发送出牌
- self:defMsgFunc{name = MJDefine.MJEvent.OutCard,cmd = RoomCmd.GAME_COMMAND_OUT_CARD,sender = MJMessage.Card};
-
- -- --发送听牌
- self:defMsgFunc{name = MJDefine.MJEvent.Ting ,cmd = RoomCmd.GAME_COMMAND_TINGCARD} --,sender = MJMessage.RequestTingCard
- -- --发送弃胡
- -- self:defMsgFunc{name = "RequestQiHu",cmd = RoomCmd.GAME_COMMAND_QiHu,sender = SendQiHu};
-
- -- --接收
- -- -- 玩家进入桌子成功
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_LOGIN_GAME_SUCCESS, reader = MJMessage.SitDownSuccessResponse, func = handler(self , self.onSitDownSuccessResponse)};
- -- -- 玩家进入桌子失败
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_LOGIN_GAME_ERR, reader = MJMessage.SitDownFailedResponse, func = handler(self , self.onSitDownFailedResponse)};
- -- -- 玩家收到解散房间的请求
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_DISBAND_GAME, reader = MJMessage.DismissResponse, func = handler(self , self.onDismissResponse)};
- -- -- 收到玩家申请解散房间
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_DISBAND_GAME, reader = MJMessage.DismissResult, func = handler(self , self.onUserDismissResultResponse)};
- -- -- 其他玩家退出房间
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_USER_LOGOUT, reader = MJMessage.OtherLogoutResponse, func = handler(self , self.onOtherLogoutResponse)};
- -- -- 收到服务器下发的玩家准备状态
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_USER_READY, reader = MJMessage.UserId, func = handler(self , self.onUserReadyResponse)};
- -- -- 其他玩家进入桌子
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_USER_LOGIN, reader = MJMessage.OtherSitDownResponse, func = handler(self , self.onOtherSitDownResponse)};
- -- -- 用户退出
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_LOGOUT_GAME_SUCCESS, reader = MJMessage.UserExitResponse, func = handler(self , self.onUserExitResponse)};
-
- -- -- 游戏正式开始
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_GAME_START, reader = MJMessage.GameStartResponse, func = handler(self , self.onGameStartResponse)};
- -- --发牌
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_SENDCARD_RESPONSE, reader = MJMessage.GameSendCardResponse,func = handler(self , self.onGameSendCardResponse)};
-
- -- --广播桌子上所有玩家庄家起手操作
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BAKER_OUTCARD_RESPONSE, reader = MJMessage.BankerOutCard,func = handler(self , self.onBankerOutCard)};
-
- -- --若玩家操作不对,如operateCode值不对等,通过协议0x810d通知客户端操作错误,此协议暂定无参数
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_OPERATION_CODE_ERROR,func = handler(self,self.onOperationError)}
- -- --玩家操作成功, 则广播通知桌子上其他玩家操作结果,协议0x810b
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_OPERATION_CODE_SUCCESS,reader = MJMessage.OperationCodeSuccess,func = handler(self,self.onOperationCodeSuccess)}
- -- --抢杠胡
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_QIANG_GANG_HU,reader = MJMessage.QiangGangHu,func = handler(self,self.onQiangGangHu)}
- -- 弃牌
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_QI_PAI,reader = MJMessage.QiPai,func = handler(self,self.onQiPai)}
- --出牌错误
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_OUT_CARD_ERROR,reader = MJMessage.OutCardError,func = handler(self,self.onOutCardError)}
-
- --指示出牌
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_TURN_OUT_CARD,func = handler(self,self.onTurnOutCard)} --reader = MJMessage.OutCardError,
-
- --出牌成功
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_OUT_CARD_SUCCESS,reader = MJMessage.OutCardSuccess,func = handler(self,self.onOutCardSuccess)}
-
- --单局结算
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_GAME_XIAO_JU, reader = MJMessage.GameXiaoJuResponse, func = handler(self , self.onGameXiaoJuResponse)};
- -- --总结算
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_GAME_DA_JU, reader = MJMessage.GameDaJuResponse, func = handler(self , self.onGameDaJuResponse)};
-
-
- -- --听牌状态
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_TING, reader = MJMessage.TingCardStatus, func = handler(self , self.onTingCardStatus)};
-
- -- --听牌结果
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_RESPONSE_TINGCARD, reader = MJMessage.TingCardResult, func = handler(self , self.onTingCardResult)};
-
- --推送听
- --self:defPushMsg{cmd = RoomCmd.GAME_PUSH_TING, reader = MJMessage.Tings, func = handler(self , self.pushTing)};
-
- --断线重连
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_GAME_RECONNECTION,reader = MJMessage.GameReconnection,func = handler(self,self.onGameReconnection)}
- -- 其他玩家掉线
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROADCAST_USER_DROPPED, reader = MJMessage.OtherDroppedResponse, func = handler(self , self.onOtherDroppedResponse)};
-
- --gps消息
- -- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_SERVER_CHANGE_USERINFO, reader = MJMessage.ServerChangeUserInfo, func = handler(self , self.onGpsChangeResponse)}
-
-
- -- 客户端发起快速请求
- self:defMsgFunc{name = MJDefine.MJEvent.RequestFastsStart, cmd = RoomCmd.GAME_COMMAND_FAST_START_GAME, sender = MJMessage.FastStartRequest}
- -- 快速开始请求返回(失败)
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_FAST_START_ERROR, reader = MJMessage.FastStartRequestError, func = handler(self, self.onUserRequestFastError)}
- -- 快速开始广播请求 0x8201
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROAD_FAST_START_GAME, reader = MJMessage.FastStartStatus, func = handler(self, self.onBroadcastFastRequest)}
- -- 快速开始成功 0x8203
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_BROAD_QUICKLY_START, reader = MJMessage.UpdateSeatIds, func = handler(self, self.onFastStartSucc)}
-
- -- -- 首次听牌,提示托管
- -- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_TING_HOSTED, reader = MJMessage.FirstTingTips, func = handler(self, self.onFirstTingTips)}
- -- user pass
- self:defPushMsg{cmd = RoomCmd.GAME_COMMAND_USER_PASS, reader = MJMessage.UserPass, func = handler(self,self.onUserPassRequest)}
- end
-
- --辅助查找
- -- 通过玩家逻辑椅子号找到玩家ID
- function Room:getUserIdBySeatId(seatId)
- return self.seatList[seatId]
- end
-
- -- 通过玩家视图椅子号找到玩家ID
- function Room:getUserIdByViewId(seatShowId)
- return self.seatShowList[seatShowId]
- end
-
- -- 通过玩家ID获取玩家展示的座位号
- function Room:getViewIdByUserId(nUserId)
- return self.userList[nUserId];
- end
-
- -- 通过玩家逻辑椅子号找到视图椅子号
- function Room:getViewIdBySeatId(nSeatId)
- local userid = self:getUserIdBySeatId(nSeatId)
- return self:getViewIdByUserId(userid)
- end
-
- -- 通过玩家视图椅子号找到逻辑椅子号
- function Room:getSeatIdByViewId(nViewId)
- local userid = self:getUserIdByViewId(nViewId)
- for seatId,nUserId in pairs(self.seatList) do
- if userid == nUserId then
- return seatId
- end
- end
- end
-
- -- return table of userInfo, not string
- function Room:getUserInfo(nUserId)
- if self.roomInfo.memberList[nUserId] then
- return json.decode(self.roomInfo.memberList[nUserId].userInfo)
- else
- return nil
- end
- end
-
- function Room:getUserInfoByViewId(nViewId)
- local userid = self:getUserIdByViewId(nViewId)
- return self:getUserInfo(userid)
- end
-
- function Room:getMyUserId()
- if self:isInMemberList() then
- return app.user.loginInfo.uid--self:getUserIdByViewId(MJDefine.MyViewId)
- else
- for nUserId,v in pairs(self.roomInfo.memberList) do
- return nUserId
- end
- -- return self:getUserIdBySeatId(0)
- end
- end
-
- function Room:isInMemberList()
- if self.roomInfo then
- for nUserId,v in pairs (self.roomInfo.memberList) do
- if app.user.loginInfo.uid==nUserId then
- return true
- end
- end
- end
- return false
- end
-
- function Room:resetTings()
- self.roomInfo.tings={}
- end
-
- function Room:isTingStatus()
- local myUserId=app.user.loginInfo.uid
- local memberList=self.roomInfo.memberList
- if memberList[myUserId] then
- local nTingStatus=memberList[myUserId].nTingStatus
- if nTingStatus == MJDefine.MJTingStatus.Ting then
- return true
- -- self:setChaTingCardViewVisible(true)
- -- else
- -- self:setChaTingCardViewVisible(false)
- end
- end
- return false
- end
-
- function Room:getWinViewIds()
- local viewIds={}
- for k,v in pairs(self.roomInfo.memberList) do
- local viewId = self:getViewIdByUserId(v.nUserId)
- if v.result==MJDefine.MJGameResultType.Win then
- table.insert(viewIds,viewId)
- end
- end
- return viewIds
- end
-
-
- function Room:requestQuickStart(opType)
- --1: 表示发起解散 2:同意解散 3:不同意解散
- local request = MJMessage.FastStartRequest:new()
- request.operateType = opType
- self:sendResponse{cmd = RoomCmd.GAME_COMMAND_FAST_START_GAME , sender = request};
- end
-
- --更新gps用户数据
- --需要检测的ID 没有则检测所有人的距离
- --isOpenView 危险距离是否主动弹出提示
- function Room:updateGpsUserInfo(userId,isOpenView)
- if self.roomInfo and self.roomInfo.memberList then
- local gameStartCount = self.roomInfo.nGameStartCount or 0
- local isGameStart = gameStartCount>0
- --如果是游戏开始后收到消息则不处理
- local userInfoList = {}
- for nUserId, memberInfo in pairs(self.roomInfo.memberList) do
- local nSeatId = memberInfo.nSeatId
- local userInfo = memberInfo.userInfo
- if userInfo then
- local userInfo2 = json.decode(userInfo)
- if userInfo2 then
- userInfoList[nUserId] = {nSeatId = nSeatId, userInfo = userInfo}
- end
- end
- end
-
- if isGameStart or (not self:isAutoPopupGPS()) then
- isOpenView = false
- end
-
- self:dispatchEvent({
- name = GAME_EVENT.GPS_UPDATE_USER_INFO,
- userId=userId,
- userInfoList = userInfoList,
- isOpenView = isOpenView or false,
- isGameStart = isGameStart,
- -- maxPlayerNum = self.roomInfo.nMaxPlayCount,
- })
- end
- end
-
- function Room:isAutoPopupGPS()
- return true
- end
-
- function Room:checkGpsIsNew()
- if self:isAutoPopupGPS() then
- return Room.super.checkGpsIsNew(self)
- else
- app.room:requestGpsChange()
- return false
- end
- end
-
- return Room;
|