|
- local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
- local ZPMessage = ZPFramework.ZPImport("zp_base.luaScript.Protocol.ZPMessage")
- local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions")
- local ZPSound = ZPFramework.ZPImport("zp_base.luaScript.ZPSound")
-
- local ZPRoomPlayerView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomPlayerView")
- local xichongRoomPlayerView = class("xichongRoomPlayerView", ZPRoomPlayerView)
-
- function xichongRoomPlayerView:ctor( ... )
- xichongRoomPlayerView.super.ctor(self)
- end
-
- function xichongRoomPlayerView:loadUI()
- local ui = loadUI("zp_xichong/res/ui/ui_fangjian/xichong_ui_PlayerView.ui");
- self.ui = ui;
- self:addChild(ui);
-
- ---经典模式下头像的位置
- self.jDPlayerPos = {}
- --现代模式下头像的位置
- self.xDPlayerPos = {}
- ---经典模式下闹钟的位置
- self.jDClockPos = {}
- --现代模式下闹钟的位置
- self.xDClockPos = {}
- ---经典模式下特效的位置
- self.jDEffectPos = {}
- --现代模式下特效的位置
- self.xDEffectPos = {}
- end
-
- function xichongRoomPlayerView:onEnter()
- xichongRoomPlayerView.super.onEnter(self)
-
- self:bindEvent(app, 'EVENT_CHANGE_CHAT_ENABLED', handler(self, self.onEventChatChangeEnable));
-
- self:resetTuoGuanShow()
- end
-
- -- 托管显示
- function xichongRoomPlayerView:resetTuoGuanShow()
- for i=1,4 do
- self.ui.Items["ImageView_tuoguan_"..i]:setVisible(false)
- end
- end
-
- -- 显示指定玩家头像托管标识
- function xichongRoomPlayerView:showTuoGuanByViewId(viewId,bVisible)
- self.ui.Items["ImageView_tuoguan_"..viewId]:setVisible(bVisible)
- end
-
- function xichongRoomPlayerView:initPlayerNodes()
- -- 玩家节点名称模板
- local names =
- {
- player = "Layout_player_%d", -- 头像绿圈根节点
- tempplayer = "Layout_player_Temp_%d",
- head = "ImageView_head_%d", -- 头像
- headBoarder = "ImageView_head_border_%d", --头像边
- score = "Text_Score_%d", -- 总分数
- banker = "ImageView_banker_%d", -- 庄家
- readyState = "ImageView_ready_%d", -- 准备
- headInfo = "Layout_headInfo_%d", --个人信息点击触发框
- offLine = "ImageView_offLine_%d", --离线标志
- --其他节点
- tip = "ImageView_tip_%d", --提示操作图
- clock = "ImageView_clock_%d", --闹钟
- txtClocl = "TextBMFont_clock_%d", --闹钟时间
- offLineTime = "Text_offLineTime_%d", --离线时间
- offLineTimeBg = "ImageView_txkYY_%d", --离线时间背景
- toujia = "ImageView_toujia_icon_%d", --头家角标
- xiaojia = "ImageView_xiao_icon_%d", --小家家角标
- tuoShu = "Text_tuoshuNum_%d", --坨数
- piao = "ImageView_Piao_%d", --漂
- dingpiao = "ImageView_piaoing_%d", --漂
- paiXing = "Layout_Paixing_%d", --牌型
- paiXingType = "ImageView_leixing_%d", --牌型名字
- dang = "ImageView_dang_icon_%d", --当
- baoType = "Layout_BaoType_%d", --玩家点击报播放的类型
- cloneClock = "ImageView_temp_clock_%d", --切换版式后闹钟位置
- cloneEffect = "ImageView_tip_clone_%d", --切换版式后特效的位置
- huCardBg = "ImageView_HuCard_BG_%d",
- huCard = "ImageView_HuCard_%d",
- }
- self.allNodes = {}
- self.headSize = {}
- for i = 1,ZPDef.GameMaxPlayer do
- local nodes = {}
- --玩家根节点
- local namePlayer = string.format(names.player,i)
- local nodePlayer = self.ui.Items[namePlayer]
- nodes.player = nodePlayer
-
- --头像
- local nameHead = string.format(names.head,i)
- local nodeHead = self.ui.Items[nameHead]
- nodes.head = nodeHead
- nodeHead:setTouchEnabled(true)
- nodeHead:registerClick(function()
- self:onClickHead(i)
- end)
-
- local headBoarder = string.format(names.headBoarder,i)
- local nodeheadBoarder = self.ui.Items[headBoarder]
- nodes.headBoarder = nodeheadBoarder
-
- -- 需要记录头像的原始尺寸
- if not self.headSize.width then
- self.headSize.width = nodeHead:getContentSize().width
- self.headSize.height = nodeHead:getContentSize().height
- end
-
-
- --总分
- local nickScore = string.format(names.score,i)
- local nodeScore = self.ui.Items[nickScore]
- nodes.score = nodeScore
-
- --坨数
- local nicktuoShu = string.format(names.tuoShu,i)
- local nodetuoShu = self.ui.Items[nicktuoShu]
- nodes.tuoShu = nodetuoShu
-
- --庄家
- local nameBanker = string.format(names.banker,i)
- local nodeBanker = self.ui.Items[nameBanker]
- nodes.banker = nodeBanker
- nodes.banker.pos = nodeBanker:getPosition()
-
-
- --准备
- local nameReadyState = string.format(names.readyState,i)
- local nodeReadyState = self.ui.Items[nameReadyState]
- nodes.readyState = nodeReadyState
-
- --头像信息
- local headInfo = string.format(names.headInfo,i)
- local nodeheadInfo = self.ui.Items[headInfo]
- nodes.headInfo = nodeheadInfo
-
- --离线信息
- local offLine = string.format(names.offLine,i)
- local nodeoffLine = self.ui.Items[offLine]
- nodes.offLine = nodeoffLine
-
- --tip
- local nameTip = string.format(names.tip,i)
- local nodeTip = self.ui.Items[nameTip]
- nodes.tip = nodeTip
-
- self.xDEffectPos[i] = self.ui.Items[nameTip]:getPosition()
- local nameCloneEffect = string.format(names.cloneEffect,i)
- self.jDEffectPos[i] = self.ui.Items[nameCloneEffect]:getPosition()
-
-
- --闹钟
- local nameClock = string.format(names.clock,i)
- local nodeClock = self.ui.Items[nameClock]
- nodes.clock = nodeClock
-
- self.xDClockPos[i] = self.ui.Items[nameClock]:getPosition()
- local nameCloneClock = string.format(names.cloneClock,i)
- self.jDClockPos[i] = self.ui.Items[nameCloneClock]:getPosition()
-
- --闹钟时间
- local nametxtClock = string.format(names.txtClocl,i)
- local nodetxtClock = self.ui.Items[nametxtClock]
- nodes.txtclock = nodetxtClock
-
- --离线时间
- local nameoffLineTime = string.format(names.offLineTime,i)
- local nodeoffLineTime = self.ui.Items[nameoffLineTime]
- nodes.offLineTime = nodeoffLineTime
-
- --离线时间背景
- local nameoffLineTimeBg = string.format(names.offLineTimeBg,i)
- local nodeoffLineTimeBg = self.ui.Items[nameoffLineTimeBg]
- nodes.offLineTimeBg = nodeoffLineTimeBg
- nodes.offLineTimeBg:setVisible(false)
-
- --头家
- local toujia = string.format(names.toujia,i)
- local nodetoujia = self.ui.Items[toujia]
- nodes.toujia = nodetoujia
-
- --小家
- local xiaojia = string.format(names.xiaojia,i)
- local nodexiaojia = self.ui.Items[xiaojia]
- nodes.xiaojia = nodexiaojia
-
- --漂
- local piao = string.format(names.piao,i)
- local nodepiao = self.ui.Items[piao]
- nodes.piao = nodepiao
-
- --定漂中
- local dingpiao = string.format(names.dingpiao,i)
- local nodedingpiao = self.ui.Items[dingpiao]
- nodes.dingpiao = nodedingpiao
-
- --牌型
- local paiXing = string.format(names.paiXing,i)
- local nodePaiXing = self.ui.Items[paiXing]
- nodes.paiXing = nodePaiXing
-
-
- --牌型
- local paiXingType = string.format(names.paiXingType,i)
- local nodepaiXingType = self.ui.Items[paiXingType]
- nodes.paiXingType = nodepaiXingType
-
-
- --当
- local dang = string.format(names.dang,i)
- local nodedang = self.ui.Items[dang]
- nodes.dang = nodedang
-
- --报类型
- local baoType = string.format(names.baoType,i)
- local nodebaoType = self.ui.Items[baoType]
- nodes.baoType = nodebaoType
-
- local huCardBg = string.format(names.huCardBg, i)
- local nodeHuCardBg = self.ui.Items[huCardBg]
- nodeHuCardBg:setVisible(false)
- nodes.huCardBg = nodeHuCardBg
-
- local huCard = string.format(names.huCard, i)
- local nodeHuCard = self.ui.Items[huCard]
- nodes.huCard = nodeHuCard
-
- self.allNodes[i] = nodes
-
- self.xDPlayerPos[i] = self.ui.Items[namePlayer]:getPosition()
- local tempPlayer = string.format(names.tempplayer,i)
- self.ui.Items[tempPlayer]:setVisible(false)
- self.jDPlayerPos[i] = self.ui.Items[tempPlayer]:getPosition()
- end
-
-
- self:initChatComponent()
-
- self:setAllClockVisible(false)
- self:setOwnerVisible()
- self:stopAndHideBaoAnim()
- self:setXiaoJiaFlagVis(false)
- self:hideTouJia()
- self:hideXiaoJia()
- self:hidePiao()
- self:hideDang()
- self:hideBaoType()
- end
-
- function xichongRoomPlayerView:updatePlayerInfo(index)
- logE("ZPRoomView:updatePlayerInfo() index = ", index)
-
- local nodes = self.allNodes[index]
- if not nodes then return end
- local nUserId = app.room.seatShowList[index]
- local roomInfo = app.room.roomInfo
- local memberInfo = app.room.roomInfo.memberList[nUserId]
- if nUserId and app.room:checkUserIDIsInTable(nUserId) then--memberInfo and memberInfo.userInfo then
- nodes.player:setVisible(true)
- local userInfo = json.decode(memberInfo.userInfo)
- if not userInfo then
- return
- end
-
- -- 玩家名字
- local nickname = userInfo.nickname
- nickname = getSubStringNickname(nickname)
- --nodes.name:setText(tostring(nickname))
- nodes.score:setText(tostring(memberInfo.nTotalMoney))
- -- 玩家头像
- local nodeHead = nodes.head;
- --先设置默认头像
- local width = nodeHead:getContentSize().width
- setPlayerHeadImage(nUserId, userInfo.headimgurl, nodeHead)
-
- if app.room.offLineUid[tonumber(nUserId)] or (memberInfo.nOnlineStatus and memberInfo.nOnlineStatus~=1) then
- self:setPlayerOffLine(true,index)
- else
- self:setPlayerOffLine(false,index)
- end
- else
- nodes.player:setVisible(false)
- end
- end
-
- --隐藏牌型
- function xichongRoomPlayerView:hideBaoType()
- for i = 1,ZPDef.GameMaxPlayer do
- self.allNodes[i].baoType:setVisible(false)
- end
- end
-
- --隐藏牌型
- function xichongRoomPlayerView:hidePaiXing()
- for i = 1,ZPDef.GameMaxPlayer do
- self.allNodes[i].paiXing:setVisible(false)
- end
- end
-
- --设置某个玩家的报的类型
- function xichongRoomPlayerView:playBaoTypeAni(viewId,baoTypeList,card)
- local cardImage = string.format("ImageView_BaoCard_%d",viewId)
-
- local ImageCard = self.ui.Items[cardImage]
-
- local fileName = ZPFuc.getZPCardImgByValue(card,ZPDef.CardType.CARD_TYPE_HAND)
- ImageCard:loadTextureFromPlist(fileName)
-
-
- local paiXingNode = self.allNodes[viewId].baoType
-
- --先全部隐藏
- for i = 1, 3 do
- if i == 3 then
- i = i+1
- end
- local baoType = string.format("Layout_BaoType%d_%d",i,viewId)
- self.ui.Items[baoType]:setVisible(false)
- end
-
- --按发过来的类型显示
- for k,v in pairs(baoTypeList or {}) do
- local baoImage = string.format("Layout_BaoType%d_%d",v,viewId)
- local baoImageNode = self.ui.Items[baoImage]
- baoImageNode:setVisible(true)
- end
-
-
- paiXingNode:requestDoLayout()
- paiXingNode:doLayout()
-
-
- paiXingNode:setVisible(true)
- local seq = cc.Sequence:create(cc.DelayTime:create(3.0),cc.CallFunc:create(function ()
- paiXingNode:setVisible(false)
- end))
- paiXingNode:runAction(seq)
-
- return false
- end
- ---
- -- 获取牌型图片
- -- @param paiXing
- -- @return
- --
- function xichongRoomPlayerView:getPaiXingImage(paiXing)
- local img = ""
- if paiXing == ZPDef.BaoOpCode.BAO_ZHAO_CHI then
- img = ZPDef.PaiXingFile.ZHAOCHI
- elseif paiXing == ZPDef.BaoOpCode.BAO_TUI then
- img = ZPDef.PaiXingFile.BAOTUI
- elseif paiXing == ZPDef.BaoOpCode.BAO_HOU_DUI then
- img = ZPDef.PaiXingFile.HOUDUI
- elseif paiXing == ZPDef.BaoOpCode.BAO_PO_DUI then
- img = ZPDef.PaiXingFile.PODUI
- elseif paiXing == ZPDef.BaoOpCode.BAO_CHENG_KAN then
- img = ZPDef.PaiXingFile.CHENGKAN
- elseif paiXing == ZPDef.BaoOpCode.BAO_SI_ZHANG then
- img = ZPDef.PaiXingFile.SIZHANG
- elseif paiXing == ZPDef.BaoOpCode.DIAO_CHENG_KAN then
- img = ZPDef.PaiXingFile.DIAOKAN
- elseif paiXing == ZPDef.BaoOpCode.DIAO_CHENG_SIZHANG then
- img = ZPDef.PaiXingFile.DIAOSIZHANG
- elseif paiXing == ZPDef.CustomOpCode.CHI_CHENG_SI_GEN then
- img = ZPDef.PaiXingFile.CHICEHNGSIZHANG
- elseif paiXing == ZPDef.CustomOpCode.HU_CHENG_SI_GEN then
- img = ZPDef.PaiXingFile.HUCEHNGSIZHANG
- elseif paiXing == ZPDef.CustomOpCode.CHI_CHENG_KAN then
- img = ZPDef.PaiXingFile.CHICEHNGKAN
- elseif paiXing == ZPDef.CustomOpCode.HU_CHENG_KAN then
- img = ZPDef.PaiXingFile.HUCEHNGKAN
- end
- return img
- end
- ---
- -- 设置某个玩家的牌型
- -- @param viewId
- -- @param paiXingList
- -- @param card
- -- @param callback
- -- @return
- --
- function xichongRoomPlayerView:playPaiXingAniList(viewId, paiXingList, card, callback)
-
- local layoutPaiXing = self.ui.Items["Layout_Paixing_" .. viewId]
- layoutPaiXing:removeAllChildren()
-
- local cardTemplate = self.ui.Items.Layout_Leixing_Card_Template;
- cardTemplate:setVisible(false)
-
- local paiXingTemplate = self.ui.Items.Layout_Leixing_Template;
- paiXingTemplate:setVisible(false)
-
- local cardItem = cardTemplate:getCopied()
- local cardImage = cardItem:getChildByName("ImageView_Card")
- local fileName = ZPFuc.getZPCardImgByValue(card,ZPDef.CardType.CARD_TYPE_HAND)
- cardImage:loadTextureFromPlist(fileName)
-
- if viewId > 2 then
- layoutPaiXing:addChild(cardItem)
- end
-
- local x = 0
- for k, v in pairs(paiXingList or {}) do
- local path = self:getPaiXingImage(v)
-
- local item = paiXingTemplate:getCopied()
- local img = item:getChildByName("ImageView_PaiXing")
- img:loadTexture(path)
-
- local w = img:getContentSize().width
- local size = item:getSize()
- size.width = (w + 20) * 1.2
- item:setSize(size)
-
- layoutPaiXing:addChild(item)
- end
-
- if viewId <= 2 then
- layoutPaiXing:addChild(cardItem)
- end
-
- logD("xichongRoomPlayerView playPaiXingAniList", paiXingList)
- layoutPaiXing:setVisible(true)
- local seq = cc.Sequence:create(cc.DelayTime:create(3.0),cc.CallFunc:create(function ()
- layoutPaiXing:setVisible(false)
- if type(callback) == "function" then
- callback()
- end
- end))
- layoutPaiXing:runAction(seq)
- end
- ---
- -- 设置某个玩家的牌型
- -- @param viewId
- -- @param paixing
- -- @param card
- -- @param callback
- -- @return
- --
- function xichongRoomPlayerView:playPaiXingAni(viewId,paixing,card,callback)
- return self:playPaiXingAniList(viewId, {paiXing}, card, callback)
- end
-
-
- --设置某个玩家的吃成砍
- function xichongRoomPlayerView:playChiChengKan(viewId,card,ishu)
- local paiXing = nil
- if ishu == 1 then
- paiXing = ZPDef.CustomOpCode.HU_CHENG_KAN
- else
- paiXing = ZPDef.CustomOpCode.CHI_CHENG_KAN
- end
-
- local paiXingNode = self.allNodes[viewId].paiXing
-
- --先要播吃动画 再播报动画
- local seq = cc.Sequence:create(cc.DelayTime:create(0.6),cc.CallFunc:create(function()
- local nUserID = app.room:getUserIdByViewId(viewId)
- local userInfo=app.room:getUserInfo(nUserID)
- if userInfo then
- ZPSound.PlayOperateSound(userInfo.sex,-55)
- end
- self:playPaiXingAniList(viewId, {paiXing}, card, function ()
-
- end)
- end))
- paiXingNode:runAction(seq)
-
- return false
- end
-
-
- --设置某个玩家的吃成四根
- function xichongRoomPlayerView:playChiChengSiZhang(viewId,card,ishu)
- local paiXingNode = self.allNodes[viewId].paiXing
-
- local paiXing = nil
- if ishu == 1 then
- paiXing = ZPDef.CustomOpCode.HU_CHENG_SI_GEN
- else
- paiXing = ZPDef.CustomOpCode.CHI_CHENG_SI_GEN
- end
-
- local seq = cc.Sequence:create(cc.DelayTime:create(0.6),cc.CallFunc:create(function()
- local nUserID = app.room:getUserIdByViewId(viewId)
- local userInfo=app.room:getUserInfo(nUserID)
- if userInfo then
- ZPSound.PlayOperateSound(userInfo.sex,-55)
- end
- self:playPaiXingAniList(viewId, {paiXing}, card, function ()
-
- end)
- end))
- paiXingNode:runAction(seq)
-
- return false
- end
-
-
- --隐藏头家
- function xichongRoomPlayerView:hideTouJia()
- for i = 1,ZPDef.GameMaxPlayer do
- self.allNodes[i].toujia:setVisible(false)
- end
- end
-
- --设置某个玩家为头家
- function xichongRoomPlayerView:setPlayerTouJiaVisible(viewId,bVisible)
- if self.allNodes[viewId] then
- self.allNodes[viewId].toujia:setVisible(bVisible)
- return true
- end
- return false
- end
-
-
- --隐藏当
- function xichongRoomPlayerView:hideDang()
- for i = 1,ZPDef.GameMaxPlayer do
- self.allNodes[i].dang:setVisible(false)
- end
- end
-
- --设置某个玩家当
- function xichongRoomPlayerView:setPlayerDangVisible(viewId,bVisible)
- if self.allNodes[viewId] then
- self.allNodes[viewId].dang:setVisible(bVisible)
- return true
- end
- return false
- end
-
- --隐藏小家
- function xichongRoomPlayerView:hideXiaoJia()
- for i = 1,ZPDef.GameMaxPlayer do
- self.allNodes[i].xiaojia:setVisible(false)
- end
- end
-
- --设置某个玩家为小家
- function xichongRoomPlayerView:setPlayerXiaoJiaVisible(viewId,bVisible)
- if self.allNodes[viewId] then
- self.allNodes[viewId].xiaojia:setVisible(bVisible)
- return true
- end
- return false
- end
-
-
- --隐藏漂
- function xichongRoomPlayerView:hidePiao()
- for i = 1,ZPDef.GameMaxPlayer do
- self.allNodes[i].piao:setVisible(false)
- end
- end
-
- --设置某个玩家漂
- function xichongRoomPlayerView:setPlayerPiaoVisible(viewId,bVisible)
- if self.allNodes[viewId] then
- self.allNodes[viewId].piao:setVisible(bVisible)
- return true
- end
- return false
- end
-
-
- --隐藏定漂中
- function xichongRoomPlayerView:hideDingPiao()
- for i = 1,ZPDef.GameMaxPlayer do
- if self.allNodes[i].dingpiao then
- self.allNodes[i].dingpiao:setVisible(false)
- end
- end
- end
-
- --设置某个玩家定漂中
- function xichongRoomPlayerView:setPlayerDingPiaoVisible(viewId,bVisible)
- if self.allNodes[viewId] then
- if self.allNodes[viewId].dingpiao then
- self.allNodes[viewId].dingpiao:setVisible(bVisible)
- end
- return true
- end
- return false
- end
-
- --隐藏房主
- function xichongRoomPlayerView:setOwnerVisible()
- end
-
- --设置某个房主Visible
- function xichongRoomPlayerView:setPlayerOwnerVisible(viewId,bVisible)
- return false
- end
-
- --设置胡息归0
- function xichongRoomPlayerView:setHuXizero()
- end
-
-
- --设置某个玩家胡息
- function xichongRoomPlayerView:setPlayerHuXi(viewId,huxi)
- end
-
-
- function xichongRoomPlayerView:stopAndHideBaoAnim()
- end
-
- function xichongRoomPlayerView:playBaoAnim(view)
-
- end
-
- --设置小家标志显示
- function xichongRoomPlayerView:setXiaoJiaFlagVis(vis)
- end
-
-
- --设置某个庄家Visible
- function xichongRoomPlayerView:setPlayerBankerVisible(viewId,bVisible)
- return false
- end
-
-
- --用户行为提示
- function xichongRoomPlayerView:showOperatorTip(viewId,mType)
- local tip = self.allNodes[viewId].tip
- local time = 0.5
- tip:setVisible(true)
-
- local count = 0
- if mType == ZPDef.OpType.OP_TYPE_CANCEL then
- tip:loadTextureFromPlist(ZPDef.TipFile.GUO)
- elseif mType == ZPDef.OpType.OP_TYPE_CHI then
- tip:loadTexture(ZPDef.TipFile.CHI)
- elseif mType == ZPDef.OpType.OP_TYPE_PENG then
- tip:loadTexture(ZPDef.TipFile.PENG)
- elseif mType == ZPDef.OpType.OP_TYPE_ANSIZHANG then
- tip:loadTexture(ZPDef.TipFile.BA)
- elseif mType == ZPDef.OpType.OP_TYPE_ANSANZHANG then
- tip:loadTexture(ZPDef.TipFile.TOU)
- elseif mType == ZPDef.OpType.OP_TYPE_HU then
- time = 2.0
- if app.room.roomInfo.huType and app.room.roomInfo.huType >= 0 then
- local name = string.format(ZPDef.TipFile.HU,app.room.roomInfo.huType)
- tip:loadTextureFromPlist(name)
- end
- elseif mType == -55 then--单独处理爆牌动画
- tip:loadTexture(ZPDef.TipFile.BAOJIAO)
- elseif mType == -56 then
- tip:loadTexture(ZPDef.TipFile.BAOPEI)
- elseif mType == ZPDef.OpType.OP_TYPE_JIAOPAI then --叫牌
- tip:loadTexture(ZPDef.TipFile.JIAOPAI)
- elseif mType == ZPDef.OpType.OP_TYPE_ZUOZHUANG then --做壮
- tip:loadTexture(ZPDef.TipFile.ZUOZHUANG)
- elseif mType == ZPDef.OpType.OP_TYPE_DANG then --当
- tip:loadTexture(ZPDef.TipFile.DANG)
- elseif mType == ZPDef.OpType.OP_TYPE_PIAO then
- tip:loadTexture(ZPDef.TipFile.PIAO)
- elseif mType == ZPDef.OpType.OP_TYPE_KUA then
- tip:loadTexture(ZPDef.TipFile.KUA)
- elseif mType == ZPDef.OpType.OP_TYPE_WEIGUI then
- tip:loadTexture(ZPDef.TipFile.WEIGUI)
- end
-
-
- --音效
- local nUserId = app.room:getUserIdByViewId(viewId)
- local userInfo=app.room:getUserInfo(nUserId)
- if userInfo then
- ZPSound.PlayOperateSound(userInfo.sex,mType)
- end
-
-
- tip:setScale(1.0)
- local seq = cc.Sequence:create(cc.ScaleTo:create(0.2,2.0),cc.DelayTime:create(0.1),cc.ScaleTo:create(0.2,1.0),cc.CallFunc:create(function ()
- tip:setVisible(false)
- end))
- tip:runAction(seq)
-
-
- end
-
-
- --设置某个玩家坨数
- function xichongRoomPlayerView:setPlayerTuoShu(viewId,strTuoShu)
- if self.allNodes[viewId] and self.allNodes[viewId].tuoShu then
- self.allNodes[viewId].tuoShu:setText(tostring(strTuoShu))
- end
- end
-
- --切换桌面的时候设置头像的位置
- function xichongRoomPlayerView:setPlayerPosByChangeTable(deskTableType)
- -- playBtnEffect()
- local playerList = {
- [1] = self.allNodes[1].player,
- [2] = self.allNodes[2].player,
- [3] = self.allNodes[3].player,
- [4] = self.allNodes[4].player,
- }
-
- local clockList = {
- [1] = self.allNodes[1].clock,
- [2] = self.allNodes[2].clock,
- [3] = self.allNodes[3].clock,
- [4] = self.allNodes[4].clock,
- }
-
- local tipList = {
- [1] = self.allNodes[1].tip,
- [2] = self.allNodes[2].tip,
- [3] = self.allNodes[3].tip,
- [4] = self.allNodes[4].tip,
- }
- if deskTableType == ZPDef.GameStyleType.JINGDIAN then
- for i = 1,ZPDef.GameMaxPlayer do
- playerList[i]:setPosition(self.jDPlayerPos[i])
- clockList[i]:setPosition(self.jDClockPos[i])
- tipList[i]:setPosition(self.jDEffectPos[i])
- end
- else
- for i = 1,ZPDef.GameMaxPlayer do
- playerList[i]:setPosition(self.xDPlayerPos[i])
- clockList[i]:setPosition(self.xDClockPos[i])
- tipList[i]:setPosition(self.xDEffectPos[i])
- end
- end
- end
-
-
- function xichongRoomPlayerView:initChatComponent()
- if not self._chatComponentView then
- local heads = {
- [1] = self.allNodes[1].head,
- [2] = self.allNodes[2].head,
- [3] = self.allNodes[3].head,
- [4] = self.allNodes[4].head,
- }
- self._chatComponentView=import("luaScript.Views.Room.RoomChatComponentView"):new(heads,ZPDef.XICHONG_GAME_CHAT_TXT)
- self:addChild(self._chatComponentView)
- end
-
- local propEnable = loadUserInfo('propEnable') or 1
- propEnable = propEnable == "" and 1 or propEnable
- self._chatComponentView:setPropEnabled(tonumber(propEnable) == 1)
-
- local voiceEnable = loadUserInfo('voiceEnable') or 1
- voiceEnable = voiceEnable == "" and 1 or voiceEnable
- self._chatComponentView:setVoiceEnabled(tonumber(voiceEnable) == 1)
- end
-
-
- function xichongRoomPlayerView:onClickHead(index)
- playBtnEffect()
- local nUserId = app.room.seatShowList[index]
- local memberInfo = app.room.roomInfo.memberList[nUserId]
- if memberInfo then
- local view = import("luaScript.Views.Room.RoomPlayerInfoViewNew"):new(nUserId, memberInfo.userInfo)
- view:setAnchorPoint(cc.p(0.5, 0.5))
- app:showWaitDialog(view, 0, true)
- end
- end
- ---
- -- 显示胡牌
- -- @param viewId
- -- @param isVisible
- -- @param huCard
- -- @return
- --
- function xichongRoomPlayerView:setHuCardVisible(viewId, isVisible, huCard)
- if not (self.allNodes and self.allNodes[viewId]) then
- return
- end
- if app.room.roomInfo.isZiMoHu ~= 1 then
- self.allNodes[viewId].huCardBg:setVisible(false)
- return
- end
-
- if not isVisible then
- self.allNodes[viewId].huCardBg:setVisible(false)
- return
- end
-
- if not huCard then
- self.allNodes[viewId].huCardBg:setVisible(false)
- return
- end
-
- self.allNodes[viewId].huCardBg:setVisible(true)
-
- local filename = ZPFuc.getZPCardImgByValue(huCard, ZPDef.CardType.CARD_TYPE_HAND, ZPDef.GameStyleType.JINGDIAN)
- self.allNodes[viewId].huCard:loadTextureFromPlist(filename)
-
- self:runDelay(3.0, function ()
- self.allNodes[viewId].huCardBg:setVisible(false)
- end)
-
- end
- ---
- -- 互动道具、语音开关变化处理
- -- @return
- --
- function xichongRoomPlayerView:onEventChatChangeEnable()
- self:initChatComponent()
- end
-
- return xichongRoomPlayerView
|