您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字

663 行
21 KiB

  1. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  2. local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions")
  3. local ZPSound = ZPFramework.ZPImport("zp_base.luaScript.ZPSound")
  4. local ZPWanFa=ZPFramework.ImportWanFa("luaScript.SubGameDefine.ZiPai.ZPWanFa")
  5. local ZPRoomXiaoJuView = class("ZPRoomXiaoJuView", cc.UIView)
  6. function ZPRoomXiaoJuView:ctor(nextCallBackFun,isRecontect)
  7. ZPRoomXiaoJuView.super.ctor(self);
  8. self.isRecontect = isRecontect
  9. self.nextCallBack = nextCallBackFun
  10. self.xiaojuData = app.room.roomInfo.playList
  11. self.isShow = false
  12. if self.isRecontect then
  13. self.xiaojuData = app.room.roomInfo.arrayTableInfo
  14. end
  15. self.allNode = {}
  16. self.showHu = {}
  17. end
  18. function ZPRoomXiaoJuView:loadUI()
  19. local ui = loadUI("zp_base/res/ui/ui_fangjian/zipai_ui_xiaoju.ui");
  20. self.ui = ui;
  21. self:addChild(ui);
  22. end
  23. function ZPRoomXiaoJuView:onEnter()
  24. ZPRoomXiaoJuView.super.onEnter(self)
  25. self:loadUI()
  26. -- 下一局
  27. self.ui.Items.Button_Next:registerClick(handler(self , self.onClickNext))
  28. --显示总结算
  29. self.ui.Items.Button_All:registerClick(handler(self , self.onClickZongJieSuan))
  30. --查牌
  31. self.ui.Items.Button_ChaPai:registerClick(handler(self , self.onClickChaPai))
  32. --胡牌类型item,复制用
  33. self.ui.Items.Layout_hutypes:setVisible(false)
  34. --显示结束
  35. if app.room.roomInfo.isGameOver == 1 then
  36. self.ui.Items.Button_Next:setVisible(false)
  37. self.ui.Items.Button_All:setVisible(true)
  38. else
  39. self.ui.Items.Button_All:setVisible(false)
  40. end
  41. self.ui.Items.ImageView_DiCard_1:setVisible(false)
  42. --组合牌第一个点的坐标
  43. self.weaveCardPos = cc.p(200,50)
  44. self.leftCardPos = self.ui.Items.ImageView_DiCard_1:getPosition()
  45. if app.room.roomInfo.playerNum == 2 or app.room:getActualPlayerNum() == 2 then
  46. self.ui.Items.Layout_Player_4:setVisible(false)
  47. self.ui.Items.Layout_Player_3:setVisible(false)
  48. self.ui.Items.Layout_Player:doLayout()
  49. self.ui.Items.Layout_Player:requestDoLayout()
  50. elseif app.room.roomInfo.playerNum == 3 or app.room:getActualPlayerNum() == 3 then
  51. self.ui.Items.Layout_Player_4:setVisible(false)
  52. self.ui.Items.Layout_Player:doLayout()
  53. self.ui.Items.Layout_Player:requestDoLayout()
  54. end
  55. --初始化人物信息
  56. self:initPlayerView()
  57. self:initOtherData()
  58. self:updatePlayerInfo()
  59. end
  60. function ZPRoomXiaoJuView:initPlayerView()
  61. self.ui.Items.Layout_WeaveCard_Item:setVisible(false)
  62. for i=1,4 do
  63. local head = "ImageView_head_"..i
  64. local name = "Text_Name_"..i
  65. local id = "Text_ID_"..i
  66. local banker = "ImageView_Zhuang_"..i
  67. local winScore = "TextBMFont_WinScore_"..i
  68. local loseScore = "TextBMFont_LoseScore_"..i
  69. local layout = "Layout_Hand_"..i
  70. local winBg = "ImageView_ying_bg_"..i
  71. --local loseBg = "ImageView_pt_bg_"..i
  72. local layoutHuinfo = "Layout_HuInfo_"..i
  73. local fangPao = "ImageView_FangPao_"..i
  74. local layoutHuTypes = "Layout_huTypes_"..i
  75. local huType = "ImageView_HuType_"..i
  76. local textHuInfo = "Text_Hu_Info_"..i
  77. local textHushu = "Text_hushu_"..i
  78. local textBeishu = "Text_beishu_"..i
  79. self.allNode[i] = {}
  80. self.allNode[i].nodeHead = self.ui.Items[head]
  81. self.allNode[i].nodeName = self.ui.Items[name]
  82. self.allNode[i].nodeID = self.ui.Items[id]
  83. self.allNode[i].nodeBanker = self.ui.Items[banker]
  84. self.allNode[i].nodewinScore = self.ui.Items[winScore]
  85. self.allNode[i].nodeloseScore = self.ui.Items[loseScore]
  86. self.allNode[i].nodeLayout = self.ui.Items[layout]
  87. self.allNode[i].nodewinBg = self.ui.Items[winBg]
  88. --self.allNode[i].nodeloseBg = self.ui.Items[loseBg]
  89. self.allNode[i].nodelayoutHuinfo = self.ui.Items[layoutHuinfo]
  90. self.allNode[i].nodefangPao = self.ui.Items[fangPao]
  91. self.allNode[i].nodehutype = self.ui.Items[huType]
  92. self.allNode[i].nodelayoutHuTypes = self.ui.Items[layoutHuTypes]
  93. self.allNode[i].nodehuinfo = self.ui.Items[textHuInfo]
  94. self.allNode[i].nodeHushu = self.ui.Items[textHushu]
  95. self.allNode[i].nodeBeishu = self.ui.Items[textBeishu]
  96. end
  97. end
  98. --是否是小家uid
  99. function ZPRoomXiaoJuView:isLittleUid(uid)
  100. if not uid then return false end
  101. local viewId = app.room:getViewIdByUserId(uid)
  102. if not viewId then return false end
  103. local seatId = app.room:getSeatIdByViewId(viewId)
  104. if not seatId then return false end
  105. if app.room.roomInfo.xiaoSeatId and app.room.roomInfo.xiaoSeatId == seatId then
  106. return true
  107. else
  108. return false
  109. end
  110. end
  111. --获取最大得分
  112. function ZPRoomXiaoJuView:getMaxTurnScore(t)
  113. local score = 0
  114. for i,j in pairs(t) do
  115. j.nTurnScore = tonumber(j.nTurnScore)
  116. if j.nTurnScore > score then
  117. score = j.nTurnScore
  118. end
  119. end
  120. return score
  121. end
  122. function ZPRoomXiaoJuView:updatePlayerInfo()
  123. self.isHaveUse = {}
  124. local indexPlayer = 2
  125. local maxTurnScore = self:getMaxTurnScore(self.xiaojuData)
  126. --按要求赢家要摆在第一个位置
  127. for k,v in pairsByKeys(self.xiaojuData) do
  128. v.nTurnScore = tonumber(v.nTurnScore)
  129. if app.room:checkUserIDIsInTable(v.nUserId) then
  130. local i = indexPlayer
  131. if v.nTurnScore == maxTurnScore and not self.isHaveUse[1] and (not self:isLittleUid(v.nUserId)) then
  132. i = 1
  133. elseif self:isLittleUid(v.nUserId) then
  134. i = 4
  135. else
  136. indexPlayer = indexPlayer + 1
  137. end
  138. if i== 4 and (not self:isLittleUid(v.nUserId)) then
  139. for tt=1,4 do
  140. if not self.isHaveUse[tt] then
  141. i = tt
  142. end
  143. end
  144. self.isHaveUse[i] = true
  145. elseif not self.isHaveUse[i] then
  146. self.isHaveUse[i] = true
  147. else
  148. for tt=1,4 do
  149. if not self.isHaveUse[tt] then
  150. i = tt
  151. end
  152. end
  153. self.isHaveUse[i] = true
  154. end
  155. --[[if app.room:getActualPlayerNum() == 4 then
  156. i = app.room:getViewIdByUserId(v.nUserId)--indexPlayer
  157. if i == 2 then
  158. i = 4
  159. elseif i == 4 then
  160. i = 3
  161. elseif i == 3 then
  162. i = 2
  163. end
  164. else
  165. i = indexPlayer
  166. end--]]
  167. local roomInfo = app.room.roomInfo
  168. local userInfo = app.room:getUserInfo(v.nUserId)
  169. local viewId = app.room:getViewIdByUserId(v.nUserId)
  170. local nWinerId = app.room.roomInfo.winUserId
  171. local dianPaoUserId = app.room.roomInfo.dianPaoUserId
  172. local bankerId = app.room:getUserIdBySeatId(app.room.roomInfo.nBankSeatId)
  173. local stopFlag = app.room.roomInfo.stopFlag
  174. if v.nTurnScore > 0 then
  175. self.allNode[i].nodewinScore:setText(tostring("+"..v.nTurnScore))
  176. self.allNode[i].nodeloseScore:setVisible(false)
  177. else
  178. self.allNode[i].nodeloseScore:setText(v.nTurnScore)
  179. self.allNode[i].nodewinScore:setVisible(false)
  180. self.allNode[i].nodewinBg:setVisible(false)
  181. end
  182. self.allNode[i].nodelayoutHuinfo:setVisible(false)
  183. self.allNode[i].nodehutype:setVisible(false)
  184. --先设置默认头像
  185. local width = self.allNode[i].nodeHead:getContentSize().width
  186. local nickname = ""
  187. if userInfo and userInfo.nickname then
  188. nickname = getSubStringNickname(userInfo.nickname)
  189. self:updateUserHead(self.allNode[i].nodeHead,v.nUserId, userInfo.sex, userInfo.headimgurl);
  190. end
  191. --名称
  192. self.allNode[i].nodeName:setText(nickname)
  193. --ID
  194. self.allNode[i].nodeID:setText(tostring("ID:"..v.nUserId))
  195. --显示隐藏游戏内选手id(主办人和管理员不限制,只针对海选赛) -- todo lwq
  196. -- begin
  197. local ClubDefine = require("luaScript.Protocol.Club.ClubDefine")
  198. if app.club_php.clubID and app.club_php.clubID ~= 0 then
  199. if app.club_php:getCestIsOpen(app.club_php.clubID) then
  200. --隐私数据
  201. local clubInfo = app.club_php.clubList[app.club_php.clubID]
  202. self.cliext = clubInfo.groupext and clubInfo.groupext.cliext
  203. if not self.cliext or not self.cliext.is_hideUid or (self.cliext and self.cliext.is_hideUid == 1) then
  204. if clubInfo.role == ClubDefine.Job.Creator or clubInfo.role == ClubDefine.Job.Manager then
  205. self.allNode[i].nodeID:setVisible(true)
  206. else
  207. self.allNode[i].nodeID:setVisible(false)
  208. end
  209. end
  210. end
  211. end
  212. if v.nUserId == tonumber(app.user.loginInfo.uid) then
  213. self.allNode[i].nodeID:setVisible(true)
  214. end
  215. -- end
  216. --庄家
  217. if bankerId == v.nUserId then
  218. self.allNode[i].nodeBanker:setVisible(true)
  219. else
  220. self.allNode[i].nodeBanker:setVisible(false)
  221. end
  222. --点炮玩家
  223. if dianPaoUserId == v.nUserId then
  224. self.allNode[i].nodefangPao:setVisible(false)
  225. --更换显示方式
  226. local ui = self:getAHutypeUi(0,"zp_mt_dianpao.png")
  227. self.allNode[i].nodelayoutHuTypes:addChild(ui)
  228. else
  229. self.allNode[i].nodefangPao:setVisible(false)
  230. end
  231. --组合牌展示
  232. local data = self.xiaojuData[v.nUserId]
  233. if not data then
  234. return
  235. end
  236. local isHuUid = false--是否是赢牌者uid
  237. for huk,huv in pairs(roomInfo.hupaiInfo) do
  238. if huv.huPaiUid == v.nUserId then
  239. isHuUid = true
  240. app.room.roomInfo.huCard = huv.huCard
  241. self.allNode[i].nodelayoutHuinfo:setVisible(true)
  242. --显示胡牌
  243. self.allNode[i].nodeHushu:setText(huv.huPaiHuShu)
  244. self.allNode[i].nodeBeishu:setText(huv.multiNum)
  245. local huDes = {
  246. [1] = "十",[2] = "二十",[3] = "三十",[4] = "四十",[5] = "五十",[6] = "六十",[7] = "七十",[8] = "八十",
  247. [9] = "九十",[10] = "一百",[20] = "二百",[30] = "三百",
  248. }
  249. --查叫
  250. if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then
  251. local ui = self:getAHutypeUi(0,"zp_mt_chajiao.png")
  252. self.allNode[i].nodelayoutHuTypes:addChild(ui)
  253. end
  254. --非自摸 非点炮 显示堂出
  255. if huv.dianPaoUid <= 0 and not ZPFuc.isZiMo(huv.huTypes) then
  256. local ui = self:getAHutypeUi(0,"zp_mt_tangchu.png")
  257. self.allNode[i].nodelayoutHuTypes:addChild(ui)
  258. end
  259. local huDNum = math.floor(huv.huPaiHuShu/10)
  260. if huv.huPaiHuShu == 0 then
  261. self.allNode[i].nodehuinfo:setText("乱胡")--显示无胡
  262. local ui = self:getAHutypeUi(0)
  263. self.allNode[i].nodelayoutHuTypes:addChild(ui)
  264. elseif huDNum > 0 then
  265. if huv.huPaiHuShu%10 == 0 then
  266. self.allNode[i].nodehuinfo:setText("恰"..huDes[huDNum].."胡")--显示梗
  267. local ui = self:getAHutypeUi(0,"zp_mt_geng.png")
  268. self.allNode[i].nodelayoutHuTypes:addChild(ui)
  269. else
  270. self.allNode[i].nodehuinfo:setText(huDes[huDNum].."多胡")
  271. end
  272. else
  273. self.allNode[i].nodehuinfo:setText(huv.huPaiHuShu.."胡")
  274. end
  275. if huv.guiNum and huv.guiNum > 0 then
  276. local gui = string.format("zp_mt_gui%d.png",huv.guiNum)
  277. local ui = self:getAHutypeUi(0,gui)
  278. self.allNode[i].nodelayoutHuTypes:addChild(ui)
  279. end
  280. self:showHuTypes(self.allNode[i].nodelayoutHuTypes,huv.huTypes)
  281. end
  282. end
  283. local index = 0
  284. for key,value in pairs(data.tableWeaveCard) do
  285. local list,operationType = ZPFuc.getZPCardList(value.card,value.type)
  286. local card = value.opcard
  287. list = ZPFuc.getOpCardFirstList(operationType,list,card)
  288. --上面吃或不吃不要用if else因为还可能都不成立
  289. if list then
  290. self:createWeaveCard(value,list,index,false,self.allNode[i].nodeLayout,v.nUserId)
  291. end
  292. index = index + 1
  293. end
  294. --只显示一次胡变为opCard
  295. local showOneTime = true
  296. for k,value in pairs(data.handCard) do
  297. local list,operationType = ZPFuc.getZPCardList(value.card,value.type)
  298. local card = value.opcard
  299. --判断组合牌里是否有胡的那张
  300. local haveHuCard = false
  301. for t = 1,3 do
  302. if app.room.roomInfo.huCard == list[t] then
  303. haveHuCard = true
  304. break
  305. end
  306. end
  307. --如果是吃胡,并且手里的这次的组合牌里还有胡的那张
  308. if showOneTime and haveHuCard and app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU then
  309. card = app.room.roomInfo.huCard
  310. showOneTime = false
  311. end
  312. list = ZPFuc.getOpCardFirstList(operationType,list,card)
  313. if value.type == ZPDef.SendCardType.KAN_THREE_SAME then
  314. value.type = ZPDef.SendCardType.KANPAI_LOCAL
  315. end
  316. --上面吃或不吃不要用if else因为还可能都不成立
  317. if list then
  318. self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId)
  319. end
  320. index = index + 1
  321. end
  322. --本局结束
  323. if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_NORMAL then
  324. if #roomInfo.hupaiInfo > 0 then
  325. if v.nTurnScore > 0 then
  326. if v.nUserId == app.user.loginInfo.uid then
  327. ZPSound.PlayWinGame()
  328. end
  329. else
  330. if v.nUserId == app.user.loginInfo.uid then
  331. ZPSound.PlayLoseGame()
  332. end
  333. end
  334. end
  335. end
  336. --indexPlayer = indexPlayer + 1
  337. if isHuUid and true == isHuUid then
  338. self:showHuCardBox(self.allNode[i].nodeLayout,app.room.roomInfo.huCard)
  339. end
  340. end
  341. end
  342. self:showDiPai()
  343. end
  344. function ZPRoomXiaoJuView:showDiPai()
  345. local dipaiSize = table.nums(app.room.roomInfo.dipaiList);
  346. if dipaiSize <= 0 then
  347. self.ui.Items.Layout_Bottom_1:setVisible(false)
  348. else
  349. self.ui.Items.Layout_Bottom_1:setVisible(true)
  350. end
  351. --[[if app.room:getActualPlayerNum() == 2 then
  352. local y = self.ui.Items.Layout_Bottom_1:getPositionY()
  353. self.ui.Items.Layout_Bottom_1:setPositionY(y+40)
  354. end--]]
  355. local tIndex = 0
  356. for dipaiK,dipaiV in pairsByKeys(app.room.roomInfo.dipaiList) do
  357. local mLayout = cc.Layout:createNode()
  358. mLayout:setAnchorPoint(cc.p(0.5,0.5))
  359. mLayout:setSize(cc.size(30,30))
  360. local cardImg = cc.ImageView:createNode();
  361. cardImg:setAnchorPoint(cc.p(0.5,0.5));
  362. cardImg:setScale(0.8)
  363. local fileName = ZPFuc.getZPCardImgByValue(dipaiV.chessCards,ZPDef.CardType.CARD_TYPE_TABLE)
  364. cardImg:loadTextureFromPlist(fileName);
  365. local row = math.floor(tIndex/22)
  366. --cardImg:setPosition(self.leftCardPos.x + (tIndex%25)*45,self.leftCardPos.y-row*60)
  367. cardImg:setPosition(cc.p(15,15))
  368. mLayout:addChild(cardImg)
  369. self.ui.Items.Layout_dipai:addChild(mLayout);
  370. tIndex = tIndex + 1;
  371. end
  372. end
  373. function ZPRoomXiaoJuView:getHuTypeAndBeiShuStr(huType,beishu)
  374. local strRul = ""
  375. return strRul
  376. end
  377. --判断是否是赢家uid
  378. function ZPRoomXiaoJuView:getIsWinUid(uid)
  379. for huk,huv in pairs(app.room.roomInfo.hupaiInfo) do
  380. if huv.huPaiUid == uid then
  381. return true
  382. end
  383. end
  384. return false
  385. end
  386. function ZPRoomXiaoJuView:createWeaveCard(value,list,index,isHand,node,userID)
  387. local sendCardType = value.type
  388. local huxi = value.hushu
  389. local opCard = value.opcard
  390. local ui = self.ui.Items.Layout_WeaveCard_Item:getCopied()
  391. ui.Items = getUIItems(ui);
  392. ui:setVisible(true)
  393. local max = table.nums(list)
  394. local idx = max
  395. for i = 1,4 do
  396. local name = "ImageView_Card_"..i
  397. local hu = "ImageView_card_hu_"..i
  398. ui.Items[hu]:setVisible(false)
  399. if i > max then
  400. ui.Items[name]:setVisible(false)
  401. else
  402. if list[idx] == app.room.roomInfo.huCard and not self.isShow then
  403. --[[--吃胡一定是手牌
  404. if app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU and isHand then
  405. self.isShow = true
  406. --其他类型的胡牌在组合牌上
  407. elseif app.room.roomInfo.huCardType and app.room.roomInfo.huCardType ~= ZPDef.ReconnectHuType.CHI_HU and not isHand then
  408. self.isShow = true
  409. elseif app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == 0 and isHand then--叫牌的时候
  410. self.isShow = true
  411. end--]]
  412. if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then
  413. if true == isHand or #list == 4 or (#list == 3 and list[1]==list[2] and list[2]==list[3]) then
  414. self.isShow = true
  415. end
  416. else
  417. if app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU and not isHand then
  418. else
  419. self.isShow = true
  420. end
  421. end
  422. end
  423. local fileName = ZPFuc.getZPCardImgByValue(list[idx],ZPDef.CardType.CARD_TYPE_TABLE)
  424. ui.Items[name]:loadTextureFromPlist(fileName)
  425. ui.Items[name].cardValue = list[idx]
  426. idx = idx - 1
  427. --[[if self.isShow == true then
  428. --ui.Items[name]:setColor(cc.c3b(248,193,103))
  429. if not self.showHu[userID] then
  430. self.isShow = false
  431. self.showHu[userID] = true
  432. if self:getIsWinUid(userID) then
  433. ui.Items[hu]:setVisible(true)
  434. end
  435. end
  436. self.isShow = false
  437. end--]]
  438. end
  439. end
  440. --不管是不是手牌都要显示
  441. if self:getWeaveTypeFile(sendCardType) ~= "" then--and (not isHand)
  442. ui.Items.ImageView_tip:loadTextureFromPlist(self:getWeaveTypeFile(sendCardType))
  443. else
  444. ui.Items.ImageView_tip:setVisible(false)
  445. end
  446. ui.Items.TextBMFont_youshu:setText(huxi)
  447. ui:setPosition(cc.p(self.weaveCardPos.x + index * 40,self.weaveCardPos.y))
  448. --self.ui.Items.Layout_1:addChild(ui)
  449. node:addChild(ui)
  450. end
  451. --在胡牌的那张牌上面显示胡字
  452. function ZPRoomXiaoJuView:showHuCardBox(node,hucard)
  453. if not node then return end
  454. local cardUI = node:getChildren()
  455. if cardUI and type(cardUI) == 'table' then
  456. for i = #cardUI ,1,-1 do
  457. local tui = cardUI[i]
  458. for k = 1,4 do
  459. local name = "ImageView_Card_"..k
  460. local hu = "ImageView_card_hu_"..k
  461. if tui.Items[name] and tui.Items[name]:isVisible() and tui.Items[name].cardValue == hucard then
  462. tui.Items[hu]:setVisible(true)
  463. return
  464. end
  465. end
  466. end
  467. end
  468. end
  469. --[[
  470. 获取组合类型文件
  471. ]]
  472. function ZPRoomXiaoJuView:getWeaveTypeFile(sendCardType)
  473. if sendCardType == ZPDef.SendCardType.TWO_SEVEN_TEN
  474. or sendCardType == ZPDef.SendCardType.ONE_FIVE_TEN
  475. or sendCardType == ZPDef.SendCardType.ONE_TWO_THREE
  476. or sendCardType == ZPDef.SendCardType.DA_ZI_TWO_AND_ONE
  477. or sendCardType == ZPDef.SendCardType.SHUN_ZI then
  478. return ZPDef.XiaoJuWeaveCardType.CHI
  479. elseif sendCardType == ZPDef.SendCardType.DUI_THREE_SAME then
  480. return ZPDef.XiaoJuWeaveCardType.PENG
  481. elseif sendCardType == ZPDef.SendCardType.KAN_THREE_SAME or sendCardType == ZPDef.SendCardType.DIRTY_THREE_SAME then
  482. return ZPDef.XiaoJuWeaveCardType.WEI
  483. elseif sendCardType == ZPDef.SendCardType.KUAI_SHUI_FOUR_SAME or sendCardType == ZPDef.SendCardType.CHI_PAI_PENG_PAO or sendCardType == ZPDef.SendCardType.CHI_PAI_SHAO_PAO then
  484. return ZPDef.XiaoJuWeaveCardType.ZHAO
  485. elseif sendCardType == ZPDef.SendCardType.GUN_ZI_FOUR_SAME or sendCardType == ZPDef.SendCardType.CHI_PAI_TI then
  486. return ZPDef.XiaoJuWeaveCardType.LONG
  487. elseif sendCardType == ZPDef.SendCardType.ZHUANG_ZI then
  488. return ZPDef.XiaoJuWeaveCardType.JIANG
  489. elseif sendCardType == ZPDef.SendCardType.KANPAI_LOCAL then
  490. return ZPDef.XiaoJuWeaveCardType.KAN
  491. else
  492. local txt = string.format("发牌类型为:"..sendCardType)
  493. --showTooltip(txt)
  494. return ""
  495. end
  496. end
  497. function ZPRoomXiaoJuView:initOtherData()
  498. local roomInfo = app.room.roomInfo
  499. local winUserId = app.room.roomInfo.winUserId
  500. --规则
  501. self.ui.Items.Text_Rule:setText(ZPWanFa.getRuleInfo(roomInfo.strGameInfo))
  502. --时间
  503. self.ui.Items.Text_Time:setText(getTimeString())
  504. --房号
  505. self.ui.Items.Text_RoomNum:setText("房号:"..tostring(app.room.roomInfo.nShowTableId))
  506. end
  507. function ZPRoomXiaoJuView:updateUserHead(nodeHead,nUserId, sex, headimgurl)
  508. setPlayerHeadImage(nUserId, headimgurl, nodeHead);
  509. end
  510. -- 查牌
  511. function ZPRoomXiaoJuView:onClickChaPai()
  512. playBtnEffect()
  513. self:setVisible(false)
  514. end
  515. -- 下一局
  516. function ZPRoomXiaoJuView:onClickNext()
  517. playBtnEffect()
  518. self.ui:sendMsg(app.room, "callReadyRequest");
  519. if self.nextCallBack then
  520. self.nextCallBack()
  521. end
  522. end
  523. function ZPRoomXiaoJuView:onClickZongJieSuan()
  524. playBtnEffect()
  525. if self.nextCallBack then
  526. self.nextCallBack()
  527. end
  528. end
  529. function ZPRoomXiaoJuView:getAHutypeUi(ht,filename)
  530. local ui = self.ui.Items.Layout_hutypes:getCopied()
  531. ui.Items = getUIItems(ui);
  532. ui:setVisible(true)
  533. if not ht then
  534. ht = 0
  535. end
  536. local name = string.format(ZPDef.TipFile.HU,ht)
  537. if filename then
  538. name = filename
  539. end
  540. ui.Items.ImageView_hutype:loadTextureFromPlist(name)
  541. return ui
  542. end
  543. --显示胡牌类型
  544. function ZPRoomXiaoJuView:showHuTypes(node,huType)
  545. --[[local initPos = cc.p(100,115)
  546. local scale = 0.4
  547. local offsetY = 30--]]
  548. if huType > 0 then
  549. local strSpec = ""
  550. local ret = getNumBand(huType,ZPDef.HuType.TIAN_HU)
  551. if ret > 0 then
  552. local ui = self:getAHutypeUi(ZPDef.HuType.TIAN_HU)
  553. node:addChild(ui)
  554. end
  555. local ret = getNumBand(huType,ZPDef.HuType.DI_HU)
  556. if ret > 0 then
  557. local ui = self:getAHutypeUi(ZPDef.HuType.DI_HU)
  558. node:addChild(ui)
  559. end
  560. local ret = getNumBand(huType,ZPDef.HuType.HAI_DI_HU)
  561. if ret > 0 then
  562. local ui = self:getAHutypeUi(ZPDef.HuType.HAI_DI_HU)
  563. node:addChild(ui)
  564. end
  565. local ret = getNumBand(huType,ZPDef.HuType.ZI_MO_HU)
  566. if ret > 0 then
  567. local ui = self:getAHutypeUi(ZPDef.HuType.ZI_MO_HU)
  568. node:addChild(ui)
  569. end
  570. local ret = getNumBand(huType,ZPDef.HuType.SHUI_SHANG_PIAO)
  571. if ret > 0 then
  572. local ui = self:getAHutypeUi(ZPDef.HuType.SHUI_SHANG_PIAO)
  573. node:addChild(ui)
  574. end
  575. local ret = getNumBand(huType,ZPDef.HuType.HEI_HU)
  576. if ret > 0 then
  577. local ui = self:getAHutypeUi(ZPDef.HuType.HEI_HU)
  578. node:addChild(ui)
  579. end
  580. local ret = getNumBand(huType,ZPDef.HuType.HONG_HU)
  581. if ret > 0 then
  582. local ui = self:getAHutypeUi(ZPDef.HuType.HONG_HU)
  583. node:addChild(ui)
  584. end
  585. local ret = getNumBand(huType,ZPDef.HuType.BAO_HU)
  586. if ret > 0 then
  587. local ui = self:getAHutypeUi(ZPDef.HuType.BAO_HU)
  588. node:addChild(ui)
  589. end
  590. local ret = getNumBand(huType,ZPDef.HuType.KUN_HU)
  591. if ret > 0 then
  592. local ui = self:getAHutypeUi(ZPDef.HuType.KUN_HU)
  593. node:addChild(ui)
  594. end
  595. local ret = getNumBand(huType,ZPDef.HuType.SHA_BAO_HU)
  596. if ret > 0 then
  597. local ui = self:getAHutypeUi(ZPDef.HuType.SHA_BAO_HU)
  598. node:addChild(ui)
  599. end
  600. end
  601. end
  602. return ZPRoomXiaoJuView;