You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

638 lines
19 KiB

  1. -- 房间设置界面
  2. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  3. local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions")
  4. local ZPSound = ZPFramework.ZPImport("zp_base.luaScript.ZPSound")
  5. local ZPRoomPlayerView = class("ZPRoomPlayerView", cc.UIView)
  6. function ZPRoomPlayerView:ctor()
  7. ZPRoomPlayerView.super.ctor(self);
  8. end
  9. function ZPRoomPlayerView:loadUI()
  10. local ui = loadUI("zp_base/res/ui/ui_fangjian/zipai_ui_PlayerView.ui");
  11. self.ui = ui;
  12. self:addChild(ui);
  13. end
  14. function ZPRoomPlayerView:onEnter()
  15. ZPRoomPlayerView.super.onEnter(self)
  16. self:loadUI()
  17. --离线时间
  18. self.offLineTime = {}
  19. self.offLineTime[1] = 0
  20. self.offLineTime[2] = 0
  21. self.offLineTime[3] = 0
  22. self.offLineTime[4] = 0
  23. self.clockTime = 9
  24. self.clockTimeView = 0--闹钟所在的viewid
  25. --定时器
  26. if not self.Time then
  27. self.Time = cc.Director:getInstance():getScheduler():scheduleScriptFunc(function()
  28. for i=1,4 do
  29. self.offLineTime[i] = self.offLineTime[i] + 1
  30. if self.offLineTime[i] > 300 then--大于5分钟,恒定显示5分钟
  31. self.offLineTime[i] = 300
  32. end
  33. local time = os.date("%M:%S",self.offLineTime[i])
  34. if self.allNodes[i] and self.allNodes[i].offLineTime then
  35. self.allNodes[i].offLineTime:setText(time)
  36. end
  37. end
  38. self.clockTime = self.clockTime - 1
  39. if self.clockTime < 0 then
  40. self.clockTime = 0
  41. elseif self.clockTime == 0 then
  42. if self.clockTimeView and self.offLineTime[self.clockTimeView] then
  43. --self:setNoOpTime(true,self.clockTimeView)
  44. end
  45. end
  46. self:setClockTime(self.clockTime)
  47. end,1.0,false)
  48. end
  49. self:initPlayerNodes()
  50. self:initChatComponent()
  51. ZPFuc.loadSpriteFromFile("zp_base/res/ui/zy_fangjian/anim_bao.plist")
  52. end
  53. function ZPRoomPlayerView:onExit()
  54. ZPRoomPlayerView.super.onExit(self)
  55. --关闭定时器
  56. if self.Time then
  57. cc.Director:getInstance():getScheduler():unscheduleScriptEntry(self.Time)
  58. end
  59. end
  60. function ZPRoomPlayerView:initPlayerNodes()
  61. -- 玩家节点名称模板
  62. local names =
  63. {
  64. player = "Layout_player_%d", -- 头像绿圈根节点
  65. head = "ImageView_head_%d", -- 头像
  66. headBoarder = "ImageView_head_border_%d", --头像边
  67. name = "Text_Name_%d", -- 名字
  68. score = "TextBMFont_Score_%d", -- 总分数
  69. banker = "ImageView_banker_%d", -- 庄家
  70. owner = "ImageView_owner_%d", --房主
  71. readyState = "ImageView_ready_%d", -- 准备
  72. headInfo = "Layout_headInfo_%d", --个人信息点击触发框
  73. offLine = "ImageView_offLine_%d", --离线标志
  74. --其他节点
  75. tip = "ImageView_tip_%d", --提示操作图
  76. huxi = "TextBMFont_huxi_%d", --胡息
  77. clock = "ImageView_clock_%d", --闹钟
  78. txtClocl = "TextBMFont_clock_%d", --闹钟时间
  79. bao = "ImageView_bao_%d", --爆
  80. offLineTime = "Text_offLineTime_%d", --离线时间
  81. offLineTimeBg = "ImageView_txkYY_%d", --离线时间背景
  82. leftCardBg = "ImageView_LeftCardBg_%d", --剩余手牌背景
  83. leftCardNum = "TextBMFont_LeftCardNum_%d", --剩余手牌数量
  84. tuoguan = "ImageView_tuoguan_%d", --托管标志
  85. }
  86. self.allNodes = {}
  87. self.headSize = {}
  88. for i = 1,ZPDef.GameMaxPlayer do
  89. local nodes = {}
  90. --玩家根节点
  91. local namePlayer = string.format(names.player,i)
  92. local nodePlayer = self.ui.Items[namePlayer]
  93. nodes.player = nodePlayer
  94. --头像
  95. local nameHead = string.format(names.head,i)
  96. local nodeHead = self.ui.Items[nameHead]
  97. nodes.head = nodeHead
  98. nodeHead:setTouchEnabled(true)
  99. nodeHead:registerClick(function()
  100. self:onClickHead(i)
  101. end)
  102. local headBoarder = string.format(names.headBoarder,i)
  103. local nodeheadBoarder = self.ui.Items[headBoarder]
  104. nodes.headBoarder = nodeheadBoarder
  105. -- 需要记录头像的原始尺寸
  106. if not self.headSize.width then
  107. self.headSize.width = nodeHead:getContentSize().width
  108. self.headSize.height = nodeHead:getContentSize().height
  109. end
  110. --昵称
  111. local nickName = string.format(names.name,i)
  112. local nodeName = self.ui.Items[nickName]
  113. nodes.name = nodeName
  114. nodeName:setText("")
  115. --总分
  116. local nickScore = string.format(names.score,i)
  117. local nodeScore = self.ui.Items[nickScore]
  118. nodes.score = nodeScore
  119. --庄家
  120. local nameBanker = string.format(names.banker,i)
  121. local nodeBanker = self.ui.Items[nameBanker]
  122. nodes.banker = nodeBanker
  123. nodes.banker.pos = nodeBanker:getPosition()
  124. --房主
  125. local nameOwner = string.format(names.owner,i)
  126. local nodeOwner = self.ui.Items[nameOwner]
  127. nodes.owner = nodeOwner
  128. nodes.owner.pos = nodeOwner:getPosition()
  129. --准备
  130. local nameReadyState = string.format(names.readyState,i)
  131. local nodeReadyState = self.ui.Items[nameReadyState]
  132. nodes.readyState = nodeReadyState
  133. --头像信息
  134. local headInfo = string.format(names.headInfo,i)
  135. local nodeheadInfo = self.ui.Items[headInfo]
  136. nodes.headInfo = nodeheadInfo
  137. --离线信息
  138. local offLine = string.format(names.offLine,i)
  139. local nodeoffLine = self.ui.Items[offLine]
  140. nodes.offLine = nodeoffLine
  141. --tip
  142. local nameTip = string.format(names.tip,i)
  143. local nodeTip = self.ui.Items[nameTip]
  144. nodes.tip = nodeTip
  145. --胡息
  146. local nameHuxi = string.format(names.huxi,i)
  147. local nodeHuxi = self.ui.Items[nameHuxi]
  148. nodes.huxi = nodeHuxi
  149. --爆
  150. local nameBao = string.format(names.bao,i)
  151. local nodeBao = self.ui.Items[nameBao]
  152. nodes.bao = nodeBao
  153. --闹钟
  154. local nameClock = string.format(names.clock,i)
  155. local nodeClock = self.ui.Items[nameClock]
  156. nodes.clock = nodeClock
  157. --闹钟时间
  158. local nametxtClock = string.format(names.txtClocl,i)
  159. local nodetxtClock = self.ui.Items[nametxtClock]
  160. nodes.txtclock = nodetxtClock
  161. --离线时间
  162. local nameoffLineTime = string.format(names.offLineTime,i)
  163. local nodeoffLineTime = self.ui.Items[nameoffLineTime]
  164. nodes.offLineTime = nodeoffLineTime
  165. --离线时间背景
  166. local nameoffLineTimeBg = string.format(names.offLineTimeBg,i)
  167. local nodeoffLineTimeBg = self.ui.Items[nameoffLineTimeBg]
  168. nodes.offLineTimeBg = nodeoffLineTimeBg
  169. nodes.offLineTimeBg:setVisible(false)
  170. --剩余手牌背景
  171. local nameleftCardBg = string.format(names.leftCardBg,i)
  172. local nodeleftCardBg = self.ui.Items[nameleftCardBg]
  173. nodes.leftCardBg = nodeleftCardBg
  174. --剩余手牌数量
  175. local nameleftCardNum = string.format(names.leftCardNum,i)
  176. local nodeleftCardNum = self.ui.Items[nameleftCardNum]
  177. nodes.leftCardNum = nodeleftCardNum
  178. --托管状态
  179. local nametuoguan = string.format(names.tuoguan,i)
  180. local nodetuoguan = self.ui.Items[nametuoguan]
  181. nodes.tuoguan = nodetuoguan
  182. self.allNodes[i] = nodes
  183. end
  184. self:setAllClockVisible(false)
  185. self:setOwnerVisible()
  186. self:stopAndHideBaoAnim()
  187. self:setXiaoJiaFlagVis(false)
  188. self:hideLeftCard()--隐藏剩余牌
  189. --小家不显示胡数
  190. self.ui.Items.ImageView_hushu_2:setVisible(false)
  191. self.ui.Items.TextBMFont_huxi_2:setVisible(false)
  192. end
  193. ---
  194. -- 初始化聊天窗口
  195. -- @return
  196. --
  197. function ZPRoomPlayerView:initChatComponent()
  198. if self.chatComponentView and not tolua.isnull(self.chatComponentView) then
  199. return
  200. end
  201. local heads = {}
  202. for i = 1, ZPDef.GameMaxPlayer do
  203. heads[i] = self.allNodes[i].head
  204. end
  205. self.chatComponentView = import("luaScript.Views.Room.RoomChatComponentView"):new(heads, ZPDef.ChatTxt, nil)
  206. local voiceEnable = tonumber(loadUserInfo("voiceEnable")) or 1
  207. local propEnable = tonumber(loadUserInfo("propEnable")) or 1
  208. self.chatComponentView:setVoiceEnabled(voiceEnable==1)
  209. self.chatComponentView:setPropEnabled(propEnable==1)
  210. self:addChild(self.chatComponentView)
  211. end
  212. --设置小家标志显示
  213. function ZPRoomPlayerView:setXiaoJiaFlagVis(vis)
  214. self.ui.Items.ImageView_xiaojia:setVisible(vis)
  215. end
  216. --设置胡息归0
  217. function ZPRoomPlayerView:setHuXizero()
  218. for i = 1,ZPDef.GameMaxPlayer do
  219. if self.allNodes[i] and self.allNodes[i].huxi then
  220. self.allNodes[i].huxi:setText("0")
  221. end
  222. end
  223. end
  224. --初始化飘分按钮文字和飘分背景显示
  225. function ZPRoomPlayerView:initPlayerPiaoFenByRule()
  226. for i = 1,ZPDef.GameMaxPlayer do
  227. if self.allNodes[i] and self.allNodes[i].piaofenBg then
  228. self.allNodes[i].piaofenBg:setVisible(false)
  229. end
  230. end
  231. end
  232. --设置某个玩家飘分
  233. function ZPRoomPlayerView:setPlayerPiaoFen(viewId,strScore)
  234. if self.allNodes[viewId] and self.allNodes[viewId].piaofen then
  235. self.allNodes[viewId].piaofen:setText(tostring(strScore).."分")
  236. end
  237. end
  238. --设置某个玩家胡息
  239. function ZPRoomPlayerView:setPlayerHuXi(viewId,huxi)
  240. if self.allNodes[viewId] and self.allNodes[viewId].huxi then
  241. self.allNodes[viewId].huxi:setText(tostring(huxi))
  242. end
  243. end
  244. --设置某个玩家分数
  245. function ZPRoomPlayerView:setPlayerScore(viewId,strScore)
  246. if self.allNodes[viewId] and self.allNodes[viewId].score then
  247. self.allNodes[viewId].score:setText(tostring(strScore))
  248. end
  249. end
  250. --设置准备状态按钮
  251. function ZPRoomPlayerView:setReadyStateVisible(bVisible)
  252. for i = 1,ZPDef.GameMaxPlayer do
  253. self.allNodes[i].readyState:setVisible(bVisible)
  254. end
  255. end
  256. --设置某个玩家准备状态显示
  257. function ZPRoomPlayerView:setPlayerReadyState(viewId,bVisible)
  258. if self.allNodes[viewId] and self.allNodes[viewId].readyState then
  259. self.allNodes[viewId].readyState:setVisible(bVisible)
  260. end
  261. end
  262. --隐藏庄家
  263. function ZPRoomPlayerView:setBankerVisible()
  264. for i = 1,ZPDef.GameMaxPlayer do
  265. self.allNodes[i].banker:setVisible(false)
  266. end
  267. end
  268. --设置某个庄家Visible
  269. function ZPRoomPlayerView:setPlayerBankerVisible(viewId,bVisible)
  270. if self.allNodes[viewId] then
  271. self.allNodes[viewId].banker:setVisible(bVisible)
  272. return true
  273. end
  274. return false
  275. end
  276. --隐藏房主
  277. function ZPRoomPlayerView:setOwnerVisible()
  278. for i = 1,ZPDef.GameMaxPlayer do
  279. self.allNodes[i].owner:setVisible(false)
  280. end
  281. end
  282. --设置某个房主Visible
  283. function ZPRoomPlayerView:setPlayerOwnerVisible(viewId,bVisible)
  284. if self.allNodes[viewId] then
  285. self.allNodes[viewId].owner:setVisible(bVisible)
  286. return true
  287. end
  288. return false
  289. end
  290. --隐藏提示
  291. function ZPRoomPlayerView:setOperatorTipVisible(bVisible)
  292. for i = 1,ZPDef.GameMaxPlayer do
  293. self.allNodes[i].tip:setVisible(bVisible)
  294. end
  295. end
  296. --隐藏玩家
  297. function ZPRoomPlayerView:setPlayerVisible(bVisible)
  298. for i = 1,ZPDef.GameMaxPlayer do
  299. self.allNodes[i].player:setVisible(bVisible)
  300. end
  301. end
  302. --隐藏离线
  303. function ZPRoomPlayerView:setOffLine(bVisible)
  304. for i = 1,ZPDef.GameMaxPlayer do
  305. self.allNodes[i].offLine:setVisible(bVisible)
  306. end
  307. end
  308. --隐藏离线
  309. function ZPRoomPlayerView:setPlayerOffLine(bVisible,viewId)
  310. --[[if not viewId or viewId > ZPDef.GameMaxPlayer or not self.allNodes[viewId] then
  311. return
  312. end--]]
  313. if viewId and self.allNodes[viewId] then
  314. self.allNodes[viewId].offLine:setVisible(bVisible)
  315. --头像变灰
  316. self.allNodes[viewId].head:setGreyEnabled(bVisible)
  317. self.allNodes[viewId].headBoarder:setGreyEnabled(bVisible)
  318. if app.room.offLineTime and next(app.room.offLineTime) ~= nil then
  319. local nUserId = app.room:getUserIdByViewId(viewId)
  320. if app.room.offLineTime[nUserId] then
  321. self.offLineTime[viewId] = app.room.offLineTime[nUserId]
  322. else
  323. self.offLineTime[viewId] = 0
  324. end
  325. else
  326. self.offLineTime[viewId] = 0
  327. end
  328. if app.gameId == GAME_IDS.luzhouDaEr then--暂时泸州大贰加倒计时
  329. self.allNodes[viewId].offLineTimeBg:setVisible(bVisible)
  330. else
  331. self.allNodes[viewId].offLineTimeBg:setVisible(false)
  332. end
  333. end
  334. end
  335. --设置用户没有操作的时间
  336. function ZPRoomPlayerView:setNoOpTime(bVisible,viewId)
  337. if true then--app.gameId ~= GAME_IDS.luzhouDaEr then
  338. return
  339. end
  340. if viewId and self.allNodes[viewId] then
  341. if app.room.offLineTime and next(app.room.offLineTime) ~= nil then
  342. local nUserId = app.room:getUserIdByViewId(viewId)
  343. if app.room.offLineTime[nUserId] then
  344. self.offLineTime[viewId] = app.room.offLineTime[nUserId]
  345. else
  346. self.offLineTime[viewId] = 0
  347. end
  348. else
  349. self.offLineTime[viewId] = 0
  350. end
  351. if app.gameId == GAME_IDS.luzhouDaEr then--暂时泸州大贰加倒计时
  352. local time = os.date("%M:%S",self.offLineTime[viewId]) or "00:00"
  353. self.allNodes[viewId].offLineTime:setText(time)
  354. self.allNodes[viewId].offLineTimeBg:setVisible(bVisible)
  355. else
  356. self.allNodes[viewId].offLineTimeBg:setVisible(false)
  357. end
  358. end
  359. end
  360. --用户行为提示
  361. function ZPRoomPlayerView:showOperatorTip(viewId,mType)
  362. local tip = self.allNodes[viewId].tip
  363. local time = 1.3
  364. tip:setVisible(true)
  365. local count = 0
  366. if mType == ZPDef.OpType.OP_TYPE_CANCEL then
  367. tip:loadTextureFromPlist(ZPDef.TipFile.GUO)
  368. elseif mType == ZPDef.OpType.OP_TYPE_ANWEI then
  369. tip:loadTextureFromPlist(ZPDef.TipFile.ANWEI)
  370. elseif mType == ZPDef.OpType.OP_TYPE_CHI then
  371. tip:loadTextureFromPlist(ZPDef.TipFile.CHI)
  372. elseif mType == ZPDef.OpType.OP_TYPE_BI then
  373. tip:loadTextureFromPlist(ZPDef.TipFile.BIPAI)
  374. elseif mType == ZPDef.OpType.OP_TYPE_PENG then
  375. tip:loadTextureFromPlist(ZPDef.TipFile.PENG)
  376. elseif mType == ZPDef.OpType.OP_TYPE_MINGWEI then
  377. tip:loadTextureFromPlist(ZPDef.TipFile.MINGWEI)
  378. elseif mType == ZPDef.OpType.OP_TYPE_PAO then
  379. tip:loadTextureFromPlist(ZPDef.TipFile.ZHAO)
  380. elseif mType == ZPDef.OpType.OP_TYPE_CHONG_PAO then
  381. --tip:setVisible(false)
  382. tip:loadTextureFromPlist(ZPDef.TipFile.ZHAO)
  383. elseif mType == ZPDef.OpType.OP_TYPE_TI then
  384. tip:loadTextureFromPlist(ZPDef.TipFile.LONG)
  385. elseif mType == ZPDef.OpType.OP_TYPE_HU then
  386. time = 2.0
  387. if app.room.roomInfo.huType and app.room.roomInfo.huType >= 0 then
  388. local name = string.format(ZPDef.TipFile.HU,app.room.roomInfo.huType)
  389. tip:loadTextureFromPlist(name)
  390. end
  391. elseif mType == -55 then--单独处理爆牌动画
  392. tip:loadTextureFromPlist(ZPDef.TipFile.BAO)
  393. end
  394. --音效
  395. local userInfo=app.room:getUserInfo(app.user.loginInfo.uid)
  396. if userInfo then
  397. ZPSound.PlayOperateSound(userInfo.sex,mType)
  398. end
  399. tip:setScale(3.0)
  400. local seq = cc.Sequence:create(cc.ScaleTo:create(0.2,1),cc.DelayTime:create(time),cc.CallFunc:create(function ()
  401. tip:setVisible(false)
  402. end))
  403. tip:runAction(seq)
  404. end
  405. -- 更新玩家基本信息 : 昵称、头像
  406. -- index :是玩家展示出来的座位号
  407. function ZPRoomPlayerView:updatePlayerInfo(index)
  408. logE("ZPRoomView:updatePlayerInfo() index = ", index)
  409. local nodes = self.allNodes[index]
  410. if not nodes then return end
  411. local nUserId = app.room.seatShowList[index]
  412. local roomInfo = app.room.roomInfo
  413. local memberInfo = app.room.roomInfo.memberList[nUserId]
  414. if nUserId and app.room:checkUserIDIsInTable(nUserId) then--memberInfo and memberInfo.userInfo then
  415. nodes.player:setVisible(true)
  416. local userInfo = json.decode(memberInfo.userInfo)
  417. if not userInfo then
  418. return
  419. end
  420. -- 玩家名字
  421. local nickname = userInfo.nickname
  422. nickname = getSubStringNickname(nickname)
  423. nodes.name:setText(tostring(nickname))
  424. nodes.score:setText(tostring(memberInfo.nTotalMoney))
  425. -- 玩家头像
  426. local nodeHead = nodes.head;
  427. --先设置默认头像
  428. local width = nodeHead:getContentSize().width
  429. setPlayerHeadImage(nUserId, userInfo.headimgurl, nodeHead)
  430. if app.room.offLineUid[tonumber(nUserId)] or (memberInfo.nOnlineStatus and memberInfo.nOnlineStatus~=1) then
  431. self:setPlayerOffLine(true,index)
  432. else
  433. self:setPlayerOffLine(false,index)
  434. end
  435. else
  436. nodes.player:setVisible(false)
  437. end
  438. end
  439. function ZPRoomPlayerView:getPlayerPosByViewId(view)
  440. if self.allNodes[view] and self.allNodes[view].player then
  441. return self.allNodes[view].player:getPosition()
  442. end
  443. end
  444. function ZPRoomPlayerView:stopAndHideBaoAnim()
  445. for i=1,4 do
  446. if self.allNodes[i] and self.allNodes[i].bao then
  447. self.allNodes[i].bao:setVisible(false)
  448. self.allNodes[i].bao:removeAllChildren()
  449. end
  450. end
  451. end
  452. function ZPRoomPlayerView:playBaoAnim(view)
  453. if self.allNodes[view] and self.allNodes[view].bao then
  454. self.allNodes[view].bao:setVisible(true)
  455. -- 加载第一张图片
  456. local nodeImage = cc.ImageView:createNode()
  457. nodeImage:loadTexture(string.format("anim_bao_%d",1))
  458. self.allNodes[view].bao:addChild(nodeImage)
  459. local baoSize = self.allNodes[view].bao:getContentSize()
  460. nodeImage:setPosition(cc.p(baoSize.width/2-1,baoSize.height/2-2))
  461. -- 循环修改图片
  462. local everyFrame = 0.1
  463. local indexFace = 0
  464. local indexMax = 7
  465. local action1 = cc.Sequence:create(cc.DelayTime:create(everyFrame),cc.CallFunc:create(function ()
  466. indexFace = indexFace + 1
  467. if 0 < indexFace and indexFace <= indexMax then
  468. else
  469. indexFace = 1
  470. end
  471. local name = string.format("anim_bao_%d.png",indexFace)
  472. if not tolua.isnull(nodeImage) then
  473. nodeImage:loadTexture(name, cc.TextureResType.plistType)
  474. end
  475. end))
  476. local action2 = cc.Repeat:create(action1, indexMax)
  477. nodeImage:stopAllActions()
  478. --nodeImage:runAction(action2)
  479. nodeImage:runAction(cc.RepeatForever:create(action2));
  480. nodeImage:setVisible(true)
  481. end
  482. end
  483. --设置所有闹钟隐藏
  484. function ZPRoomPlayerView:setAllClockVisible(vis)
  485. for i=1,4 do
  486. if self.allNodes[i] and self.allNodes[i].clock then
  487. self.allNodes[i].clock:setVisible(vis)
  488. end
  489. end
  490. end
  491. --设置闹钟可见
  492. function ZPRoomPlayerView:setPClockVisible(viewId,bVisible)
  493. self.clockTime = 9
  494. self.clockTimeView = viewId
  495. self:setClockTime(self.clockTime)
  496. self:setAllClockVisible(false)
  497. if self.allNodes[viewId] and self.allNodes[viewId].clock then
  498. self.allNodes[viewId].clock:setVisible(bVisible)
  499. end
  500. end
  501. --重置闹钟时间
  502. function ZPRoomPlayerView:reSetClockTime(viewId)
  503. if viewId == self.clockTimeView then
  504. self.clockTime = 9
  505. end
  506. end
  507. --设置闹钟时间
  508. function ZPRoomPlayerView:setClockTime(num)
  509. for i=1,4 do
  510. if self.allNodes[i] and self.allNodes[i].txtclock then
  511. self.allNodes[i].txtclock:setText(num)
  512. end
  513. end
  514. end
  515. --隐藏剩余牌
  516. function ZPRoomPlayerView:hideLeftCard()
  517. for i=1,4 do
  518. if self.allNodes[i] and self.allNodes[i].leftCardBg then
  519. self.allNodes[i].leftCardBg:setVisible(false)
  520. self.allNodes[i].leftCardNum:setVisible(false)
  521. end
  522. end
  523. end
  524. --设置显示剩余手牌
  525. function ZPRoomPlayerView:setLeftCardNum(viewId,bVisible,num)
  526. if app.gameId ~= GAME_IDS.luzhouDaEr then return end
  527. if bVisible and bVisible == true then
  528. if self.allNodes[viewId] and self.allNodes[viewId].leftCardNum then
  529. self.allNodes[viewId].leftCardBg:setVisible(bVisible)
  530. self.allNodes[viewId].leftCardNum:setVisible(bVisible)
  531. self.allNodes[viewId].leftCardNum:setText(num)
  532. end
  533. end
  534. end
  535. --修改剩余首牌显示
  536. function ZPRoomPlayerView:changeLeftCardNum(viewId,num)--在原来的基础上改变num张牌
  537. if self.allNodes[viewId] and self.allNodes[viewId].leftCardNum then
  538. local cardnum = self.allNodes[viewId].leftCardNum:getString()
  539. self.allNodes[viewId].leftCardNum:setText(tonumber(cardnum)+num)
  540. end
  541. end
  542. --托管标签状态显示
  543. function ZPRoomPlayerView:setTuoGuanFlagVisible(flag)
  544. flag = flag or false
  545. for i = 1,4 do
  546. if self.allNodes[i] and self.allNodes[i].tuoguan then
  547. self.allNodes[i].tuoguan:setVisible(flag)
  548. end
  549. end
  550. end
  551. function ZPRoomPlayerView:showTuoGuanByViewId(viewId,bVisible)
  552. if not viewId then return end
  553. bVisible = bVisible or false
  554. if self.allNodes[viewId] and self.allNodes[viewId].tuoguan then
  555. self.allNodes[viewId].tuoguan:setVisible(bVisible)
  556. end
  557. end
  558. function ZPRoomPlayerView:onClickHead(index)
  559. playBtnEffect()
  560. local nUserId = app.room.seatShowList[index]
  561. local memberInfo = app.room.roomInfo.memberList[nUserId]
  562. if memberInfo then
  563. local view = import("luaScript.Views.Room.RoomPlayerInfoViewNew"):new(nUserId, memberInfo.userInfo)
  564. view:setAnchorPoint(cc.p(0.5, 0.5))
  565. app:showWaitDialog(view, 0, true)
  566. end
  567. end
  568. return ZPRoomPlayerView;