25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
19 KiB

  1. local Functions = require("pk_nanchongdoudizhu.luaScript.Functions_53")
  2. local defs = require("pk_nanchongdoudizhu.luaScript.Def_53")
  3. -- 房间设置界面
  4. local RoomPlayerView_53 = class("RoomPlayerView_53", cc.UIView)
  5. function RoomPlayerView_53:ctor()
  6. RoomPlayerView_53.super.ctor(self)
  7. end
  8. function RoomPlayerView_53:onEnter()
  9. RoomPlayerView_53.super.onEnter(self)
  10. local ui = loadUI("pk_nanchongdoudizhu/res/ui/ui_fangjian/doudizhu_ui_PlayerView.ui")
  11. self:addChild(ui)
  12. self.ui = ui
  13. --默认隐藏玩家头像
  14. for i = 1, 4 do
  15. local player = self.ui.Items["Layout_Player_" .. i]
  16. if player then
  17. player:setVisible(false)
  18. end
  19. end
  20. self:initChatComponent()
  21. end
  22. function RoomPlayerView_53:initChatComponent()
  23. if self.chatComponentView and not tolua.isnull(self.chatComponentView) then
  24. return
  25. end
  26. local heads = {
  27. -- [1] = self.allNodes[1].head,
  28. -- [2] = self.allNodes[2].head,
  29. -- [3] = self.allNodes[3].head,
  30. -- [4] = self.allNodes[4].head,
  31. }
  32. for i = 1, 4 do
  33. local head = self.ui.Items["Image_Head_" .. i]
  34. if head then
  35. table.insert(heads, head)
  36. end
  37. end
  38. self.chatComponentView = import("luaScript.Views.Room.RoomChatComponentView"):new(heads, defs.GAME_CHAT_TXT)
  39. local voiceEnable = tonumber(loadUserInfo("PingBiYuYinKG" .. app.gameId)) or 1
  40. local propEnable = tonumber(loadUserInfo("HuDongBiaoQingKG" .. app.gameId)) or 1
  41. self.chatComponentView:setVoiceEnabled(voiceEnable==1)
  42. self.chatComponentView:setPropEnabled(propEnable==1)
  43. self:addChild(self.chatComponentView)
  44. end
  45. function RoomPlayerView_53:ontSetPropEnabled()
  46. local propEnable = tonumber(loadUserInfo("HuDongBiaoQingKG" .. app.gameId)) or 1
  47. self.chatComponentView:setPropEnabled(propEnable==1)
  48. end
  49. function RoomPlayerView_53:onSetVoiceEnabled()
  50. local voiceEnable = tonumber(loadUserInfo("PingBiYuYinKG" .. app.gameId)) or 1
  51. self.chatComponentView:setVoiceEnabled(voiceEnable==1)
  52. end
  53. function RoomPlayerView_53:getPlayerData(type, viewId)
  54. local player = self.ui.Items["Layout_Player_" .. viewId]
  55. if player then
  56. if type == "sex" then
  57. return player.userInfo.sex
  58. end
  59. end
  60. return nil
  61. end
  62. --刷新玩家
  63. function RoomPlayerView_53:updatePlayer(playerInfo, viewId)
  64. if playerInfo then
  65. self:initPlayer(playerInfo, viewId)
  66. else
  67. for _,v in pairs(app.room.roomInfo.memberList) do
  68. self:initPlayer(v, app.room:getViewIdByUserId(v.nUserId))
  69. end
  70. end
  71. end
  72. --更新玩家信息
  73. function RoomPlayerView_53:initPlayer(playerInfo, viewId)
  74. logE("RoomPlayerView_53 initPlayer viewId : " .. viewId)
  75. logE("RoomPlayerView_53 initPlayer playerInfo : " .. table.tostring(playerInfo))
  76. local player = self.ui.Items["Layout_Player_" .. viewId]
  77. if player then
  78. player:setVisible(true)
  79. local userInfo = json.decode(playerInfo.userInfo)
  80. player.playerInfo = playerInfo
  81. player.userInfo = userInfo
  82. --头像
  83. local head = self.ui.Items["Image_Head_" .. viewId]
  84. setDefaultHeadImg(userInfo.sex, playerInfo.nUserId, head, head:getContentSize().width)
  85. setPlayerHeadImage(playerInfo.nUserId, userInfo.headimgurl, head)
  86. head:registerClick(function()
  87. self:onClickHead(viewId)
  88. end)
  89. --名字
  90. local nickname = userInfo.nickname or "error"
  91. self.ui.Items["Text_Name_" .. viewId]:setText(nickname)
  92. --分数
  93. local nTotalScore = playerInfo.nTotalScore or 0
  94. self.ui.Items["Text_Score_" .. viewId]:setText(nTotalScore)
  95. --庄家
  96. local nBankerId = app.room.roomInfo.nBankerId or 0
  97. self.ui.Items["Image_Banker_" .. viewId]:setVisible(nBankerId == playerInfo.nUserId)
  98. --离线 (0:离线、1:在线)
  99. local nOnlineStatus = playerInfo.nOnlineStatus or 1
  100. self.ui.Items["Image_OffLine_" .. viewId]:setVisible(nOnlineStatus == 0)
  101. --头像变灰
  102. self:setHeadGreyEnabled(nOnlineStatus == 0, viewId)
  103. --准备 (0:未准备、1:已准备)
  104. local nPlayerFlag = playerInfo.nPlayerFlag or 0
  105. self.ui.Items["Image_Ready_" .. viewId]:setVisible(nPlayerFlag == 1)
  106. --加倍
  107. local askBei = playerInfo.askBei or 0
  108. self.ui.Items["Image_AskBei_" .. viewId]:setVisible(askBei == 1)
  109. --闹钟
  110. self.ui.Items["Image_Clock_" .. viewId]:setVisible(false)
  111. --请让我再想想
  112. self.ui.Items["Image_Pop_" .. viewId]:setVisible(false)
  113. -- 头像框
  114. self.ui.Items["Image_HeadMask_" .. viewId]:setVisible(false)
  115. -- 漂
  116. self.ui.Items['Layout_Piao_' .. viewId]:setVisible(false)
  117. -- 倒or拉
  118. self.ui.Items['Layout_DaoOrLa_' .. viewId]:setVisible(false)
  119. -- 定漂中
  120. self.ui.Items['Image_ChoosePiao_' .. viewId]:setVisible(false)
  121. --剩余牌
  122. local leftNumText = self.ui.Items["Text_LeftNum_" .. viewId]
  123. local leftNumImage = self.ui.Items["Image_LeftNum_" .. viewId]
  124. if leftNumText then
  125. leftNumText:setVisible(false)
  126. end
  127. if leftNumImage then
  128. leftNumImage:setVisible(false)
  129. end
  130. self.ui.Items['Layout_Head_Tip_' .. viewId]:requestDoLayout()
  131. self.ui.Items['Layout_Head_Tip_' .. viewId]:doLayout()
  132. end
  133. end
  134. function RoomPlayerView_53:onClickHead(index)
  135. playBtnEffect()
  136. local nUserId = app.room.seatShowList[index]
  137. local memberInfo = app.room.roomInfo.memberList[nUserId]
  138. if memberInfo then
  139. local view = import("luaScript.Views.Room.RoomPlayerInfoViewNew"):new(nUserId, memberInfo.userInfo)
  140. view:setAnchorPoint(cc.p(0.5, 0.5))
  141. app:showWaitDialog(view, 0, true)
  142. end
  143. end
  144. --隐藏玩家
  145. function RoomPlayerView_53:hidePlayer(viewId)
  146. local player = self.ui.Items["Layout_Player_" .. viewId]
  147. logE("RoomPlayerView_53 hidePlayer viewId : " .. viewId)
  148. if player then
  149. player:setVisible(false)
  150. end
  151. end
  152. --刷新分数
  153. function RoomPlayerView_53:updateScore(viewId, totalScore)
  154. local score = self.ui.Items["Text_Score_" .. viewId]
  155. logE("RoomPlayerView_53 updateScore viewId : " .. viewId)
  156. if score then
  157. score:setText("" .. totalScore)
  158. end
  159. end
  160. --显隐剩余牌
  161. function RoomPlayerView_53:setLeftNumVisible(bVisible, viewId, num)
  162. --是否是回放
  163. if app.room.roomInfo.isRecord then
  164. return
  165. end
  166. -- 剩余牌
  167. local isNotShowLeftNumCard = false
  168. logE("RoomPlayerView_53 setReadyVisible bVisible : " .. (bVisible and 1 or 0))
  169. logE("RoomPlayerView_53 setReadyVisible viewId : " .. (viewId and viewId or -1))
  170. logE("RoomPlayerView_53 setReadyVisible num : " .. (num and num or -1))
  171. if not isNotShowLeftNumCard then
  172. -- 显示剩余牌
  173. if viewId == -1 then
  174. for i = 1, 4 do
  175. local leftNumText = self.ui.Items["Text_LeftNum_" .. i]
  176. local leftNumImage = self.ui.Items["Image_LeftNum_" .. i]
  177. if leftNumText then
  178. leftNumText:setVisible(bVisible)
  179. if bVisible then
  180. leftNumText:setText("" .. num)
  181. end
  182. end
  183. if leftNumImage then
  184. leftNumImage:setVisible(bVisible)
  185. end
  186. end
  187. else
  188. local leftNumText = self.ui.Items["Text_LeftNum_" .. viewId]
  189. local leftNumImage = self.ui.Items["Image_LeftNum_" .. viewId]
  190. if leftNumText then
  191. leftNumText:setVisible(bVisible)
  192. if bVisible then
  193. leftNumText:setText("" .. num)
  194. end
  195. end
  196. if leftNumImage then
  197. leftNumImage:setVisible(bVisible)
  198. end
  199. end
  200. end
  201. -- 显示闹钟
  202. if viewId == -1 then
  203. self:cleanAllBaoJing()
  204. else
  205. if num == 1 or num == 2 then
  206. self:showBaoJingAni(viewId)
  207. Functions.playLastNumVoice(num, self:getPlayerData('sex', viewId))
  208. else
  209. self:showBaoJingAni(viewId, true)
  210. end
  211. end
  212. end
  213. --显隐准备
  214. function RoomPlayerView_53:setReadyVisible(bVisible, viewId)
  215. local ready = self.ui.Items["Image_Ready_" .. viewId]
  216. logE("RoomPlayerView_53 showReady viewId : " .. viewId)
  217. if ready then
  218. ready:setVisible(bVisible)
  219. end
  220. end
  221. function RoomPlayerView_53:getChatViewPos()
  222. local headInfos = {}
  223. for i = 1, 4 do
  224. local head = self.ui.Items["Image_Head_" .. i]
  225. local player = self.ui.Items["Layout_Player_" .. i]
  226. if head and player then
  227. table.insert(headInfos, {headPos = cc.pAdd(cc.pAdd(player:getPosition(), head:getPosition()), cc.p(0, 0))})
  228. end
  229. end
  230. return headInfos
  231. end
  232. function RoomPlayerView_53:setOffLineVisible(bVisible, viewId)
  233. local offLine = self.ui.Items["Image_OffLine_" .. viewId]
  234. if offLine then
  235. offLine:setVisible(bVisible)
  236. --头像变灰
  237. self:setHeadGreyEnabled(bVisible, viewId)
  238. end
  239. end
  240. function RoomPlayerView_53:setHeadGreyEnabled(bVisible, viewId)
  241. local head = self.ui.Items["Image_Head_" .. viewId]
  242. local headMask = self.ui.Items["Image_HeadMask_" .. viewId]
  243. if head and headMask then
  244. head:setGreyEnabled(bVisible)
  245. headMask:setGreyEnabled(bVisible)
  246. end
  247. end
  248. function RoomPlayerView_53:bankerAni(viewId)
  249. local banker = self.ui.Items["Image_Banker_" .. viewId]
  250. if banker then
  251. banker:stopAllActions()
  252. banker:runAction(
  253. cc.Sequence:create(
  254. cc.ScaleTo(0, 2)
  255. )
  256. )
  257. end
  258. end
  259. function RoomPlayerView_53:setBankerVisible(bVisible, viewId)
  260. local banker = self.ui.Items["Image_Banker_" .. viewId]
  261. if banker then
  262. banker:setVisible(bVisible)
  263. end
  264. end
  265. function RoomPlayerView_53:setClockVisibel(bVisible, viewId, times)
  266. local clock = self.ui.Items["Image_Clock_" .. viewId]
  267. if clock then
  268. clock:setVisible(bVisible)
  269. local imagePop = self.ui.Items["Image_Pop_" .. viewId]
  270. if imagePop then
  271. imagePop:setVisible(false)
  272. end
  273. local time = self.ui.Items["Text_Clock_" .. viewId]
  274. time:stopAllActions()
  275. if bVisible then
  276. local timesEx = times
  277. time:runAction(
  278. cc.RepeatForever:create(
  279. cc.Sequence:create(
  280. cc.CallFunc:create(function()
  281. time:setText("" .. timesEx)
  282. timesEx = timesEx - 1
  283. if timesEx < 5 then
  284. -- imagePop:setVisible(true)
  285. if timesEx < 0 then
  286. time:stopAllActions()
  287. end
  288. end
  289. end),
  290. cc.DelayTime:create(1.0)
  291. )
  292. )
  293. )
  294. end
  295. end
  296. end
  297. function RoomPlayerView_53:setTipsVisible(tipsType, bVisible, viewId, data)
  298. --显示锚点设置
  299. local anchorPont = {
  300. [1] = cc.p(1, 0.5),
  301. [2] = cc.p(0.5, 0.5),
  302. [3] = cc.p(0, 0.5),
  303. [4] = cc.p(0.5, 0.5),
  304. }
  305. local tipsFunc = {}
  306. -- 漂
  307. tipsFunc["tips_piao"] = function(nodeParent)
  308. local tips = nodeParent["tips_piao"]
  309. if tips then
  310. tips:removeFromParent()
  311. nodeParent["tips_piao"] = nil
  312. end
  313. if bVisible then
  314. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_piao.png"
  315. if data.piaoState ~= defs.PIAO_STATE.PIAO_STATE_YES then
  316. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_bupiao.png"
  317. end
  318. local tipsEx = cc.Sprite:create(string.format(str))
  319. if tipsEx then
  320. tipsEx:setAnchorPoint(anchorPont[viewId])
  321. nodeParent["tips_piao"] = tipsEx
  322. nodeParent:addChild(tipsEx)
  323. end
  324. self:setPiaoVisible(viewId, data.piaoState == defs.PIAO_STATE.PIAO_STATE_YES)
  325. end
  326. end
  327. --闷抓
  328. tipsFunc["tips_menzhua"] = function(nodeParent)
  329. local tips = nodeParent["tips_menzhua"]
  330. if tips then
  331. tips:removeFromParent()
  332. nodeParent["tips_menzhua"] = nil
  333. end
  334. if bVisible then
  335. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_menzhua.png"
  336. if data.menzhua ~= defs.MEN_STATE.MEN_STATE_ZHUAI then
  337. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_pass.png"
  338. end
  339. local tipsEx = cc.Sprite:create(string.format(str))
  340. if tipsEx then
  341. tipsEx:setAnchorPoint(anchorPont[viewId])
  342. nodeParent["tips_menzhua"] = tipsEx
  343. nodeParent:addChild(tipsEx)
  344. end
  345. end
  346. end
  347. --闷倒
  348. tipsFunc["tips_mendao"] = function(nodeParent)
  349. local tips = nodeParent["tips_mendao"]
  350. if tips then
  351. tips:removeFromParent()
  352. nodeParent["tips_mendao"] = nil
  353. end
  354. if bVisible then
  355. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_mendao.png"
  356. if data.mendao ~= defs.MEN_STATE.MEN_STATE_DAO then
  357. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_pass.png"
  358. end
  359. local tipsEx = cc.Sprite:create(string.format(str))
  360. if tipsEx then
  361. tipsEx:setAnchorPoint(anchorPont[viewId])
  362. nodeParent["tips_mendao"] = tipsEx
  363. nodeParent:addChild(tipsEx)
  364. end
  365. -- self:setDaoOrLaVisible(viewId, data.mendao == defs.MEN_STATE.MEN_STATE_DAO, 'dao')
  366. end
  367. end
  368. --闷拉
  369. tipsFunc["tips_menla"] = function(nodeParent)
  370. local tips = nodeParent["tips_menla"]
  371. if tips then
  372. tips:removeFromParent()
  373. nodeParent["tips_menla"] = nil
  374. end
  375. if bVisible then
  376. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_menla.png"
  377. if data.menla ~= defs.MEN_LA_STATE.MEN_STATE_LA_ZHUAI then
  378. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_pass.png"
  379. end
  380. local tipsEx = cc.Sprite:create(string.format(str))
  381. if tipsEx then
  382. tipsEx:setAnchorPoint(anchorPont[viewId])
  383. nodeParent["tips_menla"] = tipsEx
  384. nodeParent:addChild(tipsEx)
  385. end
  386. -- self:setDaoOrLaVisible(viewId, data.menla == defs.MEN_LA_STATE.MEN_STATE_LA_ZHUAI, 'la')
  387. end
  388. end
  389. --叫分(抓)
  390. tipsFunc["tips_jiaofen"] = function(nodeParent)
  391. local tips = nodeParent["tips_jiaofen"]
  392. if tips then
  393. tips:removeFromParent()
  394. nodeParent["tips_jiaofen"] = nil
  395. end
  396. if bVisible then
  397. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_fen%d.png"
  398. if data.askLoard ~= 1 then
  399. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_pass.png"
  400. end
  401. local tipsEx = cc.Sprite:create(string.format(str, data.askLoard))
  402. if tipsEx then
  403. tipsEx:setAnchorPoint(anchorPont[viewId])
  404. nodeParent["tips_jiaofen"] = tipsEx
  405. nodeParent:addChild(tipsEx)
  406. end
  407. end
  408. end
  409. --加倍(倒)
  410. tipsFunc["tips_jiabei"] = function(nodeParent)
  411. local tips = nodeParent["tips_jiabei"]
  412. if tips then
  413. tips:removeFromParent()
  414. nodeParent["tips_jiabei"] = nil
  415. end
  416. if bVisible then
  417. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_bei%d.png"
  418. if data.askBei ~= defs.DAO_STATE.DAO_STATE_YES then
  419. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_pass.png"
  420. end
  421. local tipsEx = cc.Sprite:create(string.format(str, data.askBei))
  422. if tipsEx then
  423. tipsEx:setAnchorPoint(anchorPont[viewId])
  424. nodeParent["tips_jiabei"] = tipsEx
  425. nodeParent:addChild(tipsEx)
  426. end
  427. -- self:setAskBeiVisible(data.askBei == defs.DAO_STATE.DAO_STATE_YES, viewId)
  428. -- self:setDaoOrLaVisible(viewId, data.askBei == defs.DAO_STATE.DAO_STATE_YES, 'dao')
  429. end
  430. end
  431. --加倍(拉)
  432. tipsFunc["tips_jiabei_la"] = function(nodeParent)
  433. local tips = nodeParent["tips_jiabei_la"]
  434. if tips then
  435. tips:removeFromParent()
  436. nodeParent["tips_jiabei_la"] = nil
  437. end
  438. if bVisible then
  439. local str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_la%d.png"
  440. if data.askBei ~= defs.DAO_STATE.LA_STATE_YES then
  441. str = "pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_pass.png"
  442. end
  443. local tipsEx = cc.Sprite:create(string.format(str, data.askBei))
  444. if tipsEx then
  445. tipsEx:setAnchorPoint(anchorPont[viewId])
  446. nodeParent["tips_jiabei_la"] = tipsEx
  447. nodeParent:addChild(tipsEx)
  448. end
  449. -- self:setAskBeiVisible(data.askBei == defs.DAO_STATE.LA_STATE_YES, viewId)
  450. -- self:setDaoOrLaVisible(viewId, data.askBei == defs.DAO_STATE.LA_STATE_YES, 'la')
  451. end
  452. end
  453. --要不起,不出
  454. tipsFunc["tips_yaobuqi"] = function(nodeParent)
  455. local tips = nodeParent["tips_yaobuqi"]
  456. if tips then
  457. tips:removeFromParent()
  458. nodeParent["tips_yaobuqi"] = nil
  459. end
  460. if bVisible then
  461. local tipsEx = cc.Sprite:create(string.format("pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_desk/doudizhu_desk_tips_yaobuqi.png"))
  462. if tipsEx then
  463. tipsEx:setAnchorPoint(anchorPont[viewId])
  464. nodeParent["tips_yaobuqi"] = tipsEx
  465. nodeParent:addChild(tipsEx)
  466. end
  467. end
  468. end
  469. --显隐对应的提示
  470. local tipsNode = self.ui.Items["Layout_Tips_" .. viewId]
  471. if tipsNode then
  472. local tipsFuncEx = tipsFunc["" .. tipsType]
  473. if tipsFuncEx then
  474. tipsFuncEx(tipsNode)
  475. end
  476. end
  477. end
  478. function RoomPlayerView_53:hideAllTip()
  479. local allTips = {
  480. 'tips_piao',
  481. 'tips_menzhua',
  482. 'tips_mendao',
  483. 'tips_menla',
  484. 'tips_jiaofen',
  485. 'tips_jiabei',
  486. 'tips_jiabei_la',
  487. 'tips_yaobuqi',
  488. }
  489. print('清除所有节点')
  490. for i = 1, 4 do
  491. for _, v in ipairs(allTips) do
  492. self:setTipsVisible(v, false, i)
  493. end
  494. end
  495. end
  496. function RoomPlayerView_53:setAskBeiVisible(bVisible, viewId)
  497. local askBei = self.ui.Items["Image_AskBei_" .. viewId]
  498. if askBei then
  499. askBei:setVisible(bVisible)
  500. end
  501. end
  502. function RoomPlayerView_53:showBaoJingAni(viewId, clean)
  503. local nodeLayout = self.ui.Items['Layout_baojing_'..viewId]
  504. nodeLayout:removeAllChildren()
  505. if clean then
  506. return
  507. end
  508. --ani
  509. local img = cc.ImageView:createNode()
  510. img:loadTextureFromPlist("ddz_baojing_bg.png")
  511. nodeLayout:addChild(img)
  512. img:setPosition(cc.p(nodeLayout:getContentSize().width/2,nodeLayout:getContentSize().height/2))
  513. --light
  514. local light = cc.ImageView:createNode("ddz_baojing_bg.png")
  515. nodeLayout:addChild(light)
  516. light:setPosition(cc.p(nodeLayout:getContentSize().width/2,nodeLayout:getContentSize().height/2))
  517. local indexFace = 0;
  518. --每隔多少秒切换一张图片
  519. local everyFrame = 0.01
  520. local seq = cc.Sequence:create(cc.DelayTime:create(everyFrame),cc.CallFunc:create(function ()
  521. indexFace = indexFace + 1
  522. if 0 < indexFace and indexFace <= 8 then
  523. local name = string.format("ddz_baojing_%d.png",indexFace)
  524. light:loadTextureFromPlist(name)
  525. else
  526. indexFace = 0
  527. end
  528. end))
  529. local act = cc.RepeatForever:create(seq)
  530. light:runAction(act)
  531. -- 经过几面后,移除警报动画
  532. local removeDelayTime = 1.5
  533. local function removeCallBack()
  534. nodeLayout:stopAllActions()
  535. nodeLayout:removeAllChildren()
  536. end
  537. schedule(nodeLayout, removeCallBack, removeDelayTime)
  538. end
  539. function RoomPlayerView_53:cleanAllBaoJing()
  540. for i = 1, 4 do
  541. local nodeLayout = self.ui.Items['Layout_baojing_'..i]
  542. nodeLayout:removeAllChildren()
  543. end
  544. end
  545. -- 倒or拉
  546. function RoomPlayerView_53:setDaoOrLaVisible(viewId, bVisible, tag)
  547. local nodeParent = self.ui.Items['Layout_Head_Tip_'..viewId]
  548. local nodeLayout = self.ui.Items['Layout_DaoOrLa_'..viewId]
  549. local nodeImg = self.ui.Items['Image_DaoOrLa_'..viewId]
  550. if nodeParent and nodeLayout and nodeImg then
  551. if tag and bVisible then
  552. if tag == 'dao' then
  553. nodeImg:loadTexture('pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_player/zy_ddz_player_dao.png')
  554. elseif tag == 'la' then
  555. nodeImg:loadTexture('pk_nanchongdoudizhu/res/ui/zy_fangjian/doudizhu_player/zy_ddz_player_la.png')
  556. end
  557. end
  558. nodeLayout:setVisible(bVisible)
  559. nodeParent:requestDoLayout()
  560. nodeParent:doLayout()
  561. end
  562. end
  563. -- 漂
  564. function RoomPlayerView_53:setPiaoVisible(viewId, bVisible)
  565. local nodeParent = self.ui.Items['Layout_Head_Tip_'..viewId]
  566. local nodeLayout = self.ui.Items['Layout_Piao_'..viewId]
  567. if nodeParent and nodeLayout then
  568. nodeLayout:setVisible(bVisible)
  569. nodeParent:requestDoLayout()
  570. nodeParent:doLayout()
  571. end
  572. end
  573. -- 选漂
  574. function RoomPlayerView_53:setChoosePiaoVisible(bVisible, viewId)
  575. if viewId == 4 then
  576. return
  577. end
  578. local nodeImg = self.ui.Items['Image_ChoosePiao_' .. viewId]
  579. if nodeImg then
  580. nodeImg:setVisible(bVisible)
  581. end
  582. end
  583. return RoomPlayerView_53