local RoomView_53 = class("RoomView_53", cc.UIView) local Functions = require("pk_nanchongdoudizhu.luaScript.Functions_53") local defs = require("pk_nanchongdoudizhu.luaScript.Def_53") local Messages = require("pk_nanchongdoudizhu.luaScript.Protocol.ProtocolMessage_53") local PokerUtil = require('pk_nanchongdoudizhu.luaScript.Views.Room.newPokerUtil') local DDZ_New_Effect_Helper = require("pk_nanchongdoudizhu.luaScript.Views.Room.DDZNewEffectHelper"):new() local Card_Move_Up_Down_Time = 0.1 -- 手牌抬起下放动画时间 local Card_Out_Down_Time = 0.15 -- 出牌下放动画时间 local Card_Out_Down_Offset_Y = -5 -- 出牌下放位置 function RoomView_53:ctor() RoomView_53.super.ctor(self) self._pokerUtil = nil self._isCanClickBg = true end function RoomView_53:initData() --事件队列 self.callbackQueue = {} --手牌间距(越大越密集,越小越稀疏) self.handCardDif = 110 --默认闹钟时间 self.clockTime = 15 --上家出的牌数据 self.lastData = {} self:setLastData() end function RoomView_53:onEnter() RoomView_53.super.onEnter(self) --ui load local ui = loadUI("pk_nanchongdoudizhu/res/ui/ui_fangjian/doudizhu_ui_fangjian.ui") self:addChild(ui) self.ui = ui -- 添加合图缓存 self:addloadSpriteFrame() -- 添加扑克牌型提示文件 self:initPokerUtil() --初始化属性数据 self:initData() --初始化所有的玩家节点 self:initPlayerNodes() --初始化工具层 self:initToolLayer() -- 初始化GPS组件 self:initGpsComponent() -- 初始化电量和信号 self:initSingleComponent() -- 初始化扑克牌 self:initPoker() -- 初始化顶部栏扑克信息 self:initTopData() --监听事件 self:bindAllEvent() --显示桌面信息 self:initDeskInfo() --初始游戏中按钮 self:initGameButtons() --初始化玩法 self:initGameRule() --播放音乐 -- Functions.playMusic() self:onChangeBgm() --先收到8009再初始化的房间(房间还未监听8009事件),所以这里调用重连 self:onGameReconnection() --恢复协议 self:startGame() --测试 --self.weaveCardList = self:getTip(self.handCards["" .. self:getMeViewId()]) end function RoomView_53:addloadSpriteFrame() loadSpriteFrameFile("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cards/doudizhu_pokerCards.plist") -- 动画相关 loadSpriteFrameFile("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/zy_ddz_shunzi/zy_ddz_CardFX_ShunZi_Sheet1.plist") loadSpriteFrameFile("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/zy_ddz_shunzi/zy_ddz_CardFX_ShunZi_Sheet2.plist") loadSpriteFrameFile("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/zy_ddz_bomb/zy_ddz_CardFX_ZhaDan_Sheet1.plist") loadSpriteFrameFile("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/zy_ddz_liandui/zy_ddz_CardFX_LianDui_Sprite_1.plist") loadSpriteFrameFile("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_player/zy_game_jingbao/ddz_Ani_BJ.plist") loadSpriteFrameFile('pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/zy_ddz_kingbomb/doudizhu_Ani_KingBomb.plist') end function RoomView_53:initPokerUtil() self._pokerUtil = PokerUtil:new() end function RoomView_53:initPoker() local changePoker = tonumber(loadUserInfo("ddz_setting_poker")) or defs.Default_Poker_Choose self:onNormalChangePoker({idx=changePoker}) end function RoomView_53:initTopData() local dipaiCount = Functions.getRuleIncludeLzWanFa() and 4 or 3 if dipaiCount == 3 then self.ui.Items.Layout_Card_4:setVisible(false) self.ui.Items.Layout_Top_Info:requestDoLayout() self.ui.Items.Layout_Top_Info:doLayout() end end function RoomView_53:onClickButtonDismiss( sender ) playBtnEffect() local function onClickOk() app.room:requestDismissRoom(1)--发起解散 end local function onClickCancel() end showConfirmDialog("确定要申请解散房间吗?", onClickOk, onClickCancel) end function RoomView_53:hideXiangQing(hideAction) self.xiangQingView.Items.Layout_XiangQing:setVisible(false) self.xiangQingView.Items.Layout_XQ_content:stopAllActions() self.xiangQingView.Items.ListView_Xq:setVisible(false) if hideAction == true then self.xiangQingView.Items.Layout_XQ_content:setPosition(self.xiangQingViewHidePos) self.xiangQingView.Items.Button_XiangQing:setVisible(true) else self.xiangQingView.Items.Layout_XQ_content:runAction( cc.Sequence:create( cc.MoveTo:create(0.35 , self.xiangQingViewHidePos), cc.CallFunc:create(function() self.xiangQingView.Items.Button_XiangQing:setVisible(true) end) ) ) end end function RoomView_53:initGameRule() self.xiangQingView = loadUI("pk_nanchongdoudizhu/res/ui/ui_fangjian/doudizhu_ui_wanfa.ui") self.ui.Items.Layout_RuleView:addChild(self.xiangQingView) self.xiangQingView.Items.Button_XiangQing:setVisible(false) self.xiangQingView.Items.Layout_XiangQing:setVisible(true) local offsetX = 20 self.xiangQingView.Items.Button_XiangQing:setPositionX(self.xiangQingView.Items.Button_XiangQing:getPositionX() + offsetX) self.xiangQingView.Items.Layout_XQ_content:setPositionX(self.xiangQingView.Items.Layout_XQ_content:getPositionX() + offsetX) local size = self.xiangQingView.Items.Layout_XQ_content:getContentSize() self.xiangQingViewShowPos = self.xiangQingView.Items.Layout_XQ_content:getPosition() self.xiangQingViewHidePos = cc.vec3(self.xiangQingViewShowPos.x,self.xiangQingViewShowPos.y + size.height,self.xiangQingViewShowPos.z) self.xiangQingView.Items.Button_XiangQing_Back:registerClick(handler(self , self.hideXiangQing)) self.xiangQingView.Items.Layout_XiangQing:registerClick(handler(self , self.hideXiangQing)) self.xiangQingView.Items.Layout_XQ_content:registerClick(handler(self , self.hideXiangQing)) self.xiangQingView.Items.Button_XiangQing:registerClick(function() playBtnEffect() self.xiangQingView.Items.Button_XiangQing:setVisible(false) self.xiangQingView.Items.Layout_XQ_content:stopAllActions() self.xiangQingView.Items.Layout_XQ_content:runAction( cc.Sequence:create( cc.MoveTo:create(0.35 , self.xiangQingViewShowPos), cc.CallFunc:create(function() self.xiangQingView.Items.ListView_Xq:setVisible(true) self.xiangQingView.Items.Layout_XiangQing:setVisible(true) end) ) ) end) self.xiangQingView.Items.ListView_Xq:getVBar():setVisible(false) local roomInfo = app.room.roomInfo local ruleAll = Functions.getRuleStr() local wanfaList = string.split(ruleAll," ") local listviewSize = self.xiangQingView.Items.ListView_Xq:getContentSize() for i,v in pairs(wanfaList) do if v ~= "" and v ~= " " then local layout=cc.Layout:create() local wanfaText = cc.Text:createNode() wanfaText:setDefaults() local config = wanfaText:getFontConfig() config.fontSize = 24 config.texColor = cc.c4b(255,192,101,255) wanfaText:setFontConfig(config) layout:setSize(cc.size(listviewSize.width,35)) layout:addChild(wanfaText) wanfaText:setPosition(cc.p(listviewSize.width/2,15)) wanfaText:setString(v) self.xiangQingView.Items.ListView_Xq:pushBackCustomItem(layout) end end if app.room.roomInfo.nGameStartCount > 0 then self:hideXiangQing(true) else self:runAction(cc.Sequence:create( cc.DelayTime:create(2), cc.CallFunc:create(self.hideXiangQing) )) end end function RoomView_53:defaultState() --队列初始化 self.callbackQueue = {} self.callbackRunning = false --刷新按钮 self:updateButtons() --刷新用户信息 self:refreshPlayer(true) --隐藏地主底牌、炸弹等信息 self:setBanderCardsVisible(false) --是否开局 if app.room.roomInfo.nGameStartCount > 0 then --隐藏加倍界面 self:setAskBeiVisible(false) --隐藏叫分界面 self:setAskLoardVisible(false) --隐藏玩家出牌操作信息 self:hideAllOutCardOperation() --隐藏界面 for _,v in pairs(app.room.roomInfo.memberList) do local viewId = app.room:getViewIdByUserId(v.nUserId) --隐藏桌面加倍标识 self.PlayerView:setTipsVisible("tips_jiabei", false, viewId) --隐藏桌面叫分标识 self.PlayerView:setTipsVisible("tips_jiaofen", false, viewId) --隐藏手牌 local handLayout = self.ui.Items["Layout_Hand_" .. viewId] if handLayout then handLayout:removeAllChildren() if self.handCards then local handCards = self.handCards["" .. viewId] if handCards then self.handCards["" .. viewId] = nil end end end end end end function RoomView_53:onUserExitResponseRoom(data) local function runUserExitResponseRoom(onEnd) print('runUserExitResponseRoom..') local response = data.response --房间号 local roomid = app.room.roomInfo.nShowTableId app.room.roomInfo.tableOverFlag = response.tableOverFlag -- --长时间未开始强制退出,否则不退出 -- if app.room.roomInfo.tableOverFlag ~= defs.TABLE_OVER_FLAG.TABLE_OVER_LONG_TIME_NO_START and app.room.roomInfo.nGameStartCount ~= 0 then -- response.logoutFlag = 0 -- else -- response.logoutFlag = 1 -- end -- --如果是自己点离开必须退出 -- if app.room.roomInfo.bQuitRoom then -- response.logoutFlag = 1 -- end -- --正常结束不提示,其他都要提示 -- if app.room.roomInfo.tableOverFlag >= defs.TABLE_OVER_FLAG.TABLE_OVER_GROUP_DISBAND then -- showTooltip(defs.TABLE_OVER_FLAG_TEXT[app.room.roomInfo.tableOverFlag]) -- end print('app.room.roomInfo.bQuitRoom->', app.room.roomInfo.bQuitRoom) print('app.room.roomInfo.tableOverFlag', app.room.roomInfo.tableOverFlag) -- 0: 不退出, 1: 退出 if response.logoutFlag == 1 then app:gotoView(import("luaScript.Views.Main.MainView"):new(GAME_IDS.NanChongDouDiZhu, roomid)) end app.room:dispatchEvent({name = "onUserExitResponseHall"}) if onEnd then onEnd() end end self:addCallBack(runUserExitResponseRoom) end -- function RoomView_53:showProp(data) -- local response = data.response -- logE("RoomView_53:showProp response = "..table.tostring(response)) -- --ui表现开始 -- local uidStarId = response.uidStarId -- local uidEndId = response.uidEndId -- local propId = response.propId -- local isQunFa = response.isQunFa -- local beginViewId = app.room:getViewIdByUserId(uidStarId) -- local endViewId = app.room:getViewIdByUserId(uidEndId) -- if not self.allNodes[beginViewId] or not self.allNodes[endViewId] -- or not self.allNodes[endViewId].head or not self.allNodes[beginViewId].head then -- logE("场景还没初始化完成就收到道具消息果断return!") -- return -- end -- --播放动画 -- if isQunFa == 1 then -- local onLineList = app.room.roomInfo.memberList -- for nUserId,v in pairs(onLineList) do -- local endViewId = app.room:getViewIdByUserId(nUserId) -- if endViewId ~= beginViewId then -- self.PropAniManager:playAnimation(self.allNodes[beginViewId].head,self.allNodes[endViewId].head,propId) -- end -- end -- else -- self.PropAniManager:playAnimation(self.allNodes[beginViewId].head,self.allNodes[endViewId].head,propId) -- end -- end function RoomView_53:initPlayerNodes() self.PlayerView = import("pk_nanchongdoudizhu.luaScript.Views.Room.RoomPlayerView_53"):new() self.ui.Items.Layout_Player:addChild(self.PlayerView) end function RoomView_53:refreshPlayer(bVisible, viewId, playerInfo) if bVisible then self.PlayerView:updatePlayer(playerInfo, viewId) else self.PlayerView:hidePlayer(viewId) end local uids = {} for k,v in pairs(app.room.roomInfo.memberList) do uids[v.nUserId] = true end -- if self.messageView then -- self.messageView:setPlayerUids(uids) -- end end function RoomView_53:initToolLayer() --加载工具层 self.toolView = import("pk_nanchongdoudizhu.luaScript.Views.Room.RoomToolView_53"):new() self.ui.Items.Layout_Tool:addChild(self.toolView) --ChatView -- self.messageView = require("luaScript.Views.Room.ChatView"):new({chatList = defs.GAME_CHAT_TXT}, self.PlayerView:getChatViewPos(), true) -- self.toolView.ui.Items.Layout_ChatView:addChild(self.messageView) --设置语言 -- self.messageView:setLanguage(Functions.getCurLanguage() == defs.LANGUAGE_TYPE.PU_TONG_HUA) --互动表情,语音 -- self.messageView:setBtnFace(defs.FACE_POS) -- self.messageView:setBtnVoice(defs.VOICE_POS) -- self.messageView.ui.Items.Button_Face:loadTextureNormal("res/ui/zy_fangjian/RoomMenu/room_menu_3/room_menu3_room_btn_kjy.png") -- self.messageView.ui.Items.Button_Face:loadTexturePressed("res/ui/zy_fangjian/RoomMenu/room_menu_3/room_menu3_room_btn_kjy.png") -- self.messageView.ui.Items.Button_Face:loadTextureDisabled("res/ui/zy_fangjian/RoomMenu/room_menu_3/room_menu3_room_btn_kjy.png") -- self.messageView.ui.Items.Button_Voice:loadTextureNormal("res/ui/zy_fangjian/RoomMenu/room_menu_3/room_menu3_room_btn_yuyin.png") -- self.messageView.ui.Items.Button_Voice:loadTexturePressed("res/ui/zy_fangjian/RoomMenu/room_menu_3/room_menu3_room_btn_yuyin.png") -- self.messageView.ui.Items.Button_Voice:loadTextureDisabled("res/ui/zy_fangjian/RoomMenu/room_menu_3/room_menu3_room_btn_yuyin.png") --是否屏蔽互动表情 -- self.messageView:setPropEnabled((tonumber(loadUserInfo("HuDongBiaoQingKG" .. app.gameId)) or 1) == 1)--0关 1开 --是否屏蔽屏蔽语音 -- self.messageView:setVoiceEnabled((tonumber(loadUserInfo("PingBiYuYinKG" .. app.gameId)) or 1) == 1)--0关 1开 --道具播放管理器 -- self.PropAniManager = import("luaScript.Tools.PropAniPlayer"):new(self.ui.Items.Layout_Touch) if Functions.getRuleIncludeNotChatPlayWanFa() then -- self.messageView:hideBtns() end end function RoomView_53:initGpsComponent() local versionCode = getAppVersionCode() versionCode = tonumber(versionCode) or 0 logD("RoomView_53:initGpsComponent() versionCode = ", versionCode) if isReviewVersion() then self.toolView.ui.Items.Button_GPS:registerClick(handler(self, self.showGpsView)) self.toolView.ui.Items.Button_GPS:setVisible(false) return end -- 创建 gps 组件 self.gpsComponent = import("luaScript.Views.Room.RoomGpsComponent"):new() -- GPS 按钮 self.toolView.ui.Items.Button_GPS:registerClick(handler(self, self.showGpsView)) -- 我的GPS数据发生变化时检测是否需要通知服务器 self:bindEvent(app, "onGpsInoChanged", handler(self, self.checkMyGpsNeedUpdate)) -- 进入时检测一遍我的GPS数据是否需要更新 self:checkMyGpsNeedUpdate() end -- 初始化电量和信号 function RoomView_53:initSingleComponent() self.singleComponent = import("luaScript.Views.Room.RoomSinglePowerComponent"):new(self.ui.Items.ImageView_Single, self.ui.Items.LoadingBar_Power); end -- 注销电量、网络信号 function RoomView_53:deInitSingleComponent() if self.singleComponent then self.singleComponent:exit() end end function RoomView_53:bindAllEvent() --用户状态(包括准备,其他玩家进入或者离开通知,离线等) self:bindUserStatedMessage() --私人场消息(包括解散等) self:bindPrivateMessage() --游戏消息 self:bindGameMessage() --游戏场景消息 self:bindGameSceneMessage() --绑定更换桌布事件 self:bindEvent(app , "onChangeTable" , handler(self , self.onChangeTable)) --发送道具 -- self:bindEvent(app.room,"showProp" , handler(self , self.showProp)) --绑定更换背景音乐种类 self:bindEvent(app , "onChangeBgm" , handler(self , self.onChangeBgm)) --设置互动表情开关事件 self:bindEvent(app.room,"ontSetPropEnabled" , handler(self , self.ontSetPropEnabled)) --设置语音开关事件 self:bindEvent(app.room,"onSetVoiceEnabled" , handler(self , self.onSetVoiceEnabled)) -- 游戏设置里更换扑克 self:bindEvent(app.room, "ddzNormalEvent_changePoker" , handler(self , self.onNormalChangePoker)) -- 小结算内通知解散 self:bindEvent(app.room, 'onResultInformDisMiss', handler(self, self.onClickButtonDismiss)) end function RoomView_53:initDeskInfo() --设置房间号 self.ui.Items.Text_roomNum:setText("房间号: " .. app.room.roomInfo.nShowTableId) -- 更新当前局数 self:updateGameNums() --系统时间 if not app.room.roomInfo.isRecord then self.ui.Items.Text_systemTime:stopAllActions() self.ui.Items.Text_systemTime:runActions( cc.RepeatForever:create( cc.Sequence:create( cc.CallFunc:create(function() self.ui.Items.Text_systemTime:setText(string.format("%s", os.date("%H:%M:%S", os.time()))) end), cc.DelayTime:create(0.5) ) ) ) end --刷新桌面背景和Logo self:setTableImg(Functions.getDefaultBg()) end function RoomView_53:startGame() --起飞 app.net:onMsgResume() end function RoomView_53:updateGameNums() -- 更新当前局数 local roomInfo = app.room.roomInfo local curCount = roomInfo.nGameStartCount or 0 local str = string.format("%02d / %02d", curCount, roomInfo.nTotalGameNum) self.ui.Items.Text_JuShu:setText(str) end function RoomView_53:onExit() RoomView_53.super.onExit(self) self:deInitSingleComponent() app.room:dispatchEvent({name = "onGameOverResponse"}) stopBGMusic() self:cleanCache() -- jxtd 记得验证是否要删除 end -- 清理缓存,用于测试 function RoomView_53:cleanCache() local preload = package.loaded for k, v in pairs(package.loaded or {}) do local res1 = string.find( k, "pk_nanchongdoudizhu.luaScript") or 0 if res1 > 0 then package.loaded[k] = nil end end end -- 其他玩家坐下成功 function RoomView_53:onOtherSitDownResponse(data) local viewId = app.room:getViewIdByUserId(data.response.nUserId) self:checkGpsDistance(data.response.nUserId) self:refreshPlayer(true, viewId, app.room.roomInfo.memberList[data.response.nUserId]) self:updateButtons() if not tolua.isnull(self.quickStartView) then self.quickStartView:removeView() self.quickStartView = nil end end function RoomView_53:updateButtons() local nGameStartCount = app.room.roomInfo.nGameStartCount or 0 if nGameStartCount > 0 then -- 准备按钮 self.toolView:setReadyVisible(false) -- 是否显示邀请好友 self.toolView:setInviteVisible(false) -- 离开按钮 self.toolView:setLeaveEnabled(false) -- 解散按钮 self.toolView:setDissmissEnabled(true) else local myUserId = app.room:getMyUserId() -- 是否显示邀请好友 if isReviewVersion() then self.toolView:setInviteVisible(false) else self.toolView:setInviteVisible(table.nums(app.room.roomInfo.memberList) < app.room.roomInfo.nMaxPlayCount) end -- 准备按钮 local readyState = app.room.roomInfo.memberList[myUserId].nPlayerFlag or 0 self.toolView:setReadyVisible(readyState == 0) -- 离开按钮 self.toolView:setLeaveEnabled(true) -- 解散按钮 local nRoomOwnedUid = app.room.roomInfo.nRoomOwnedUid or 0 self.toolView:setDissmissEnabled(nRoomOwnedUid == app.room:getMyUserId() and (not app.club_php.clubID or (app.club_php.clubID and app.club_php.clubID == 0))) end end -- 因为updatebutton是在游戏开始才算,但是漂消息比游戏开始前还快 function RoomView_53:updateButtonInPiao() -- 准备按钮 self.toolView:setReadyVisible(false) -- 是否显示邀请好友 self.toolView:setInviteVisible(false) -- 离开按钮 self.toolView:setLeaveEnabled(false) -- 解散按钮 self.toolView:setDissmissEnabled(true) end function RoomView_53:onOtherDroppedResponse(data) if not data.response then return end self:setPlayerOffLine(data.response.nOnlineStatus == 0, app.room:getViewIdByUserId(data.response.nUserId)) end function RoomView_53:setPlayerOffLine(bVisible, viewId, times) --离线 self.PlayerView:setOffLineVisible(bVisible, viewId) --[[ if bVisible then local startTime = os.time() self.allNodes[viewId].offLine:stopAllActions() self.allNodes[viewId].offLine:runAction( cc.RepeatForever:create( cc.Sequence:create( cc.CallFunc:create(function() local endTime = os.time() local difTime = endTime - startTime + (times or 0) local timeStr = string.format("%02d : %02d", difTime / 60, difTime % 60) self.allNodes[viewId].offLineTime:setText(timeStr) end), cc.DelayTime:create(1.0) ) ) ) end --]] end function RoomView_53:onOtherLogoutResponse(data) self:refreshPlayer(false, data.response.viewId) self:updateButtons() end function RoomView_53:onUserReadyResponse(data) --自己准备 if app.room:getMyUserId() == data.response.nUserId then --重置桌面 self:defaultState() --更新按钮状态 self:updateButtons() end --显示准备 self.PlayerView:setReadyVisible(true, app.room:getViewIdByUserId(data.response.nUserId)) end --用户状态消息 function RoomView_53:bindUserStatedMessage() --默认状态 self:bindEvent(app.room , "defaultState", handler(self , self.defaultState)) -- 玩家准备 self:bindEvent(app.room , "onUserReadyResponse", handler(self , self.onUserReadyResponse)) -- 其他玩家进入房间 self:bindEvent(app.room , "onOtherSitDownResponse", handler(self , self.onOtherSitDownResponse)) -- 其他玩家退出房間 self:bindEvent(app.room , "onOtherLogoutResponse", handler(self , self.onOtherLogoutResponse)) -- 其他玩家掉线 self:bindEvent(app.room , "onOtherDroppedResponse", handler(self , self.onOtherDroppedResponse)) -- 用户T出 self:bindEvent(app.room , "onUserExitResponseRoom", handler(self , self.onUserExitResponseRoom)) -- 玩家的GPS信息发生变化 self:bindEvent(app.room , "onGpsChangeResponse", handler(self , self.onGpsChangeResponse)) end --私人场消息 function RoomView_53:bindPrivateMessage() -- 玩家收到解散房间的请求 self:bindEvent(app.room , "onDismissResponse", handler(self , self.onDismissResponse)) end --场景恢复 function RoomView_53:bindGameSceneMessage() app.hall:addEventListener("onEnterRoomSuccess", handler(self , self.onEnterRoomSuccess)) end function RoomView_53:onEnterRoomSuccess() if tolua.isnull(self.ui) then logE("self.is null") return end self:stopAllActions() self:onGameReconnection() self:startGame() end function RoomView_53:onGameReconnection() --默认状态 self:defaultState() --是否开局 if app.room.roomInfo.nGameStartCount > 0 then --恢复手牌 self:initHandCards(app.room.roomInfo.memberList[app.room:getMyUserId()].handCards, self:getMeViewId()) --显示头标记 self:showHeadTip('piao') -- 漂阶段 if app.room.roomInfo.nStatus == defs.GAME_STATUS.ASK_PIAO then for k,v in pairs(app.room.roomInfo.memberList) do if v.bAskPiao == 1 then -- 本轮操作过 if v.nPiaoState ~= defs.PIAO_STATE.PIAO_STATE_WAIT then self.PlayerView:setTipsVisible("tips_piao", true, app.room:getViewIdByUserId(v.nUserId), { piaoState = v.nPiaoState }) else self.PlayerView:setChoosePiaoVisible(true, app.room:getViewIdByUserId(v.nUserId)) end else -- 本轮没操作,或者是之前操作过的 if v.nPiaoState == defs.PIAO_STATE.PIAO_STATE_WAIT then self.PlayerView:setChoosePiaoVisible(true, app.room:getViewIdByUserId(v.nUserId)) end end end local myMemberInfo = app.room.roomInfo.memberList[app.room:getMyUserId()] if myMemberInfo.nPiaoState == defs.PIAO_STATE.PIAO_STATE_WAIT then self:setPiaoVisible(true) end -- 闷抓/闷倒/闷拉 阶段 elseif app.room.roomInfo.nStatus == defs.GAME_STATUS.MENZHUA then self.curViewId = app.room:getViewIdByUserId(app.room.roomInfo.currentUserId_Men) self.PlayerView:setClockVisibel(true, self.curViewId, app.room.roomInfo.currentLeftTime) -- 显示标记 for k,v in pairs(app.room.roomInfo.memberList) do if self.curViewId ~= app.room:getViewIdByUserId(v.nUserId)then if v.nMenZhuaState <= defs.MEN_STATE.MEN_STATE_ZHUAI then -- 闷抓 if v.nMenZhuaState ~= defs.MEN_STATE.MEN_STATE_WAIT then self.PlayerView:setTipsVisible("tips_menzhua", true, app.room:getViewIdByUserId(v.nUserId), { menzhua = v.nMenZhuaState }) end elseif v.nMenZhuaState <= defs.MEN_STATE.MEN_STATE_DAO then -- 闷拉 if v.nMenZhuaState ~= defs.MEN_STATE.MEN_STATE_DAO_WAIT then self.PlayerView:setTipsVisible("tips_mendao", true, app.room:getViewIdByUserId(v.nUserId), { mendao = v.nMenZhuaState }) end end end end -- 显示界面 if self.curViewId == self:getMeViewId() then local myMemberInfo = app.room.roomInfo.memberList[app.room:getMyUserId()] if myMemberInfo.nMenZhuaState == defs.MEN_STATE.MEN_STATE_WAIT then self:setMenZhuaVisible(true) elseif myMemberInfo.nMenZhuaState == defs.MEN_STATE.MEN_STATE_DAO_WAIT then self:setMenDaoVisible(true) elseif myMemberInfo.nMenLaState == defs.MEN_LA_STATE.MEN_STATE_LA_WAIT then self:setMenLaVisible(true) end end --叫地主阶段 elseif app.room.roomInfo.nStatus == defs.GAME_STATUS.ASK_LOARD then --当前操作位置 self.curViewId = app.room:getViewIdByUserId(app.room.roomInfo.currentUserId) --显示方位 self.PlayerView:setClockVisibel(true, self.curViewId, app.room.roomInfo.currentLeftTime) --显示叫分状态 for k,v in pairs(app.room.roomInfo.memberList) do if app.room.roomInfo.menZhuaUserId ~= v.nUserId then if v.bAskLoard == 1 then self.PlayerView:setTipsVisible("tips_jiaofen", true, app.room:getViewIdByUserId(v.nUserId), { askLoard = v.askLoard }) end end end --是否显示叫分 if self.curViewId == self:getMeViewId() then self:setAskLoardVisible(true, app.room.roomInfo.opType == 1) end --加倍阶段 倒/拉 elseif app.room.roomInfo.nStatus == defs.GAME_STATUS.ASK_BEI then self.curViewId = app.room:getViewIdByUserId(app.room.roomInfo.currentUserId) -- 显示闹钟 self.PlayerView:setClockVisibel(true, self.curViewId, app.room.roomInfo.currentLeftTime) --显示庄家 self.PlayerView:setBankerVisible(true, app.room:getViewIdByUserId(app.room.roomInfo.nBankerId)) --显示加倍状态 for k,v in pairs(app.room.roomInfo.memberList) do -- if v.nDaoState == defs.DAO_STATE.DAO_STATE_YES then -- self.PlayerView:setTipsVisible("tips_jiabei", true, app.room:getViewIdByUserId(v.nUserId), { askBei = v.nDaoState }) -- elseif v.nLaState == defs.DAO_STATE.LA_STATE_YES then -- self.PlayerView:setTipsVisible("tips_jiabei_la", true, app.room:getViewIdByUserId(v.nUserId), { askBei = v.nLaState }) -- end if self.curViewId ~= app.room:getViewIdByUserId(v.nUserId)then if v.nDaoState ~= defs.DAO_STATE.DAO_STATE_WAIT then self.PlayerView:setTipsVisible("tips_jiabei", true, app.room:getViewIdByUserId(v.nUserId), { askBei = v.nDaoState }) elseif v.nLaState ~= defs.DAO_STATE.LA_STATE_WAIT then self.PlayerView:setTipsVisible("tips_jiabei_la", true, app.room:getViewIdByUserId(v.nUserId), { askBei = v.nLaState }) end end end --是否显示加倍(倒or拉) if self.curViewId == self:getMeViewId() then local myMemberInfo = app.room.roomInfo.memberList[app.room:getMyUserId()] if myMemberInfo.nDaoState == defs.DAO_STATE.DAO_STATE_WAIT then self:setAskBeiVisible(true) elseif myMemberInfo.nLaState == defs.DAO_STATE.LA_STATE_WAIT then self:setLaVisible(true) end end --打牌阶段 elseif app.room.roomInfo.nStatus == defs.GAME_STATUS.PLAYING then --当前操作位置 self.curViewId = app.room:getViewIdByUserId(app.room.roomInfo.currentUserId_Men) --显示方位 self.PlayerView:setClockVisibel(true, self.curViewId, app.room.roomInfo.currentLeftTime) --显示庄家 self.PlayerView:setBankerVisible(true, app.room:getViewIdByUserId(app.room.roomInfo.nBankerId)) --最后一手手牌 if app.room:checkUserIDIsInTable(app.room.roomInfo.lastUserId) then local lastViewId = app.room:getViewIdByUserId(app.room.roomInfo.lastUserId) self:setOutCardsVisible(true, lastViewId, { cards = app.room.roomInfo.lastCards, opType = app.room.roomInfo.lastCardType }) end -- 显示头标记 self:showHeadTip() -- 玩家数据 for k,v in pairs(app.room.roomInfo.memberList) do -- 显示过 if v.nGuo == 1 then self.PlayerView:setTipsVisible("tips_yaobuqi", true, app.room:getViewIdByUserId(v.nUserId)) end --显示剩余手牌 self.PlayerView:setLeftNumVisible(true, app.room:getViewIdByUserId(v.nUserId), table.nums(v.handCards)) end --是否显示操作 if self.curViewId == self:getMeViewId() then self:setOperationVisible(true, app.room.roomInfo.opType) end --小局结算阶段 elseif app.room.roomInfo.nStatus == defs.GAME_STATUS.ROUND_OVER then --服务器会推送一个结算消息 --恢复最后一手出牌 local myMemberInfo = app.room.roomInfo.memberList[app.room:getMyUserId()] if myMemberInfo.nPlayerFlag == 0 then self:setOutCardsVisible(true, app.room:getViewIdByUserId(app.room.roomInfo.lastUserId), { cards = app.room.roomInfo.lastCards, opType = app.room.roomInfo.lastCardType }) end end --显示底牌和底分炸弹情况 if app.room:checkUserIDIsInTable(app.room.roomInfo.nBankerId) and table.nums(app.room.roomInfo.bankerCards) > 0 then self:setBanderCardsVisible(true, app.room.roomInfo.bankerCards) end --是否有人发起解散 self:judgeDissmiss() end end function RoomView_53:setXiaoJuVisible(bVisible, data) if self.XiaoJuView then --显示 self.XiaoJuView:setVisible(bVisible) end if bVisible then --显示玩家数据 for _,v in pairs(data.memberList) do local viewId = app.room:getViewIdByUserId(v.nUserId) --显示剩余手牌 if v.nUserId ~= app.room:getMyUserId() and v.nUserId ~= data.nWinId then self:setOutCardsVisible(true, viewId, { cards = v.handCards, maxLen = 10 }) end --刷新分数 self.PlayerView:updateScore(viewId, v.nTotalScore) end --显示小局结算 if not self.XiaoJuView then function xiaYiJu() if app.room.roomInfo.isGameOver == 1 then -- self:goToHall() self:showDaJu(app.room.roomInfo._GameOverInfo) else self.ui:sendMsg(app.room, "callReadyRequest") end end self.XiaoJuView = import("pk_nanchongdoudizhu.luaScript.Views.Room.RoomXiaoJuView_" .. app.gameId):new(xiaYiJu) self.ui.Items.Layout_XiaoJu:addChild(self.XiaoJuView) end --更新界面数据 self.XiaoJuView:updateView(data) end end function RoomView_53:judgeDissmiss() local roomInfo = app.room.roomInfo --解散状态 local uid = 0 local isDismiss = false for k,v in pairs(roomInfo.memberList) do local viewId = app.room:getViewIdByUserId(k) --记录玩家解散状态 0:初始状态, 1:发起解散 2: 同意解散 3:不同意解散 app.room.dismissInfo[k] = v.disbandStatus --有人发起解散时才显示解散界面 if v.disbandStatus == 1 then isDismiss = true uid = k end end --有人发起解散时才显示解散界面 if isDismiss then local memberList = {} for nUserId,memberInfo in pairs(roomInfo.memberList) do if app.room:checkUserIDIsInTable(nUserId) then memberList[nUserId] = memberInfo memberList[nUserId].nDisbandStatus = memberInfo.disbandStatus end end local view = import("luaScript.Views.Room.RoomDismissView"):new(uid, memberList, roomInfo.nDismissStateTime) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end end function RoomView_53:goToHall() app:gotoView(import("luaScript.Views.Main.MainView"):new(GAME_IDS.NanChongDouDiZhu)) end function RoomView_53:leaveRoomRequest() app.room.roomInfo.bQuitRoom = true self.ui:sendMsg(app.room, "callLeaveRequest") end -- 服务器广播玩家数据发生变化 function RoomView_53:onGpsChangeResponse(data) logD("RoomView_53:onGpsChangeResponse()") if not data or not data.nUserId then return end local nUserId = data.nUserId logD("RoomView_53:onGpsChangeResponse()", tostring(nUserId)) self:checkGpsDistance(nUserId) end -- 检查服务器记录的我的GPS数据是最新的,如果不是,则请求更新 function RoomView_53:checkMyGpsNeedUpdate() logD("RoomView_53:checkMyGpsNeedUpdate()") local nMyUserId = app.user.loginInfo.uid local myMemberInfo = app.room.roomInfo.memberList[nMyUserId] if myMemberInfo then local userInfo = json.decode(myMemberInfo.userInfo) if userInfo then local gpsInfo = userInfo.gpsInfo local isNewest = app.user:isGpsInfoNewest(gpsInfo) logD("RoomView_53:checkMyGpsNeedUpdate() gpsInfo is isNewest = ", tostring(isNewest)) if not isNewest then app.room:onGpsChangeRequest() else logD("RoomView_53:checkMyGpsNeedUpdate() gpsInfo is newest") end else logD("RoomView_53:checkMyGpsNeedUpdate() userInfo is nil") end else logD("RoomView_53:checkMyGpsNeedUpdate() myMemberInfo is nil") end end -- 更新所有玩家的信息到GPS组件 function RoomView_53:updateAllGpsInfo() local userInfoList = {} for nUserId, memberInfo in pairs(app.room.roomInfo.memberList) do local nSeatId = memberInfo.nSeatId local userInfo = memberInfo.userInfo if userInfo then userInfoList[nUserId] = {nSeatId = nSeatId, userInfo = userInfo} end end if self.gpsComponent then self.gpsComponent:updateUserInfos(userInfoList) end end -- 检测玩家与其他玩家之间的距离 -- 如果不传参数,则检测所有玩家相互之间的距离 function RoomView_53:checkGpsDistance(curUserId) if app.room.roomInfo.nGameStartCount > 0 then return end self:updateAllGpsInfo() if self.gpsComponent then self.gpsComponent:checkGpsDistance(curUserId) end end -- 显示GPS界面 function RoomView_53:showGpsView() logD("RoomView_53:showGpsView()") local isGameStart = app.room.roomInfo.nGameStartCount > 0 local exitRoomCallback = function() self.ui:sendMsg(app.room, "callLeaveRequest") end local dismissCallback = function() app.room:requestDismissRoom(1) end self:updateAllGpsInfo() if self.gpsComponent then self.gpsComponent:showGpsView(app.room.roomInfo.nMaxPlayCount, isGameStart, exitRoomCallback, dismissCallback) end end -- 玩家收到解散房间的请求 function RoomView_53:onDismissResponse(event) logE("onDismissResponse() response = ", event.response) if not event or not event.response then return end local response = event.response --当前时间 app.room.roomInfo.nDismissStateTime = response.timeLeft --总的时间,服务器没发解散总时间来。那么就和一开始收到的解散剩余时间一致 app.room.roomInfo.nDismissToTalTime = response.timeLeft --显示解散(此标志会影响闹钟时间会冻住) app.room.roomInfo.nShowDismiss = true if response.operateType == 1 then local memberList = {} for nUserId,memberInfo in pairs(app.room.roomInfo.memberList) do if app.room:checkUserIDIsInTable(nUserId) then memberList[nUserId] = memberInfo end end if response.memberList ~= nil then for k,v in pairs(response.memberList) do if v.dismissState == 1 then local view = import("luaScript.Views.Room.RoomDismissView"):new(v.nUserId, memberList, app.room.roomInfo.nDismissStateTime) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) return end end else local view = import("luaScript.Views.Room.RoomDismissView"):new(response.nUserId, memberList, app.room.roomInfo.nDismissStateTime) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end else local memberStatus={} if response.memberList ~= nil then for k,v in pairs(response.memberList) do table.insert(memberStatus,{userId = v.nUserId, status = v.dismissState}) end else table.insert(memberStatus,{userId = response.nUserId, status = response.operateType}) end app.room:dispatchEvent({name = GAME_EVENT.DISSMISS_UPDATE_STATUS , memberStatus = memberStatus}) end end function RoomView_53:addCallBack(callback) table.insert(self.callbackQueue, callback) logE(" #self.callbackQueue:".. #self.callbackQueue) --高延迟情况下,执行快速播放,15条是没有标准,根据实际调整的 --if #self.callbackQueue >= 15 then --cc.Director:getInstance():getScheduler():setTimeScale(5.0) --else cc.Director:getInstance():getScheduler():setTimeScale(1.0) --end local function runFunc() log("2000000000 - runNextFunc() size = ", #self.callbackQueue ) if #self.callbackQueue <= 0 then self.callbackRunning = false return end local func = self.callbackQueue[1] table.remove(self.callbackQueue,1) self.callbackRunning = true func(function() self.callbackRunning = false runFunc() end) end log("self.callbackRunning:",self.callbackRunning) if not self.callbackRunning then runFunc() end end function RoomView_53:onChangeTable(data) self:setTableImg(data.idx) end function RoomView_53:onChangeBgm(data) local idx = nil if not data or not data.idx then idx = tonumber(loadUserInfo("BgmChooseType" .. app.gameId)) or defs.BGM_CHOOSE_TYPE.JING_DIAN else idx = data.idx end if idx then Functions.playMusic(idx) end end function RoomView_53:setTableImg(idx) --桌布 self.ui.Items.ImageView_bg:loadTexture(defs.BG_Img[idx] and defs.BG_Img[idx] or defs.BG_Img[1]) self:initLogo() end function RoomView_53:initLogo() if tolua.isnull(self.ui.Items.ImageView_Logo) then return end if not (type(getSubGameRoomLogo) == 'function') then self.ui.Items.ImageView_Logo:setVisible(false) return end local roomInfo = app.room.roomInfo local gameInfo = json.decode(roomInfo.strGameInfo or "") local gamerule = tonumber(gameInfo.gamerule or 1) roomInfo.gameId = roomInfo.gameId or app.gameId or 0 local logofile = getSubGameRoomLogo(roomInfo.gameId, gamerule) if logofile then self.ui.Items.ImageView_Logo:loadTexture(logofile) self.ui.Items.ImageView_Logo:setVisible(true); else self.ui.Items.ImageView_Logo:setVisible(false); end end function RoomView_53:ontSetPropEnabled(event) -- if self.messageView then -- self.messageView:setPropEnabled(event.value == 1) -- end self.PlayerView:ontSetPropEnabled() end function RoomView_53:onSetVoiceEnabled(event) -- if self.messageView then -- self.messageView:setVoiceEnabled(event.value == 1) -- end self.PlayerView:onSetVoiceEnabled() end function RoomView_53:onNormalChangePoker(data) if data.idx > 2 and data.idx < 1 then return end local temp = { "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cards/doudizhu_pokerCards_old.plist", "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cards/doudizhu_pokerCards.plist", } -- 删除缓存重新添加缓存 for i, v in ipairs(temp) do cc.SpriteFrameCache:getInstance():removeSpriteFramesFromFile(v) end loadSpriteFrameFile(temp[data.idx]) -- 刷新当前手牌 if self.handCards then local myHandCardLayout = self.handCards["" .. self:getMeViewId()] if myHandCardLayout then for i, v in ipairs(myHandCardLayout) do if v.refreshCard then v:refreshCard() end end self:rankHandCards(self:getMeViewId(), false) end end -- 刷新当前出的牌 for _, v in pairs(app.room.roomInfo.memberList) do local viewId = app.room:getViewIdByUserId(v.nUserId) local outCardLayout = self.ui.Items["Layout_Out_" .. viewId] if outCardLayout then for _, card in ipairs(outCardLayout:getChildren()) do if card.refreshCard then card:refreshCard() end end end end end --自己的视图ID function RoomView_53:getMeViewId() return defs.VIEW_ID.MY_VIEW_ID end function RoomView_53:cmd_0x8104_Resp(data) function cmd_0x8104_RespEx(onEnd) playVoice("pk_nanchongdoudizhu/res/sound/doudizhu_common_began.ogg") self.PlayerView:setLeftNumVisible(true, -1, 17) --更新局数 self:updateGameNums() --更新按钮状态 self:updateButtons() --隐藏所有准备 self:setAllReadyVisible(false) -- 隐藏所有标记 self.PlayerView:hideAllTip() if onEnd then onEnd() end end self:addCallBack(cmd_0x8104_RespEx) end --显隐所有准备 function RoomView_53:setAllReadyVisible(bVisible) for k,v in pairs(app.room.roomInfo.memberList) do self.PlayerView:setReadyVisible(bVisible, app.room:getViewIdByUserId(v.nUserId)) end end function RoomView_53:cmd_0x8105_Resp(data) function cmd_0x8105_RespEx(onEnd) --加倍阶段,隐藏叫分相关界面 if data.response.nStatus == defs.GAME_STATUS.ASK_BEI then self:setAskLoardVisible(false) for _,v in pairs(app.room.roomInfo.memberList) do self.PlayerView:setTipsVisible("tips_jiaofen", false, app.room:getViewIdByUserId(v.nUserId)) end --打牌阶段,隐藏加倍相关界面 elseif data.response.nStatus == defs.GAME_STATUS.PLAYING then self:setAskBeiVisible(false) for _,v in pairs(app.room.roomInfo.memberList) do self.PlayerView:setTipsVisible("tips_jiabei", false, app.room:getViewIdByUserId(v.nUserId)) self.PlayerView:setTipsVisible("tips_jiabei_la", false, app.room:getViewIdByUserId(v.nUserId)) end self:showHeadTip() end if data.response.nStatus == defs.GAME_STATUS.SENDCARDS then self.PlayerView:setLeftNumVisible(true, -1, 17) end if onEnd then onEnd() end end self:addCallBack(cmd_0x8105_RespEx) end function RoomView_53:getCardType(card) return self._pokerUtil:getCardType(card) end function RoomView_53:getCardValue(card) return self._pokerUtil:getCardValue(card) end function RoomView_53:setCardUp(card) card.isUp = true self.selectCards["" .. card.cardNum] = card -- card:setPosition(cc.pAdd(card.tarPos, cc.p(0, 35))) -- 抬起动画 card:stopAllActions() local moveTo = cc.MoveTo:create(Card_Move_Up_Down_Time, cc.pAdd(card.tarPos, cc.p(0, 28))) card:runAction(moveTo) end function RoomView_53:setCardDown(card) card.isUp = false -- card:setPosition(card.tarPos) -- 下放动画 card:stopAllActions() local moveTo = cc.MoveTo:create(Card_Move_Up_Down_Time, card.tarPos) card:runAction(moveTo) end function RoomView_53:handCardItemRegisterTouchEvent(handCard) local nomalColor = cc.c3b(255,255,255) local selectColor = cc.c3b(200,200,200) function onTouchBegan(touch, event) local target = event:getCurrentTarget() local locationInNode = target:convertToNodeSpace(touch:getLocation()) local s = target:getContentSize() local rect = cc.rect(0, 0, s.width, s.height) if cc.rectContainsPoint(rect, locationInNode) then self.touchBeganPos = touch:getLocation() target:setColor(selectColor) target.isHit = true return true else return false end end function onTouchMoved(touch, event) local touchMovePos = touch:getLocation() local direction = touchMovePos.x - self.touchBeganPos.x local handCards = self.handCards["" .. self:getMeViewId()] --灵敏度 if math.abs(direction) < 5 then return end if handCards then for k,v in ipairs(handCards) do local needContain = true if v.isHit then local locationInWorld = v:getParent():convertToWorldSpace(v:getPosition()) if direction > 0 then if touchMovePos.x > locationInWorld.x - v:getContentSize().width / 2 + (v:getContentSize().width - self.handCardDif) then needContain = false end else if touchMovePos.x < locationInWorld.x - v:getContentSize().width / 2 then needContain = false end end end if needContain then local cardSize = v:getContentSize() local locationInNode = v:convertToNodeSpace(touch:getLocation()) local rectEx = cc.rect(0, 0, cardSize.width - self.handCardDif, cardSize.height) if cc.rectContainsPoint(rectEx, locationInNode) then v:setColor(selectColor) v.isHit = true else v:setColor(nomalColor) v.isHit = false end end end end end function onTouchEnded(touch, event) local handCards = self.handCards["" .. self:getMeViewId()] if handCards then -- for k,v in ipairs(handCards) do -- if v.isHit then -- if v.isUp then -- self:setCardDown(v) -- else -- self:setCardUp(v) -- end -- end -- v:setColor(nomalColor) -- v.isHit = false -- end local isAllNormal = true for _,card in pairs(handCards) do if card then if card.isUp then isAllNormal = false break end end end local selectCards = {} for k,card in ipairs(handCards) do if card.isHit then table.insert(selectCards, card.cardNum) end end -- 过滤选择的牌(主动出牌) if isAllNormal then if #self.lastData.cards <= 0 then if self._pokerUtil and self._pokerUtil.getCardInSelectCard then selectCards = self._pokerUtil:getCardInSelectCard(selectCards) end end end for i, v in ipairs(selectCards) do local node = self:getCardNodeByCardValue(v) if node then if node.isUp then self:setCardDown(node) else self:setCardUp(node) end node:setColor(nomalColor) node.isHit = false end end for i, card in ipairs(handCards) do if card.isHit then card:setColor(nomalColor) card.isHit = false end end end end -- 创建一个事件监听器 local listener = cc.EventListenerTouchOneByOne:create() --设置穿透属性 listener:setSwallowTouches(true) --添加事件和回调 listener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) listener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) listener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) -- 得到事件派发器 local eventDispatcher = self:getEventDispatcher() -- 将监听器注册到派发器中 eventDispatcher:addEventListenerWithSceneGraphPriority(listener, handCard) end function RoomView_53:initHandCardItem(card, viewId) local switchEx = {} local cardType = self:getCardType(card) local cardValue = self:getCardValue(card) local scaleEx = 0.35 switchEx["1"] = function() -- local card = cc.Sprite:create(string.format("pk/res/ui/zy_fangjian/pk_cards/pk_cards_%d_%d.png", cardType, cardValue)) -- 旧资源 local card = cc.Sprite:createWithSpriteFrameName(string.format("ddz_cards_%d_%d.png", cardType, cardValue)) -- 新资源 card:setAnchorPoint(cc.p(1, 1)) card:setScale(scaleEx) return card end switchEx["2"] = function() -- local card = cc.Sprite:create(string.format("pk/res/ui/zy_fangjian/pk_cards/pk_cards_%d_%d.png", cardType, cardValue)) -- 旧资源 local card = cc.Sprite:createWithSpriteFrameName(string.format("ddz_cards_%d_%d.png", cardType, cardValue)) -- 新资源 card:setAnchorPoint(cc.p(1, 1)) card:setScale(scaleEx) return card end switchEx["3"] = function() -- local card = cc.Sprite:create(string.format("pk/res/ui/zy_fangjian/pk_cards/pk_cards_%d_%d.png", cardType, cardValue)) -- 旧资源 local card = cc.Sprite:createWithSpriteFrameName(string.format("ddz_cards_%d_%d.png", cardType, cardValue)) -- 新资源 card:setAnchorPoint(cc.p(0, 1)) card:setScale(scaleEx) return card end switchEx["4"] = function() -- return cc.Sprite:create(string.format("pk/res/ui/zy_fangjian/pk_cards/pk_cards_%d_%d.png", cardType, cardValue)) -- 旧资源 return cc.Sprite:createWithSpriteFrameName(string.format("ddz_cards_%d_%d.png", cardType, cardValue)) -- 新资源 -- local card = cc.Sprite:createWithSpriteFrameName(string.format("ddz_cards_%d_%d.png", cardType, cardValue)) -- 新资源 -- card:setScale(scaleEx) -- return card end local initFunc = switchEx["" .. viewId] if initFunc then local imageCard = initFunc() if imageCard then imageCard.cardValue = cardValue -- 牌具体值1~13 imageCard.cardType = cardType -- 牌类型 imageCard.cardNum = card -- 牌的标准值 imageCard.refreshCard = function() -- 刷新卡牌 if card > 0 then local cardPng = string.format("ddz_cards_%d_%d.png", cardType, cardValue) imageCard:setSpriteFrame(cardPng) if imageCard.bankerMark then local size = imageCard:getContentSize() local offsetX, offsetY = self:getBankTagOffset() imageCard.bankerMark:setPosition(cc.p(size.width * 0.72 + offsetX, size.height * 0.784 + offsetY)) end end end if viewId == self:getMeViewId() then self:handCardItemRegisterTouchEvent(imageCard) end -- 设置为庄家牌 if self:checkIsBankCard(imageCard.cardNum, viewId) then imageCard.isBankCard = true end end logE("initHandCardItem viewId " .. viewId .. "imageCard " .. imageCard.cardNum) return imageCard end end function RoomView_53:rankHandCards(viewId, ani) local childs = self.handCards["" .. viewId] if childs then local isBanker = app.room.roomInfo.nBankerId and app.room.roomInfo.nBankerId > 0 and app.room:getViewIdByUserId(app.room.roomInfo.nBankerId) == viewId local childsNum = table.nums(childs) local xDiff = -30 --x轴调整 local getPokerChoose = tonumber(loadUserInfo("ddz_setting_poker")) or defs.Default_Poker_Choose local cardDif = (getPokerChoose == 1) and 96 or 110 if childsNum > 17 then -- 使得扑克超过17张的话,让扑克牌组挤一点 self.handCardDif = cardDif + 3 * (childsNum - 17) else self.handCardDif = cardDif end for k,v in ipairs(childs) do local maxLen = 12 local kEx = tonumber(k) local floor = math.floor(kEx / maxLen) local mod = kEx % maxLen + (kEx >= maxLen and 1 or 0) local childScale = v:getScale() local childSize = v:getContentSize() if viewId == defs.VIEW_ID.MY_VIEW_ID then v.tarPos = cc.p(xDiff + (kEx - childsNum / 2) * (childSize.width - self.handCardDif) * childScale.x, childSize.height / 2 * childScale.y) elseif viewId == defs.VIEW_ID.TOP_VIEW_ID then --设置zOder v:setLocalZOrder(maxLen * floor - kEx) v.tarPos = cc.p((-1) * mod * (childSize.width - self.handCardDif) * childScale.x, (-1) * childSize.height * childScale.y * 0.5 * floor) elseif viewId == defs.VIEW_ID.LEFT_VIEW_ID then v.tarPos = cc.p(mod * (childSize.width - self.handCardDif) * childScale.x, (-1) * childSize.height * childScale.y * 0.5 * floor) elseif viewId == defs.VIEW_ID.RIGHT_VIEW_ID then v:setLocalZOrder(maxLen * floor - kEx) v.tarPos = cc.p((-1) * mod * (childSize.width - self.handCardDif) * childScale.x, (-1) * childSize.height * childScale.y * 0.5 * floor) end --庄家标识 if isBanker then if v.isBankCard then if v.bankerMark then v.bankerMark:setVisible(true) else v.bankerMark = cc.Sprite:create(string.format("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_bankerCardMark.png")) local offsetX, offsetY = self:getBankTagOffset() v.bankerMark:setPosition(cc.p(childSize.width * 0.72 + offsetX, childSize.height * 0.784 + offsetY)) v:addChild(v.bankerMark) end end end if ani then v:stopAllActions() v:runAction(cc.MoveTo:create(0.15, v.tarPos)) else v:setPosition(v.tarPos) end end end end function RoomView_53:initHandCards(handCards, viewId) local handLayout = self.ui.Items["Layout_Hand_" .. viewId] --手牌 self.handCards = self.handCards or {} --选中的牌 self.selectCards = self.selectCards or {} if handLayout then handLayout:removeAllChildren() --排序手牌 table.sort(handCards.Datas, function(a, b) local cardValueA = self:getCardValue(a.card) local cardValueB = self:getCardValue(b.card) return cardValueA > cardValueB or cardValueA == cardValueB and self:getCardType(a.card) > self:getCardType(b.card) end) if Functions.getRuleIncludeLzWanFa() then local temp = {} for i = #handCards.Datas, 1, -1 do if self._pokerUtil:isGodCard(handCards.Datas[i].card) then table.insert(temp, handCards.Datas[i]) table.remove(handCards.Datas, i) end end for i, v in ipairs(temp) do table.insert(handCards.Datas, 1, v) end end for k,v in ipairs(handCards.Datas) do local imageCard = self:initHandCardItem(v.card, viewId) if imageCard then handLayout:addChild(imageCard) end end self.handCards["" .. viewId] = handLayout:getChildren() end self:rankHandCards(viewId) end function RoomView_53:fapaiAni(onEnd) self._isCanClickBg = false local handCards = self.handCards["" .. self:getMeViewId()] if not handCards then logE("RoomView_53 fapaiAni error") if onEnd then onEnd() end end for k,v in ipairs(handCards) do v:setPosition(cc.pAdd(v.tarPos, cc.p(1280, 0))) v:runAction( cc.Sequence:create( cc.DelayTime:create(0.03 * tonumber(k)), cc.MoveTo:create(0, v.tarPos), cc.CallFunc:create(function() --playVoice("pk_nanchongdoudizhu/res/sound/doudizhu_common_fapai.ogg") if tonumber(k) == table.nums(handCards) then self._isCanClickBg = true if onEnd then onEnd() end end end) ) ) end end function RoomView_53:cmd_0x8106_Resp(data) function cmd_0x8106_Resp(onEnd) local handCards = app.room.roomInfo.memberList[app.room:getMyUserId()].handCards self:initHandCards(handCards, self:getMeViewId()) local totalCard = self._pokerUtil.Card_Max_Length if table.nums(handCards) == totalCard then local bankerCards = {} for _,v in ipairs(app.room.roomInfo.bankerCards) do table.insert(bankerCards, v.card) end --从手牌中上升地主牌 self:setHandCardsUp(self:getMeViewId(), bankerCards) if onEnd then onEnd() end else self:fapaiAni(onEnd) end end self:addCallBack(cmd_0x8106_Resp) end function RoomView_53:setPiaoVisible(bVisible) self.ui.Items.Layout_Piao:setVisible(bVisible) end function RoomView_53:setMenZhuaVisible(bVisible) self.ui.Items.Layout_MenZhua:setVisible(bVisible) end function RoomView_53:setMenDaoVisible(bVisible) self.ui.Items.Layout_MenDao:setVisible(bVisible) end function RoomView_53:setMenLaVisible(bVisible) self.ui.Items.Layout_MenLa:setVisible(bVisible) end function RoomView_53:setAskLoardVisible(bVisible, biJiao) self.ui.Items.Layout_Ask_Loard:setVisible(bVisible) if bVisible then local curAskLoard = app.room.roomInfo.curAskLoard or 0 for i = 0, 1 do local askLoardBtn = self.ui.Items["Button_Ask_Loard_F_" .. i] if askLoardBtn then if biJiao then askLoardBtn:setEnabled(i == 1) else askLoardBtn:setEnabled(true) end end end self.ui.Items.Layout_Ask_Loard_Buttons:requestDoLayout() self.ui.Items.Layout_Ask_Loard_Buttons:doLayout() end end function RoomView_53:setAskBeiVisible(bVisible) self.ui.Items.Layout_Ask_Bei:setVisible(bVisible) end function RoomView_53:setLaVisible(bVisible) self.ui.Items.Layout_La:setVisible(bVisible) end function RoomView_53:setOperationVisible(bVisible, opType) self.ui.Items.Layout_Operation:setVisible(bVisible) if bVisible then -- opType: 0要不起(没有可压牌), 1可要可不要, 2必须出(轮到自己了) if opType == 1 then -- 这种风格是,全程没有变灰的按钮,直接就隐藏掉 self.ui.Items.Layout_Operation_BuChu:setVisible(bVisible) self.ui.Items.Layout_Operation_TiShi:setVisible(bVisible) self.ui.Items.Layout_Operation_ChuPai:setVisible(bVisible) self.ui.Items.Layout_Operation_YaoBuQi:setVisible(not bVisible) -- 这种风格是,有变灰的按钮,不可点击,下面同理 --[[ self.ui.Items.Button_Operation_BuChu:setEnabled(bVisible) self.ui.Items.Button_Operation_TiShi:setEnabled(bVisible) self.ui.Items.Button_Operation_ChuPai:setEnabled(bVisible) self.ui.Items.Layout_Operation_YaoBuQi:setVisible(false) ]] elseif opType == 2 then self:setLastData() self.ui.Items.Layout_Operation_BuChu:setVisible(not bVisible) self.ui.Items.Layout_Operation_TiShi:setVisible(not bVisible) -- 轮到自己回合,提示按钮隐藏 self.ui.Items.Layout_Operation_ChuPai:setVisible(bVisible) self.ui.Items.Layout_Operation_YaoBuQi:setVisible(not bVisible) --[[ self.ui.Items.Button_Operation_BuChu:setEnabled(not bVisible) self.ui.Items.Button_Operation_TiShi:setEnabled(bVisible) self.ui.Items.Button_Operation_ChuPai:setEnabled(bVisible) self.ui.Items.Layout_Operation_YaoBuQi:setVisible(false) ]] else self.ui.Items.Layout_Operation_BuChu:setVisible(not bVisible) self.ui.Items.Layout_Operation_TiShi:setVisible(not bVisible) self.ui.Items.Layout_Operation_ChuPai:setVisible(not bVisible) self.ui.Items.Layout_Operation_YaoBuQi:setVisible(bVisible) --[[ self.ui.Items.Button_Operation_BuChu:setEnabled(bVisible) self.ui.Items.Button_Operation_TiShi:setEnabled(not bVisible) self.ui.Items.Button_Operation_ChuPai:setEnabled(not bVisible) self.ui.Items.Layout_Operation_YaoBuQi:setVisible(false) ]] end self.ui.Items.Layout_Operation_Buttons:requestDoLayout() self.ui.Items.Layout_Operation_Buttons:doLayout() --检测提示 self.tiShiCount = 1 local handCards = self.handCards["" .. self:getMeViewId()] local handCardsValueTable = {} -- 玩家手牌值表 local lastDataValueTable = {} -- 上个牌数据值表 for i, v in pairs(handCards) do table.insert(handCardsValueTable, v.cardNum) end for i, v in pairs(self.lastData.cards) do table.insert(lastDataValueTable, v.cardNum) end -- 判断是否可以一手出完牌 -- if self._pokerUtil:checkIsCanOneOutCard(handCardsValueTable, lastDataValueTable) then -- --self:setOperationVisible(false) -- self:runAction( -- cc.Sequence:create( -- cc.DelayTime:create(0.5), -- cc.CallFunc:create(function () -- self:setHandCardsUp(self:getMeViewId(), handCardsValueTable) -- self:chuPai() -- end) -- ) -- ) -- end -- 牌型提示 if self.ui.Items.Layout_Operation_TiShi:isVisible() then self.weaveCardList = self:getTip(handCardsValueTable, lastDataValueTable) end end end function RoomView_53:setHandCardsUp(viewId, cards) --下降所有牌 self:setAllHandCardDown(self:getMeViewId()) --上升指定牌 if self.handCards and cards then local handCards = self.handCards["" .. viewId] if handCards then for k,v in ipairs(cards) do for _,v2 in ipairs(handCards) do if v == v2.cardNum then self:setCardUp(v2) end end end end end end function RoomView_53:setAllHandCardDown(viewId) if self.handCards then local handCards = self.handCards["" .. viewId] if handCards then for _,v in ipairs(handCards) do self:setCardDown(v) end end end end function RoomView_53:initGameButtons() --桌面 self.ui.Items.ImageView_bg:registerClick(function() --测试 --self:chuPai() --self:tiShi() --self:fapaiAni() if not self._isCanClickBg then return end --下降所有牌 self:setAllHandCardDown(self:getMeViewId()) end) -- 漂分 self.ui.Items.Layout_Piao:setVisible(false) for i = 0, 1 do local button = self.ui.Items["Button_Piao_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendPiao(i) end) end end -- 闷抓 self.ui.Items.Layout_MenZhua:setVisible(false) for i = 0, 2, 2 do local button = self.ui.Items["Button_MenZhua_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendMenZhuaOrMenDao(i) self:setMenZhuaVisible(false) -- self.PlayerView:setClockVisibel(false, self.curViewId) end) end end -- 闷倒 self.ui.Items.Layout_MenDao:setVisible(false) for i = 3, 5, 2 do local button = self.ui.Items["Button_MenDao_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendMenZhuaOrMenDao(i) self:setMenDaoVisible(false) -- self.PlayerView:setClockVisibel(false, self.curViewId) end) end end -- 闷拉 self.ui.Items.Layout_MenLa:setVisible(false) for i = 0, 2, 2 do local button = self.ui.Items["Button_MenLa_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendMenLa(i) self:setMenLaVisible(false) -- self.PlayerView:setClockVisibel(false, self.curViewId) end) end end --叫分(抓) self.ui.Items.Layout_Ask_Loard:setVisible(false) for i = 0, 1 do local button = self.ui.Items["Button_Ask_Loard_F_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendAskLoard(i) end) end end --加倍(倒) self.ui.Items.Layout_Ask_Bei:setVisible(false) for i = 0, 2, 2 do local button = self.ui.Items["Button_Ask_Bei_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendAskBeiOrLa(i) end) end end -- 拉 self.ui.Items.Layout_La:setVisible(false) for i = 3, 5, 2 do local button = self.ui.Items["Button_La_" .. i] if button then button:registerClick(function() playBtnEffect() app.room:sendAskBeiOrLa(i) end) end end --要不起,不出,提示,出牌 self.ui.Items.Layout_Operation:setVisible(false) self.ui.Items.Button_Operation_YaoBuQi:registerClick(function() playBtnEffect() app.room:sendOperation({opType = 0, cards = {}, lzCards = {}}) end) self.ui.Items.Button_Operation_BuChu:registerClick(function() playBtnEffect() app.room:sendOperation({opType = 0, cards = {}, lzCards = {}}) end) self.ui.Items.Button_Operation_TiShi:registerClick(handler(self, self.tiShi)) self.ui.Items.Button_Operation_ChuPai:registerClick(handler(self, self.chuPai)) end function RoomView_53:getCardsType(cards) return self._pokerUtil:getCardsType(cards) end function RoomView_53:getTip(cards, lastData) if cards and cards[1] and type(cards[1]) == 'userdata' then logD('亲!现在调用getTip,cards数据是要传牌值,不是card节点啦!!!') return end return self._pokerUtil:getTip(cards, lastData) end function RoomView_53:tiShi() playBtnEffect() if self.weaveCardList and table.nums(self.weaveCardList) > 0 then function tiShiEx() local weaveList = self.weaveCardList[self.tiShiCount] if weaveList then self:setHandCardsUp(self:getMeViewId(), weaveList) self.tiShiCount = self.tiShiCount + 1 else self.tiShiCount = 1 tiShiEx() end end tiShiEx() else app.room:sendOperation({opType = 0, cards = {}, lzCards = {}}) end end function RoomView_53:chuPai() playBtnEffect() local handCards = self.handCards["" .. self:getMeViewId()] if not handCards then logE("RoomView_53 chuPai error handCards is null") end --获取点中的牌 local cards = {} local cardsEx = {} for k,v in ipairs(handCards) do if v:isVisible() and v.isUp then table.insert(cards, v.cardNum) table.insert(cardsEx, v) end end local lzCards = {} if not Functions.getRuleIncludeLzWanFa() then lzCards = clone(cards) else local leftLzCards = self._pokerUtil:removeGodCards(clone(cards)) local lzReplaceCards = self._pokerUtil:getGodCardReplaceCard(cards) lzCards = self._pokerUtil:addTableData(leftLzCards, lzReplaceCards or {}) end --local typeEx = self:getCardsType(cardsEx) --logE("RoomView_53 chuPai type : " .. table.tostring(cardsEx)) logE("RoomView_53 chuPai type : " .. table.tostring(cards)) dump(cards, '出的牌') dump(lzCards, '癞子替代牌') app.room:sendOperation({opType = 1, cards = cards, lzCards = lzCards}) end function RoomView_53:cmd_0x8108_Resp(data) function cmd_0x8108_RespEx(onEnd) --当前操作玩家 self.curViewId = app.room:getViewIdByUserId(data.response.nUserId) --显示闹钟 self.PlayerView:setClockVisibel(true, self.curViewId, data.response.leftTime) --显示叫分 if self.curViewId == self:getMeViewId() then self:setAskLoardVisible(true, data.response.mustBanker == 1) end if onEnd then onEnd() end end self:addCallBack(cmd_0x8108_RespEx) end function RoomView_53:cmd_0x8109_Resp(data) function cmd_0x8109_RespEx(onEnd) local viewId = app.room:getViewIdByUserId(data.response.nUserId) --隐藏叫分界面 self:setAskLoardVisible(false) --隐藏闹钟 self.PlayerView:setClockVisibel(false, viewId) -- 闷抓之后不显示抓了 if app.room.roomInfo.menZhuaUserId ~= data.response.nUserId then --显示叫分 self.PlayerView:setTipsVisible("tips_jiaofen", true, viewId, {askLoard = data.response.askLoard}) --播放音效 Functions.playVoice("jiaofen", data.response.askLoard, self.PlayerView:getPlayerData("sex", viewId)) end if onEnd then onEnd() end end self:addCallBack(cmd_0x8109_RespEx) end function RoomView_53:setBankerAskLoard() self.ui.Items.Text_AskLoard:setText(app.room.roomInfo.curAskLoard or 0) end function RoomView_53:setCurZhaDanNum() self.ui.Items.Text_ZhaDan:setText(app.room.roomInfo.nBombs or 0) end function RoomView_53:setBanderCardsVisible(bVisible, bankerCards) self.ui.Items.Layout_BankerInfo:setVisible(bVisible) if bVisible then for k,v in ipairs(bankerCards) do local card = self.ui.Items["Image_BankerCard_" .. k] if card then -- card:loadTexture(string.format("pk/res/ui/zy_fangjian/pk_cards/pk_cards_%d_%d.png", self:getCardType(v.card), self:getCardValue(v.card))) -- 旧资源 card:loadTexture(string.format("ddz_cards_%d_%d.png", self:getCardType(v.card), self:getCardValue(v.card)), 1) -- 新资源 end end self:setCurZhaDanNum() self:setBankerAskLoard() end end function RoomView_53:cmd_0x810a_Resp(data) function cmd_0x810a_RespEx(onEnd) self:runAction( cc.Sequence:create( cc.DelayTime:create(0.5), cc.CallFunc:create(function() local viewId = app.room:getViewIdByUserId(data.response.nBankerId) --显示剩余手牌 self.PlayerView:setLeftNumVisible(true, viewId, 17 + table.nums(data.response.bankerCards)) --显示庄家 self.PlayerView:setBankerVisible(true, viewId) --显示底牌和底分炸弹情况 self:setBanderCardsVisible(true, data.response.bankerCards) -- 底牌显示的时候,即叫分结束,此时把叫分分数隐藏 self:setAllTipsVisible() if onEnd then onEnd() end end) ) ) end self:addCallBack(cmd_0x810a_RespEx) end function RoomView_53:setAllTipsVisible(bVisible) for k,v in pairs(app.room.roomInfo.memberList) do self.PlayerView:setTipsVisible("tips_jiaofen", false, app.room:getViewIdByUserId(v.nUserId)) end end function RoomView_53:cmd_0x810c_Resp(data) function cmd_0x810c_RespEx(onEnd) local viewId = app.room:getViewIdByUserId(data.response.nUserId) --显示加倍(倒or拉) if viewId == self:getMeViewId() then if data.response.nDaoState == defs.DAO_STATE.DAO_STATE_WAIT then self:setAskBeiVisible(true) elseif data.response.nLaState == defs.DAO_STATE.LA_STATE_WAIT then self:setLaVisible(true) end end self.PlayerView:setClockVisibel(true, viewId, data.response.leftTime) if onEnd then onEnd() end end self:addCallBack(cmd_0x810c_RespEx) end -- 加倍(倒or拉) function RoomView_53:cmd_0x810d_Resp(data) function cmd_0x810d_RespEx(onEnd) local viewId = app.room:getViewIdByUserId(data.response.nUserId) --隐藏加倍操作界面 if viewId == self:getMeViewId() then self:setAskBeiVisible(false) self:setLaVisible(false) end --隐藏闹钟 self.PlayerView:setClockVisibel(false, viewId) --显示加倍状态 if data.response.askBei <= defs.DAO_STATE.DAO_STATE_YES then self.PlayerView:setTipsVisible("tips_jiabei", true, viewId, { askBei = data.response.askBei }) if data.response.askBei == defs.DAO_STATE.DAO_STATE_YES then Functions.playVoice('dao', data.response.askBei, self.PlayerView:getPlayerData("sex", viewId)) end elseif data.response.askBei <= defs.DAO_STATE.LA_STATE_YES then self.PlayerView:setTipsVisible("tips_jiabei_la", true, viewId, { askBei = data.response.askBei }) if data.response.askBei == defs.DAO_STATE.LA_STATE_YES then Functions.playVoice('la', data.response.askBei, self.PlayerView:getPlayerData("sex", viewId)) end end self:runAction( cc.Sequence:create( cc.DelayTime:create(0.5), cc.CallFunc:create(function() if onEnd then onEnd() end end) ) ) end self:addCallBack(cmd_0x810d_RespEx) end function RoomView_53:hideAllOutCardOperation() --隐藏玩家出牌操作信息 for _,v in pairs(app.room.roomInfo.memberList) do local viewId = app.room:getViewIdByUserId(v.nUserId) --隐藏玩家的出牌 self:setOutCardsVisible(false, viewId) --隐藏玩家的操作 self.PlayerView:setTipsVisible("tips_yaobuqi", false, viewId) end end function RoomView_53:cmd_0x810e_Resp(data) function cmd_0x810e_RespEx(onEnd) --当前操作玩家 self.curViewId = app.room:getViewIdByUserId(data.response.nUserId) local delayTime = 0 if data.response.opType == 2 then -- 如果是所有玩家都操作不要,即本家必须出牌 delayTime = 0.4 end self:runAction(cc.Sequence:create( cc.DelayTime:create(delayTime), cc.CallFunc:create(function() --隐藏玩家出牌操作信息 if data.response.opType == 2 then self:hideAllOutCardOperation() else --隐藏玩家的出牌 self:setOutCardsVisible(false, self.curViewId) --隐藏玩家的操作 self.PlayerView:setTipsVisible("tips_yaobuqi", false, self.curViewId) end --显示闹钟 self.PlayerView:setClockVisibel(true, self.curViewId, self.clockTime) --显示操作 if self.curViewId == self:getMeViewId() then self:setOperationVisible(true, data.response.opType) end if onEnd then onEnd() end end) )) end self:addCallBack(cmd_0x810e_RespEx) end function RoomView_53:cmd_0x810f_Resp(data) function cmd_0x810f_RespEx(onEnd) local errorMessage = { [1] = "轮次错误", [2] = "牌型错误", [3] = "出牌错误", } --下降所有手牌 self:setAllHandCardDown(self.getMeViewId()) --显示错误信息 showTooltip(errorMessage[data.response.errorType] or "出牌错误") if onEnd then onEnd() end end self:addCallBack(cmd_0x810f_RespEx) end function RoomView_53:setLastData(viewId, data) if viewId and data then local cardsEx = {} local cardsValueTable = {} for k,v in ipairs(data.cards) do table.insert(cardsEx, { cardNum = v.card, cardValue = self:getCardValue(v.card), cardType = self:getCardType(v.card) }) table.insert(cardsValueTable, v.card) end local lastDataEx = self:getCardsType(cardsValueTable) if lastDataEx then for k,v in pairs(lastDataEx) do self.lastData[k] = v end end self.lastData.cards = cardsEx self.lastData.viewId = viewId --播放音效 Functions.playVoice("chupai", self.lastData, self.PlayerView:getPlayerData("sex", viewId)) else self.lastData = { min = 0, cards = {}, viewId = 0, cardType = 0, } end end function RoomView_53:setOutCardsVisible(bVisible, viewId, data) logE("RoomView_53 setOutCardsVisible data : ".. table.toString(data)) local outCardsLayout = self.ui.Items["Layout_Out_" .. viewId] if outCardsLayout then outCardsLayout:setVisible(bVisible) if bVisible then outCardsLayout:removeAllChildren() if data.opType == 0 then self.PlayerView:setTipsVisible("tips_yaobuqi", true, viewId) --播放音效 Functions.playVoice("buyao", 0, self.PlayerView:getPlayerData("sex", viewId)) else if not data.maxLen then self:setLastData(viewId, data) end -- 改变扑克值,将0x5x打头的赖子值,更改为普通的0x0x标准值(注意王牌不是0x0x打头) local godCardFlag = {} if data and data.cards then for i, v in ipairs(data.cards) do if self._pokerUtil:isGodCardReplaceCard(v.card) then local val = self._pokerUtil:getCardValue(v.card) if val ~= 0x0e and val ~= 0x0f then v.card = val else -- 如果是小王,大王,则要改为0x4e和0x4f v.card = val + 4 * 16 end godCardFlag[i] = true end end end dump(data, 'RoomView_53:setOutCardsVisible 转换后的数据为') self:initOutCardItem(outCardsLayout, viewId, data, godCardFlag) end end end end function RoomView_53:initOutCardItem(outCardsLayout, viewId, data, godCardFlag) local cardScale = 0.5 local cardsLen = table.nums(data.cards) local isBanker = app.room.roomInfo.nBankerId > 0 and app.room:getViewIdByUserId(app.room.roomInfo.nBankerId) == viewId -- (右家(viewid = 1)是从右到左排序,即从小到大,如果感觉现有不太好,直接逆序即可) for k,v in ipairs(data.cards) do -- local card = cc.Sprite:create(string.format("pk/res/ui/zy_fangjian/pk_cards/pk_cards_%d_%d.png", self:getCardType(v.card), self:getCardValue(v.card))) -- 旧资源 local card = cc.Sprite:createWithSpriteFrameName(string.format("ddz_cards_%d_%d.png", self:getCardType(v.card), self:getCardValue(v.card))) -- 新资源 if card then -- 设置为庄家牌 if self:checkIsBankCard(v.card, viewId) then card.isBankCard = true end local kEx = tonumber(k) card:setScale(cardScale) outCardsLayout:addChild(card) local cardSize = card:getContentSize() if viewId == 1 then --左对齐 if data.maxLen then local floor = math.floor(kEx / data.maxLen) local mod = kEx % data.maxLen + (kEx >= data.maxLen and 1 or 0) --设置zOder card:setLocalZOrder(data.maxLen * floor - kEx) card:setPosition(cc.p((-1) * mod * (cardSize.width - self.handCardDif) * cardScale, (-1) * cardSize.height * cardScale * 0.5 * floor)) else --设置zOder card:setLocalZOrder(cardsLen - kEx) card:setPosition(cc.p((-1) * kEx * (cardSize.width - self.handCardDif) * cardScale, 0)) end elseif viewId == 3 then --右对齐 if data.maxLen then local floor = math.floor(kEx / data.maxLen) local mod = kEx % data.maxLen + (kEx >= data.maxLen and 1 or 0) card:setPosition(cc.p(mod * (cardSize.width - self.handCardDif) * cardScale, (-1) * cardSize.height * cardScale * 0.5 * floor)) else card:setPosition(cc.p(kEx * (cardSize.width - self.handCardDif) * cardScale, 0)) end else --居中 card:setPosition(cc.p((kEx - cardsLen / 2) * (cardSize.width - self.handCardDif) * cardScale, 0)) end -- 癞子标识 if godCardFlag[k] then local imgPath = 'pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_lzMark.png' local imgNode = cc.ImageView:create(imgPath) imgNode:setAnchorPoint(cc.p(0, 0)) local offsetX, offsetY = self:getLzTagOffset() imgNode:setPosition(cc.p(5 + offsetX, 5 + offsetY)) card:addChild(imgNode) card.lzMark = imgNode end --庄家标识 if isBanker then if card.isBankCard then if card.bankerMark then card.bankerMark:setVisible(true) else card.bankerMark = cc.Sprite:create(string.format("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_bankerCardMark.png")) local offsetX, offsetY = self:getBankTagOffset() card.bankerMark:setPosition(cc.p(cardSize.width * 0.72 + offsetX, cardSize.height * 0.785 + offsetY)) card:addChild(card.bankerMark) end end end card:stopAllActions() local moveTo = cc.MoveBy:create(Card_Out_Down_Time, cc.p(0, Card_Out_Down_Offset_Y)) card:runAction(moveTo) -- 添加刷新牌的方法 card.refreshCard = function() -- 刷新卡牌 if v.card > 0 then local cardPng = string.format("ddz_cards_%d_%d.png", self:getCardType(v.card), self:getCardValue(v.card)) card:setSpriteFrame(cardPng) if card.bankerMark then local size = card:getContentSize() local offsetX, offsetY = self:getBankTagOffset() card.bankerMark:setPosition(cc.p(size.width * 0.72 + offsetX, size.height * 0.785 + offsetY)) end if card.lzMark then local offsetX, offsetY = self:getLzTagOffset() card.lzMark:setPosition(cc.p(5 + offsetX, 5 + offsetY)) end end end else logE("RoomView_53 initOutCardItem error".. table.toString(v)) end end --播放动画 if #self.lastData.cards > 0 then local cardsEx = outCardsLayout:getChildren() if #cardsEx > 0 then local effect = nil if self.lastData.cardType == defs.CARD_TYPE.SHUNZI then --顺子 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_shunzi.plist", "shunzi%d.png", 1, 17, -1) effect = DDZ_New_Effect_Helper:getShunziNew() elseif self.lastData.cardType == defs.CARD_TYPE.SHUANGSHUN then --连对 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_liandui.plist", "liandui%d.png", 1, 8, -1) effect = DDZ_New_Effect_Helper:getLianduiNew() elseif self.lastData.cardType == defs.CARD_TYPE.SANSHUN then --飞机 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_feiji.plist", "feiji%d.png", 1, 16, -1) effect = DDZ_New_Effect_Helper:getPlanNew() elseif self.lastData.cardType == defs.CARD_TYPE.AIRPLANE_SINGLE then --飞机 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_feiji.plist", "feiji%d.png", 1, 16, -1) effect = DDZ_New_Effect_Helper:getPlanNew() elseif self.lastData.cardType == defs.CARD_TYPE.AIRPLANE_DUAD then --飞机 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_feiji.plist", "feiji%d.png", 1, 16, -1) effect = DDZ_New_Effect_Helper:getPlanNew() elseif self.lastData.cardType == defs.CARD_TYPE.BOMB or (self.lastData.cardType == defs.CARD_TYPE.BOMB_LAIZI and cardsLen == 4) then --炸弹 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_zhadan.plist", "zhadan%d.png", 1, 17, -1) effect = DDZ_New_Effect_Helper:getBombNew() elseif self.lastData.cardType == defs.CARD_TYPE.BOMB_KING or (self.lastData.cardType == defs.CARD_TYPE.BOMB_LAIZI and cardsLen == 2) then --王炸 -- effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_zhadan.plist", "zhadan%d.png", 1, 17, -1) effect = DDZ_New_Effect_Helper:getKingBombNew() end if effect then effect:setScale(0.7) effect:setPosition(cardsEx[toint(#cardsEx / 2)]:getPosition()) outCardsLayout:addChild(effect, 100) if effect.onEnter and type(effect.onEnter)=='function' then effect:onEnter() end end end end end function RoomView_53:deleteHandCards(viewId, cards, doAni) local handCards = self.handCards["" .. viewId] if handCards then for k,v in ipairs(cards) do logE("handCards v.card " .. v.card) for k2,v2 in ipairs(handCards) do logE("handCards v2.cardNum " .. v2.cardNum) if v2.cardNum == v.card then v2:removeFromParent() table.remove(handCards, k2) break end -- 癞子牌(手牌中是以癞子牌值保留,只有出的牌才会幻化,所以判断赖子值即可) if Functions.getRuleIncludeLzWanFa() then if self._pokerUtil:isGodCardReplaceCard(v.card) and self._pokerUtil:isGodCard(v2.cardNum) then v2:removeFromParent() table.remove(handCards, k2) break end end end end self:rankHandCards(viewId, doAni) end end -- 根据牌的标准值获取手牌节点 function RoomView_53:getCardNodeByCardValue(cardValue) if self.handCards and cardValue then local handCards = self.handCards["" .. self:getMeViewId()] if handCards then for _,cardNode in ipairs(handCards) do if cardValue == cardNode.cardNum then return cardNode end end end end end -- 判断是否是庄家牌 function RoomView_53:checkIsBankCard(card, viewId) if not app.room.roomInfo.bankerCards then return false end -- 只要是庄家,庄家的牌都显示为地主 local isBanker = app.room.roomInfo.nBankerId and app.room.roomInfo.nBankerId > 0 and app.room:getViewIdByUserId(app.room.roomInfo.nBankerId) == viewId return isBanker -- 只有3张底牌显示 -- local temp = {} -- for _,v in ipairs(app.room.roomInfo.bankerCards) do -- table.insert(temp, v.card) -- end -- for i, v in ipairs(temp) do -- if card == v then -- return true -- end -- end -- return false end -- 获得庄家标记偏移值 function RoomView_53:getBankTagOffset() local getPokerChoose = tonumber(loadUserInfo("ddz_setting_poker")) or defs.Default_Poker_Choose local offsetX = (getPokerChoose == 1) and 0 or 3 local offsetY = (getPokerChoose == 1) and 0 or -3 return offsetX, offsetY end -- 获得癞子标记偏移值 function RoomView_53:getLzTagOffset() local getPokerChoose = tonumber(loadUserInfo("ddz_setting_poker")) or defs.Default_Poker_Choose local offsetX = (getPokerChoose == 1) and 0 or 3 local offsetY = (getPokerChoose == 1) and 1 or -1 return offsetX, offsetY end -- 显示头像标记 如果有传showType,则只显示该相关的字段 function RoomView_53:showHeadTip(showType) local temp = { piao = false, daoOrLa = false, } if not showType then for i, v in pairs(temp) do temp[i] = true end else temp[showType] = true end -- 玩家选择漂或者倒拉 for k,v in pairs(app.room.roomInfo.memberList) do if Functions.getRuleIncludeDingPiaoWanFa() then self.PlayerView:setPiaoVisible(app.room:getViewIdByUserId(v.nUserId), true) else if temp.piao then if v.nPiaoState == defs.PIAO_STATE.PIAO_STATE_YES then self.PlayerView:setPiaoVisible(app.room:getViewIdByUserId(v.nUserId), true) end end end if temp.daoOrLa then if v.nDaoState == defs.DAO_STATE.DAO_STATE_YES or v.nMenZhuaState == defs.MEN_STATE.MEN_STATE_DAO then self.PlayerView:setDaoOrLaVisible(app.room:getViewIdByUserId(v.nUserId), true, 'dao') elseif v.nLaState == defs.DAO_STATE.LA_STATE_YES or v.nMenLaState == defs.MEN_LA_STATE.MEN_STATE_LA_ZHUAI then self.PlayerView:setDaoOrLaVisible(app.room:getViewIdByUserId(v.nUserId), true, 'la') end end end end function RoomView_53:cmd_0x8110_Resp(data) function cmd_0x8110_RespEx(onEnd) --隐藏玩家信息 if data.response.opType == 1 then self:hideAllOutCardOperation() end --操作位置 local opViewId = app.room:getViewIdByUserId(data.response.nUserId) --显示剩余手牌 self.PlayerView:setLeftNumVisible(true, opViewId, data.response.leftNum) --隐藏操作 self:setOperationVisible(false) --隐藏闹钟 self.PlayerView:setClockVisibel(false, opViewId) -- 分析牌数据,让牌分解 local cards = {} for i, v in ipairs(data.response.cards) do table.insert(cards, {card = v.card}) end --显示出牌 self:setOutCardsVisible(true, opViewId, {cards = clone(cards), opType = data.response.opType}) --删除手牌 if opViewId == self:getMeViewId() then self:deleteHandCards(opViewId, clone(cards), true) end if onEnd then onEnd() end end self:addCallBack(cmd_0x8110_RespEx) end function RoomView_53:cmd_0x8111_Resp(data) function cmd_0x8111_RespEx(onEnd) --设置底分 self:setBankerAskLoard() --设置炸弹数 self:setCurZhaDanNum() if onEnd then onEnd() end end self:addCallBack(cmd_0x8111_RespEx) end function RoomView_53:cmd_0x8112_Resp(data) function cmd_0x8112_RespEx(onEnd) --显示春天动画 -- 去除春天动画 -- if data.response.nSpring == 1 then -- local effect = createAnimationByPlist("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_cardsAni/doudizhu_spring.plist", "spring%d.png", 1, 22, -1) -- if effect then -- playVoice("pk_nanchongdoudizhu/res/sound/doudizhu_common_spring.ogg") -- effect:setPosition(cc.p(640, 360)) -- self:addChild(effect) -- end -- end self:runAction( cc.Sequence:create( -- cc.DelayTime:create(1.0), cc.DelayTime:create(1.3), cc.CallFunc:create(function() --隐藏界面 local winViewId = app.room:getViewIdByUserId(data.response.nWinId) for _,v in pairs(app.room.roomInfo.memberList) do local viewId = app.room:getViewIdByUserId(v.nUserId) if viewId ~= winViewId then --出牌界面 self:setOutCardsVisible(false, viewId) end --闹钟界面 self.PlayerView:setClockVisibel(false, viewId) end --显示小局结算 self:setXiaoJuVisible(true, data.response) if onEnd then onEnd() end end) ) ) end self:addCallBack(cmd_0x8112_RespEx) end function RoomView_53:showDaJu(data) if not self.daJuView then self.daJuView = import("pk_nanchongdoudizhu.luaScript.Views.Room.RoomDaJuView_53"):new(data.memberList) -- self.ui.Items.Layout_DaJu:addChild(self.daJuView) self.daJuView:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(self.daJuView); end --更新界面 self.daJuView:updateView(data) end function RoomView_53:cmd_0x8113_Resp(data) function cmd_0x8113_RespEx(onEnd) local isShow_XiaoJu = (self.XiaoJuView and self.XiaoJuView:isVisible()) or false -- 如果之前没显示过小结算,或者是解散导致的结束,直接显示大结算 if not isShow_XiaoJu or app.room.roomInfo._stopFlag == 9 then --隐藏小局结算 self:setXiaoJuVisible(false) --显示总结算 self:showDaJu(data.response) end --关闭结算界面 app.room:dispatchEvent({ name = GAME_EVENT.DISSMISS_CLOSE }) if onEnd then onEnd() end end self:addCallBack(cmd_0x8113_RespEx) end function RoomView_53:cmd_0x8114_Resp(data) function cmd_0x8114_RespEx(onEnd) --重置桌面 self:defaultState() if onEnd then onEnd() end end self:addCallBack(cmd_0x8114_RespEx) end -- 通知漂 function RoomView_53:cmd_0x8115_Resp(data) function cmd_0x8115_RespEx(onEnd) --当前操作玩家 self.curViewId = app.room:getViewIdByUserId(data.response.nUserId) --显示闹钟 -- self.PlayerView:setClockVisibel(true, self.curViewId, data.response.nChoosePiaoTimeout) -- 显示定飘中 self.PlayerView:setChoosePiaoVisible(true, self.curViewId) -- 显示漂界面 if self.curViewId == self:getMeViewId() then self:setPiaoVisible(true) end -- 显示之前的标记(之前有漂过的玩家,就不会在通知到了) self:showHeadTip('piao') -- 更新局数 self:updateGameNums() --隐藏所有准备 self:setAllReadyVisible(false) -- 打开解散按钮 self:updateButtonInPiao() if onEnd then onEnd() end end self:addCallBack(cmd_0x8115_RespEx) end -- 通知漂结果 function RoomView_53:cmd_0x8116_Resp(data) -- todo playerHead show piao and table show piao tag function cmd_0x8116_RespEx(onEnd) --隐藏叫分界面 if data.response.nUserId == app.room:getMyUserId() then self:setPiaoVisible(false) end local viewId = app.room:getViewIdByUserId(data.response.nUserId) --隐藏闹钟 self.PlayerView:setClockVisibel(false, viewId) --显示漂 self.PlayerView:setTipsVisible("tips_piao", true, viewId, {piaoState = data.response.nPiaoState}) --播放音效 local str = (data.response.nPiaoState == defs.PIAO_STATE.PIAO_STATE_YES) and 'piao' or 'bupiao' Functions.playVoice(str, data.response.nPiaoState, self.PlayerView:getPlayerData("sex", viewId)) -- 隐藏定飘中 self.PlayerView:setChoosePiaoVisible(false, viewId) if onEnd then onEnd() end end self:addCallBack(cmd_0x8116_RespEx) end -- 翻牌信息 function RoomView_53:cmd_0x8117_Resp(data) function cmd_0x8117_RespEx(onEnd) local winSize = cc.Director:getInstance():getWinSize() local node = DDZ_New_Effect_Helper:fanPaiAni(data.response.nTurnCard, onEnd) node:setPosition(cc.p(winSize.width/2, winSize.height/2 + 80)) self.ui.Items.Layout_Game:addChild(node) --隐藏所有准备 self:setAllReadyVisible(false) -- 隐藏标记 self.PlayerView:hideAllTip() --更新局数 self:updateGameNums() -- 显示头标记 self:showHeadTip('piao') --更新按钮状态 self:updateButtons() end self:addCallBack(cmd_0x8117_RespEx) end -- 通知玩家是否选择闷抓or闷倒 function RoomView_53:cmd_0x8118_Resp(data) function cmd_0x8117_RespEx(onEnd) --当前操作玩家 self.curViewId = app.room:getViewIdByUserId(data.response.nUserId) self.PlayerView:setClockVisibel(true, self.curViewId, data.response.leftTime) -- 显示闷抓or闷倒 if self.curViewId == self:getMeViewId() then if data.response.nMenZhuaState == defs.MEN_STATE.MEN_STATE_WAIT then self:setMenZhuaVisible(true) elseif data.response.nMenZhuaState == defs.MEN_STATE.MEN_STATE_DAO_WAIT then self:setMenDaoVisible(true) end end if onEnd then onEnd() end end self:addCallBack(cmd_0x8117_RespEx) end -- 广播玩家闷抓or闷倒结果 function RoomView_53:cmd_0x8119_Resp(data) function cmd_0x8119_RespEx(onEnd) if data.response.nUserId == app.room:getMyUserId() then self:setMenZhuaVisible(false) self:setMenDaoVisible(false) end local viewId = app.room:getViewIdByUserId(data.response.nUserId) self.PlayerView:setClockVisibel(false, viewId) --显示玩家闷抓or闷倒 local voiceStr = 'menzhua' if data.response.nMenZhuaState <= defs.MEN_STATE.MEN_STATE_ZHUAI then self.PlayerView:setTipsVisible("tips_menzhua", true, viewId, {menzhua = data.response.nMenZhuaState}) voiceStr = 'menzhua' elseif data.response.nMenZhuaState <= defs.MEN_STATE.MEN_STATE_DAO then self.PlayerView:setTipsVisible("tips_mendao", true, viewId, {mendao = data.response.nMenZhuaState}) voiceStr = 'mendao' end --播放音效 jxtd -- Functions.playVoice(voiceStr, data.response.nMenZhuaState, self.PlayerView:getPlayerData("sex", viewId)) if onEnd then onEnd() end end self:addCallBack(cmd_0x8119_RespEx) end -- 通知玩家是否选择闷拉 function RoomView_53:cmd_0x811b_Resp(data) function cmd_0x811b_RespEx(onEnd) --当前操作玩家 self.curViewId = app.room:getViewIdByUserId(data.response.nUserId) -- 隐藏闷抓tip self.PlayerView:setTipsVisible("tips_menzhua", false, self.curViewId) self.PlayerView:setClockVisibel(true, self.curViewId, data.response.leftTime) -- 显示闷拉 if self.curViewId == self:getMeViewId() then if data.response.nMenLaState == defs.MEN_LA_STATE.MEN_STATE_LA_WAIT then self:setMenLaVisible(true) end end if onEnd then onEnd() end end self:addCallBack(cmd_0x811b_RespEx) end -- 广播玩家闷拉结果 function RoomView_53:cmd_0x811c_Resp(data) function cmd_0x811c_RespEx(onEnd) if data.response.nUserId == app.room:getMyUserId() then self:setMenLaVisible(false) end local viewId = app.room:getViewIdByUserId(data.response.nUserId) self.PlayerView:setClockVisibel(false, viewId) self.PlayerView:setTipsVisible("tips_menzhua", false, viewId) self.PlayerView:setTipsVisible("tips_menla", true, viewId, {menla = data.response.nMenLaState}) --播放音效 jxtd -- Functions.playVoice("tips_menla", data.response.nMenLaState, self.PlayerView:getPlayerData("sex", viewId)) if onEnd then onEnd() end end self:addCallBack(cmd_0x811c_RespEx) end --游戏消息 function RoomView_53:bindGameMessage() self:bindEvent(app.room , "cmd_0x8104_Resp", handler(self , self.cmd_0x8104_Resp)) self:bindEvent(app.room , "cmd_0x8105_Resp", handler(self , self.cmd_0x8105_Resp)) self:bindEvent(app.room , "cmd_0x8106_Resp", handler(self , self.cmd_0x8106_Resp)) self:bindEvent(app.room , "cmd_0x8108_Resp", handler(self , self.cmd_0x8108_Resp)) -- 抓(叫地主) self:bindEvent(app.room , "cmd_0x8109_Resp", handler(self , self.cmd_0x8109_Resp)) -- 抓结果(叫地主) self:bindEvent(app.room , "cmd_0x810a_Resp", handler(self , self.cmd_0x810a_Resp)) self:bindEvent(app.room , "cmd_0x810c_Resp", handler(self , self.cmd_0x810c_Resp)) -- 倒or拉(加倍) self:bindEvent(app.room , "cmd_0x810d_Resp", handler(self , self.cmd_0x810d_Resp)) -- 倒or拉结果(加倍) self:bindEvent(app.room , "cmd_0x810e_Resp", handler(self , self.cmd_0x810e_Resp)) self:bindEvent(app.room , "cmd_0x810f_Resp", handler(self , self.cmd_0x810f_Resp)) self:bindEvent(app.room , "cmd_0x8110_Resp", handler(self , self.cmd_0x8110_Resp)) self:bindEvent(app.room , "cmd_0x8111_Resp", handler(self , self.cmd_0x8111_Resp)) self:bindEvent(app.room , "cmd_0x8112_Resp", handler(self , self.cmd_0x8112_Resp)) self:bindEvent(app.room , "cmd_0x8113_Resp", handler(self , self.cmd_0x8113_Resp)) self:bindEvent(app.room , "cmd_0x8114_Resp", handler(self , self.cmd_0x8114_Resp)) self:bindEvent(app.room , "cmd_0x8115_Resp", handler(self , self.cmd_0x8115_Resp)) -- 通知漂 self:bindEvent(app.room , "cmd_0x8116_Resp", handler(self , self.cmd_0x8116_Resp)) -- 通知漂结果 self:bindEvent(app.room , "cmd_0x8117_Resp", handler(self , self.cmd_0x8117_Resp)) -- 翻牌信息 self:bindEvent(app.room , "cmd_0x8118_Resp", handler(self , self.cmd_0x8118_Resp)) -- 通知玩家是否选择闷抓or闷倒 self:bindEvent(app.room , "cmd_0x8119_Resp", handler(self , self.cmd_0x8119_Resp)) -- 广播玩家闷抓or闷倒结果 self:bindEvent(app.room , "cmd_0x811b_Resp", handler(self , self.cmd_0x811b_Resp)) -- 通知玩家是否选择闷拉 self:bindEvent(app.room , "cmd_0x811c_Resp", handler(self , self.cmd_0x811c_Resp)) -- 广播玩家闷拉结果 end return RoomView_53