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.

765 lines
22 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 tempCardVlue ={
  6. [17] = 20, --11
  7. [18] = 30, --12
  8. [49] = 40, --31
  9. [34] = 41, --22
  10. [20] = 50, --14
  11. [50] = 51, --32
  12. [21] = 60, --15
  13. [36] = 61, --24
  14. [51] = 62, --33
  15. [22] = 70, --16
  16. [82] = 71, --52
  17. [52] = 72, --34
  18. [38] = 80, --26
  19. [53] = 81, --35
  20. [68] = 82, --44
  21. [54] = 90, --36
  22. [84] = 91, --54
  23. [70] = 100, --46
  24. [85] = 101, --55
  25. [86] = 110, --56
  26. [102] = 120, --66
  27. }
  28. local xichongRoomXiaoJuView = class("xichongRoomXiaoJuView", cc.UIView)
  29. function xichongRoomXiaoJuView:ctor(nextCallBackFun,isRecontect)
  30. xichongRoomXiaoJuView.super.ctor(self);
  31. self.isRecontect = isRecontect
  32. self.nextCallBack = nextCallBackFun
  33. self.xiaojuData = app.room.roomInfo.playList
  34. self.isShow = false
  35. if self.isRecontect then
  36. self.xiaojuData = app.room.roomInfo.arrayTableInfo
  37. end
  38. self.allNode = {}
  39. self.showHu = {}
  40. end
  41. function xichongRoomXiaoJuView:loadUI()
  42. local ui = loadUI("zp_xichong/res/ui/ui_fangjian/xichong_ui_xiaoju.ui");
  43. self.ui = ui;
  44. self:addChild(ui);
  45. end
  46. function xichongRoomXiaoJuView:onEnter()
  47. xichongRoomXiaoJuView.super.onEnter(self)
  48. self:loadUI()
  49. -- 下一局
  50. self.ui.Items.Button_Next:registerClick(handler(self , self.onClickNext))
  51. --显示总结算
  52. self.ui.Items.Button_All:registerClick(handler(self , self.onClickZongJieSuan))
  53. --self.ui.Items.Button_ChaPai:setVisible(false)
  54. --查牌
  55. self.ui.Items.Button_ChaPai:registerClick(handler(self , self.onClickChaPai))
  56. --胡牌类型item,复制用
  57. self.ui.Items.Layout_hutypes:setVisible(false)
  58. --显示结束
  59. if app.room.roomInfo.isGameOver == 1 then
  60. self.ui.Items.Button_Next:setVisible(false)
  61. self.ui.Items.Button_All:setVisible(true)
  62. else
  63. self.ui.Items.Button_All:setVisible(false)
  64. end
  65. self.ui.Items.ImageView_DiCard_1:setVisible(false)
  66. --组合牌第一个点的坐标
  67. self.weaveCardPos = cc.p(300, -28)
  68. self.leftCardPos = self.ui.Items.ImageView_DiCard_1:getPosition()
  69. if app.room.roomInfo.playerNum == 2 or app.room:getActualPlayerNum() == 2 then
  70. self.ui.Items.Layout_Player_4:setVisible(false)
  71. self.ui.Items.Layout_Player_3:setVisible(false)
  72. self.ui.Items.Layout_Player:doLayout()
  73. self.ui.Items.Layout_Player:requestDoLayout()
  74. elseif app.room.roomInfo.playerNum == 3 or app.room:getActualPlayerNum() == 3 then
  75. self.ui.Items.Layout_Player_4:setVisible(false)
  76. self.ui.Items.Layout_Player:doLayout()
  77. self.ui.Items.Layout_Player:requestDoLayout()
  78. end
  79. --初始化人物信息
  80. self:initPlayerView()
  81. self:initOtherData()
  82. self:updatePlayerInfo()
  83. end
  84. function xichongRoomXiaoJuView:initPlayerView()
  85. self.ui.Items.Layout_WeaveCard_Item:setVisible(false)
  86. for i=1,4 do
  87. local head = "ImageView_head_"..i
  88. local name = "Text_Name_"..i
  89. local id = "Text_ID_"..i
  90. local banker = "ImageView_Zhuang_"..i
  91. local winScore = "TextBMFont_WinScore_"..i
  92. local loseScore = "TextBMFont_LoseScore_"..i
  93. local layout = "Layout_Hand_"..i
  94. local winBg = "ImageView_ying_bg_"..i
  95. --local loseBg = "ImageView_pt_bg_"..i
  96. local fangPao = "ImageView_FangPao_"..i
  97. local layoutHuTypes = "Layout_huTypes_"..i
  98. local huType = "ImageView_HuType_"..i
  99. local textFanshu = "Text_fanshu_"..i
  100. local toujia = "ImageView_toujia_"..i
  101. local xiaojia = "ImageView_xiaojia_"..i
  102. local piao = "ImageView_piao_"..i
  103. local huShu = "Text_HuShu_" .. i
  104. self.allNode[i] = {}
  105. self.allNode[i].nodeHead = self.ui.Items[head]
  106. self.allNode[i].nodeName = self.ui.Items[name]
  107. self.allNode[i].nodeID = self.ui.Items[id]
  108. self.allNode[i].nodeBanker = self.ui.Items[banker]
  109. self.allNode[i].nodewinScore = self.ui.Items[winScore]
  110. self.allNode[i].nodeloseScore = self.ui.Items[loseScore]
  111. self.allNode[i].nodeLayout = self.ui.Items[layout]
  112. self.allNode[i].nodewinBg = self.ui.Items[winBg]
  113. --self.allNode[i].nodeloseBg = self.ui.Items[loseBg]
  114. self.allNode[i].nodefangPao = self.ui.Items[fangPao]
  115. self.allNode[i].nodehutype = self.ui.Items[huType]
  116. self.allNode[i].nodelayoutHuTypes = self.ui.Items[layoutHuTypes]
  117. self.allNode[i].nodefanshu = self.ui.Items[textFanshu]
  118. self.allNode[i].nodetoujia = self.ui.Items[toujia]
  119. self.allNode[i].nodexiaojia = self.ui.Items[xiaojia]
  120. self.allNode[i].nodepiao = self.ui.Items[piao]
  121. self.allNode[i].nodeHuShu = self.ui.Items[huShu]
  122. end
  123. end
  124. --是否是小家uid
  125. function xichongRoomXiaoJuView:isLittleUid(uid)
  126. if not uid then return false end
  127. local viewId = app.room:getViewIdByUserId(uid)
  128. if not viewId then return false end
  129. local seatId = app.room:getSeatIdByViewId(viewId)
  130. if not seatId then return false end
  131. if app.room.roomInfo.xiaoSeatId and app.room.roomInfo.xiaoSeatId == seatId then
  132. return true
  133. else
  134. return false
  135. end
  136. end
  137. --获取最大得分
  138. function xichongRoomXiaoJuView:getMaxTurnScore(t)
  139. local score = 0
  140. for i,j in pairs(t) do
  141. if j.nTurnScore > score then
  142. score = j.nTurnScore
  143. end
  144. end
  145. return score
  146. end
  147. function xichongRoomXiaoJuView:updatePlayerInfo()
  148. self.isHaveUse = {}
  149. local indexPlayer = 2
  150. local maxTurnScore = self:getMaxTurnScore(self.xiaojuData)
  151. --按要求赢家要摆在第一个位置
  152. for k,v in pairsByKeys(self.xiaojuData) do
  153. if app.room:checkUserIDIsInTable(v.nUserId) then
  154. local i = indexPlayer
  155. if v.nTurnScore == maxTurnScore and not self.isHaveUse[1] and (not self:isLittleUid(v.nUserId)) then
  156. i = 1
  157. elseif self:isLittleUid(v.nUserId) then
  158. i = 4
  159. else
  160. indexPlayer = indexPlayer + 1
  161. end
  162. if i== 4 and (not self:isLittleUid(v.nUserId)) then
  163. for tt=1,4 do
  164. if not self.isHaveUse[tt] then
  165. i = tt
  166. end
  167. end
  168. self.isHaveUse[i] = true
  169. elseif not self.isHaveUse[i] then
  170. self.isHaveUse[i] = true
  171. else
  172. for tt=1,4 do
  173. if not self.isHaveUse[tt] then
  174. i = tt
  175. end
  176. end
  177. self.isHaveUse[i] = true
  178. end
  179. local roomInfo = app.room.roomInfo
  180. local userInfo = app.room:getUserInfo(v.nUserId)
  181. local viewId = app.room:getViewIdByUserId(v.nUserId)
  182. local nWinerId = app.room.roomInfo.winUserId
  183. local dianPaoUserId = app.room.roomInfo.dianPaoUserId
  184. local weiguiUserId = app.room.roomInfo.weiGuiUid
  185. local bankerId = app.room:getUserIdBySeatId(app.room.roomInfo.nBankSeatId)
  186. local stopFlag = app.room.roomInfo.stopFlag
  187. local xiaojiaid = self:getXiaojiaUid()
  188. self.allNode[i].nodefangPao:setScale(1.5)
  189. if stopFlag ~= 0 then
  190. self.allNode[i].nodefanshu:setVisible(false)
  191. self.allNode[i].nodelayoutHuTypes:setVisible(false)
  192. end
  193. if v.nTurnScore > 0 then
  194. self.allNode[i].nodewinScore:setText(tostring("+"..v.nTurnScore))
  195. self.allNode[i].nodeloseScore:setVisible(false)
  196. else
  197. self.allNode[i].nodeloseScore:setText(v.nTurnScore)
  198. self.allNode[i].nodewinScore:setVisible(false)
  199. self.allNode[i].nodewinBg:setVisible(false)
  200. end
  201. self.allNode[i].nodehutype:setVisible(false)
  202. self.allNode[i].nodeHuShu:setVisible(v.totalTuoNum > 0);
  203. self.allNode[i].nodeHuShu:setString(v.totalTuoNum .. '点')
  204. --先设置默认头像
  205. local width = self.allNode[i].nodeHead:getContentSize().width
  206. local nickname = ""
  207. if userInfo and userInfo.nickname then
  208. nickname = getSubStringNickname(userInfo.nickname)
  209. self:updateUserHead(self.allNode[i].nodeHead,v.nUserId, userInfo.sex, userInfo.headimgurl);
  210. end
  211. --名称
  212. self.allNode[i].nodeName:setText(nickname)
  213. --ID
  214. self.allNode[i].nodeID:setText(tostring("ID:"..v.nUserId))
  215. --显示隐藏游戏内选手id(主办人和管理员不限制,只针对海选赛) -- todo lwq
  216. -- begin
  217. local ClubDefine = require("luaScript.Protocol.Club.ClubDefine")
  218. if app.club_php.clubID and app.club_php.clubID ~= 0 then
  219. if app.club_php:getCestIsOpen(app.club_php.clubID) then
  220. --隐私数据
  221. local clubInfo = app.club_php.clubList[app.club_php.clubID]
  222. self.cliext = clubInfo.groupext and clubInfo.groupext.cliext
  223. if not self.cliext or not self.cliext.is_hideUid or (self.cliext and self.cliext.is_hideUid == 1) then
  224. if clubInfo.role == ClubDefine.Job.Creator or clubInfo.role == ClubDefine.Job.Manager then
  225. self.allNode[i].nodeID:setVisible(true)
  226. else
  227. self.allNode[i].nodeID:setVisible(false)
  228. end
  229. end
  230. end
  231. end
  232. if v.nUserId == tonumber(app.user.loginInfo.uid) then
  233. self.allNode[i].nodeID:setVisible(true)
  234. end
  235. -- end
  236. --庄家
  237. if bankerId == v.nUserId then
  238. self.allNode[i].nodeBanker:setVisible(false)
  239. self.allNode[i].nodetoujia:setVisible(true)
  240. else
  241. self.allNode[i].nodeBanker:setVisible(false)
  242. self.allNode[i].nodetoujia:setVisible(false)
  243. end
  244. --小家
  245. if xiaojiaid == v.nUserId then
  246. self.allNode[i].nodexiaojia:setVisible(true)
  247. else
  248. self.allNode[i].nodexiaojia:setVisible(false)
  249. end
  250. --报叫
  251. if v.nBaoPaiStatus == 2 then
  252. self.allNode[i].nodepiao:setVisible(true)
  253. else
  254. self.allNode[i].nodepiao:setVisible(false)
  255. end
  256. --点炮 包赔玩家
  257. if dianPaoUserId == v.nUserId or weiguiUserId == v.nUserId then
  258. if dianPaoUserId == v.nUserId then
  259. self.allNode[i].nodefangPao:setVisible(true)
  260. self.allNode[i].nodefangPao:loadTexture("zp_xichong/res/ui/zy_fangjian/jiesuan/dianpao.png")
  261. --self.allNode[i].nodefangPao:setScale(1.3)
  262. local orderPos = self.allNode[i].nodefangPao:getPosition()
  263. self.allNode[i].nodefangPao:setPositionY(orderPos.y - 10)
  264. end
  265. if weiguiUserId == v.nUserId then
  266. self.allNode[i].nodefangPao:setVisible(true)
  267. self.allNode[i].nodefangPao:loadTexture("zp_xichong/res/ui/zy_fangjian/jiesuan/weigui.png")
  268. --self.allNode[i].nodefangPao:setScale(1)
  269. local orderPos = self.allNode[i].nodefangPao:getPosition()
  270. self.allNode[i].nodefangPao:setPositionY(orderPos.y - 10)
  271. end
  272. else
  273. self.allNode[i].nodefangPao:setVisible(false)
  274. end
  275. --组合牌展示
  276. local data = self.xiaojuData[v.nUserId]
  277. if not data then
  278. return
  279. end
  280. local isHuUid = false--是否是赢牌者uid
  281. for huk,huv in pairs(roomInfo.hupaiInfo) do
  282. if huv.huPaiUid == v.nUserId then
  283. isHuUid = true
  284. app.room.roomInfo.huCard = huv.huCard
  285. self.allNode[i].nodefangPao:setVisible(true)
  286. self.allNode[i].nodefangPao:loadTexture("zp_xichong/res/ui/zy_fangjian/jiesuan/hu.png")
  287. end
  288. if huv.huPaiUid == v.nUserId then
  289. self.allNode[i].nodefanshu:setVisible(true)
  290. self.allNode[i].nodefanshu:setText(huv.huPaiHuShu.."番")
  291. --local hustr = self:getHuTypesStr(huv.huPaiUid,huv.huTypes)
  292. --self.allNode[i].nodelayoutHuTypes:setVisible(true)
  293. else
  294. self.allNode[i].nodefanshu:setVisible(false)
  295. --self.allNode[i].nodelayoutHuTypes:setVisible(false)
  296. end
  297. end
  298. local index = 0
  299. self.allNode[i].nodeLayout:setVisible(true)
  300. --只显示一次胡变为opCard
  301. local findHuCard = false
  302. local showOneTime = true
  303. local index = 0
  304. -- 创建组合牌
  305. do
  306. for key,value in pairs(data.tableWeaveCard) do
  307. local list = {}
  308. local card = value.opcard
  309. local optype = value.type
  310. if optype == ZPDef.SendCardType.TOU_THREE_SAME or optype == ZPDef.SendCardType.CHI_PAI_PENG then
  311. list = {card,card,card}
  312. elseif optype == ZPDef.SendCardType.BA_FOUR_SAME then
  313. list = {card,card,card,card}
  314. elseif optype == ZPDef.SendCardType.TWO_SUM_CHI then
  315. list = value.card
  316. end
  317. if list then
  318. self:createWeaveCard(value,list,index,false,self.allNode[i].nodeLayout,v.nUserId)
  319. end
  320. index = index + 1
  321. end
  322. if table.nums(data.tableWeaveCard) > 0 then
  323. index = index + 0.3
  324. end
  325. end
  326. -- 创建手牌
  327. do
  328. local handcardList = app.room:serverCardToMyCard(v.handCard)
  329. if isHuUid then
  330. for k,v in pairs(handcardList) do
  331. local isFind = false;
  332. for kk, vv in ipairs(v) do
  333. if vv == app.room.roomInfo.huCard then
  334. table.remove(v, kk) -- 移除胡的那张牌
  335. isFind = true
  336. break
  337. end
  338. end
  339. if isFind then
  340. local huList = table.remove(handcardList, k)
  341. table.insert(handcardList, huList) -- 将胡牌列放到最后
  342. break
  343. end
  344. end
  345. end
  346. -- 创建手牌
  347. for k,value in pairs(handcardList) do
  348. local list = value
  349. if list then
  350. table.sort(list, function (a, b)
  351. return tempCardVlue[a] > tempCardVlue[b]
  352. end)
  353. -- table.sort(list, function (a, b)
  354. -- local a1 = tonumber(string.format('%x', a))
  355. -- local b1 = tonumber(string.format('%x', b))
  356. -- return math.floor(a1 / 10) > math.floor(b1 / 10)
  357. -- end)
  358. local lens = table.nums(list)
  359. self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId)
  360. index = index + 1
  361. end
  362. end
  363. if table.nums(handcardList) > 0 then
  364. index = index + 0.3 -- 手牌与胡牌间隔一列
  365. end
  366. end
  367. -- 创建胡牌
  368. do
  369. local huCard = app.room.roomInfo.huCard
  370. if isHuUid and true == isHuUid and huCard > 0 then
  371. self:createWeaveCard({sendCardType = 0, hushu = 0, opcard = huCard}, {huCard}, index, true, self.allNode[i].nodeLayout, v.nUserId)
  372. index = index + 1
  373. end
  374. end
  375. --本局结束
  376. if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_NORMAL then
  377. if #roomInfo.hupaiInfo > 0 then
  378. if v.nTurnScore > 0 then
  379. if v.nUserId == app.user.loginInfo.uid then
  380. ZPSound.PlayWinGame()
  381. end
  382. else
  383. if v.nUserId == app.user.loginInfo.uid then
  384. ZPSound.PlayLoseGame()
  385. end
  386. end
  387. end
  388. end
  389. local huCard = app.room.roomInfo.huCard
  390. if isHuUid and true == isHuUid and huCard > 0 then
  391. -- self:createWeaveCard(huCard,index,self.allNode[i].nodeLayout,false,true)
  392. end
  393. end
  394. end
  395. self:showDiPai()
  396. end
  397. function xichongRoomXiaoJuView:getAHutypeUi(ht,filename)
  398. local ui = self.ui.Items.Layout_hutypes:getCopied()
  399. ui.Items = getUIItems(ui);
  400. ui:setVisible(true)
  401. if not ht then
  402. ht = 0
  403. end
  404. local name = string.format(ZPDef.TipFile.HU,ht)
  405. if filename then
  406. name = filename
  407. end
  408. ui.Items.ImageView_hutype:loadTextureFromPlist(name)
  409. return ui
  410. end
  411. function xichongRoomXiaoJuView:showDiPai()
  412. local dipaiSize = table.nums(app.room.roomInfo.dipaiList);
  413. if dipaiSize <= 0 then
  414. self.ui.Items.Layout_Bottom_1:setVisible(false)
  415. else
  416. self.ui.Items.Layout_Bottom_1:setVisible(true)
  417. end
  418. self.ui.Items.Layout_Bottom_1:setVisible(false)
  419. if true then
  420. return
  421. end
  422. --[[if app.room:getActualPlayerNum() == 2 then
  423. local y = self.ui.Items.Layout_Bottom_1:getPositionY()
  424. self.ui.Items.Layout_Bottom_1:setPositionY(y+40)
  425. end--]]
  426. local tIndex = 0
  427. for dipaiK,dipaiV in pairsByKeys(app.room.roomInfo.dipaiList) do
  428. local mLayout = cc.Layout:createNode()
  429. mLayout:setAnchorPoint(cc.p(0.5,0.5))
  430. mLayout:setSize(cc.size(30,30))
  431. local cardImg = cc.ImageView:createNode();
  432. cardImg:setAnchorPoint(cc.p(0.5,0.5));
  433. cardImg:setScale(0.8)
  434. local fileName = ZPFuc.getZPCardImgByValue(dipaiV.chessCards,ZPDef.CardType.CARD_TYPE_TABLE)
  435. cardImg:loadTextureFromPlist(fileName);
  436. local row = math.floor(tIndex/22)
  437. --cardImg:setPosition(self.leftCardPos.x + (tIndex%25)*45,self.leftCardPos.y-row*60)
  438. cardImg:setPosition(cc.p(15,15))
  439. mLayout:addChild(cardImg)
  440. self.ui.Items.Layout_dipai:addChild(mLayout);
  441. tIndex = tIndex + 1;
  442. end
  443. end
  444. function xichongRoomXiaoJuView:getHuTypeAndBeiShuStr(huType,beishu)
  445. local strRul = ""
  446. return strRul
  447. end
  448. --判断是否是赢家uid
  449. function xichongRoomXiaoJuView:getIsWinUid(uid)
  450. for huk,huv in pairs(app.room.roomInfo.hupaiInfo) do
  451. if huv.huPaiUid == uid then
  452. return true
  453. end
  454. end
  455. return false
  456. end
  457. function xichongRoomXiaoJuView:createWeaveCard(value,list,index,isHand,node,userID)
  458. local sendCardType = value.type
  459. local huxi = value.hushu
  460. local opCard = value.opcard
  461. local ui = self.ui.Items.Layout_WeaveCard_Item:getCopied()
  462. ui.Items = getUIItems(ui);
  463. ui:setVisible(true)
  464. local max = table.nums(list)
  465. local idx = max
  466. for i = 1,4 do
  467. local name = "ImageView_Card_"..i
  468. local hu = "ImageView_card_hu_"..i
  469. ui.Items[hu]:setVisible(false)
  470. if i > max then
  471. ui.Items[name]:setVisible(false)
  472. else
  473. if list[i] == app.room.roomInfo.huCard and not self.isShow then
  474. --[[--吃胡一定是手牌
  475. if app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU and isHand then
  476. self.isShow = true
  477. --其他类型的胡牌在组合牌上
  478. elseif app.room.roomInfo.huCardType and app.room.roomInfo.huCardType ~= ZPDef.ReconnectHuType.CHI_HU and not isHand then
  479. self.isShow = true
  480. elseif app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == 0 and isHand then--叫牌的时候
  481. self.isShow = true
  482. end--]]
  483. if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then
  484. if true == isHand or #list == 4 or (#list == 3 and list[1]==list[2] and list[2]==list[3]) then
  485. self.isShow = true
  486. end
  487. else
  488. if app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU and not isHand then
  489. else
  490. self.isShow = true
  491. end
  492. end
  493. end
  494. local fileName = ZPFuc.getZPCardImgByValue(list[i], ZPDef.CardType.CARD_TYPE_HAND, ZPDef.GameStyleType.JINGDIAN)
  495. -- local fileName = ZPFuc.getZPCardImgByValue(list[i],ZPDef.CardType.CARD_TYPE_QUIT,self.colorType)
  496. ui.Items[name]:loadTextureFromPlist(fileName)
  497. ui.Items[name].cardValue = list[i]
  498. --[[if self.isShow == true then
  499. --ui.Items[name]:setColor(cc.c3b(248,193,103))
  500. if not self.showHu[userID] then
  501. self.isShow = false
  502. self.showHu[userID] = true
  503. if self:getIsWinUid(userID) then
  504. ui.Items[hu]:setVisible(true)
  505. end
  506. end
  507. self.isShow = false
  508. end--]]
  509. end
  510. end
  511. --不管是不是手牌都要显示
  512. if self:getWeaveTypeFile(sendCardType) ~= "" then--and (not isHand)
  513. --ui.Items.ImageView_tip:loadTextureFromPlist(self:getWeaveTypeFile(sendCardType))
  514. ui.Items.ImageView_tip:setVisible(false)
  515. else
  516. ui.Items.ImageView_tip:setVisible(false)
  517. end
  518. ui.Items.TextBMFont_youshu:setVisible(false)
  519. --ui.Items.TextBMFont_youshu:setText(huxi)
  520. ui:setPosition(cc.p(self.weaveCardPos.x + index * 50,self.weaveCardPos.y))
  521. --self.ui.Items.Layout_1:addChild(ui)
  522. node:addChild(ui)
  523. end
  524. --[[
  525. 获取组合类型文件
  526. ]]
  527. function xichongRoomXiaoJuView:getWeaveTypeFile(sendCardType)
  528. if sendCardType == ZPDef.SendCardType.TWO_SEVEN_TEN
  529. or sendCardType == ZPDef.SendCardType.ONE_FIVE_TEN
  530. or sendCardType == ZPDef.SendCardType.ONE_TWO_THREE
  531. or sendCardType == ZPDef.SendCardType.DA_ZI_TWO_AND_ONE
  532. or sendCardType == ZPDef.SendCardType.SHUN_ZI then
  533. return ZPDef.XiaoJuWeaveCardType.CHI
  534. elseif sendCardType == ZPDef.SendCardType.DUI_THREE_SAME then
  535. return ZPDef.XiaoJuWeaveCardType.PENG
  536. elseif sendCardType == ZPDef.SendCardType.KAN_THREE_SAME or sendCardType == ZPDef.SendCardType.DIRTY_THREE_SAME then
  537. return ZPDef.XiaoJuWeaveCardType.WEI
  538. 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
  539. return ZPDef.XiaoJuWeaveCardType.ZHAO
  540. elseif sendCardType == ZPDef.SendCardType.GUN_ZI_FOUR_SAME or sendCardType == ZPDef.SendCardType.CHI_PAI_TI then
  541. return ZPDef.XiaoJuWeaveCardType.LONG
  542. elseif sendCardType == ZPDef.SendCardType.ZHUANG_ZI then
  543. return ZPDef.XiaoJuWeaveCardType.JIANG
  544. elseif sendCardType == ZPDef.SendCardType.KANPAI_LOCAL then
  545. return ZPDef.XiaoJuWeaveCardType.KAN
  546. else
  547. local txt = string.format("发牌类型为:"..sendCardType)
  548. --showTooltip(txt)
  549. return ""
  550. end
  551. end
  552. function xichongRoomXiaoJuView:initOtherData()
  553. local roomInfo = app.room.roomInfo
  554. local winUserId = app.room.roomInfo.winUserId
  555. --规则
  556. self.ui.Items.Text_Rule:setText(ZPWanFa.getRuleInfo(roomInfo.strGameInfo))
  557. --时间
  558. self.ui.Items.Text_Time:setText(getTimeString())
  559. --房号
  560. self.ui.Items.Text_RoomNum:setText("房号:"..tostring(app.room.roomInfo.nShowTableId))
  561. end
  562. function xichongRoomXiaoJuView:updateUserHead(nodeHead,nUserId, sex, headimgurl)
  563. setPlayerHeadImage(nUserId, headimgurl, nodeHead);
  564. end
  565. -- 查牌
  566. function xichongRoomXiaoJuView:onClickChaPai()
  567. playBtnEffect()
  568. self:setVisible(false)
  569. end
  570. -- 下一局
  571. function xichongRoomXiaoJuView:onClickNext()
  572. playBtnEffect()
  573. self.ui:sendMsg(app.room, "callReadyRequest");
  574. if self.nextCallBack then
  575. self.nextCallBack()
  576. end
  577. end
  578. function xichongRoomXiaoJuView:onClickZongJieSuan()
  579. playBtnEffect()
  580. if self.nextCallBack then
  581. self.nextCallBack()
  582. end
  583. end
  584. function xichongRoomXiaoJuView:getAHutypeTextUi(text)
  585. local hutext = cc.Text:createNode()
  586. hutext:setDefaults()
  587. local config = hutext:getFontConfig()
  588. config.fontSize = 22
  589. config.texColor = cc.c3b(255,240,179)--cc.c4b(251,213,130,255)
  590. hutext:setFontConfig(config)
  591. hutext:setText(tostring(text))
  592. return hutext
  593. end
  594. function xichongRoomXiaoJuView:getXiaojiaUid()
  595. return app.room:getUserIdBySeatId(app.room.roomInfo.xiaoSeatId)
  596. end
  597. --显示胡牌类型
  598. --[[function xichongRoomXiaoJuView:getHuTypesStr(huUid,huType)
  599. local strSpec = ""
  600. if huType > 0 then
  601. local ret = getNumBand(huType,ZPDef.HuType.TIAN_HU)
  602. if ret > 0 then
  603. strSpec = strSpec.."天胡x2 "
  604. end
  605. local ret = getNumBand(huType,ZPDef.HuType.LONG_HU)
  606. if ret > 0 then
  607. strSpec = strSpec.."龙胡x1 "
  608. end
  609. local ret = getNumBand(huType,ZPDef.HuType.TUO_HONG_HU)
  610. if ret > 0 then
  611. if huUid == self:getXiaojiaUid() then
  612. strSpec = strSpec.."坨坨红x1 "
  613. else
  614. strSpec = strSpec.."坨坨红x3 "
  615. end
  616. end
  617. local ret = getNumBand(huType,ZPDef.HuType.HEI_LONG_HU)
  618. if ret > 0 then
  619. strSpec = strSpec.."黑龙x1 "
  620. end
  621. local ret = getNumBand(huType,ZPDef.HuType.CHI_PIAO)
  622. if ret > 0 then
  623. strSpec = strSpec.."吃飘x1 "
  624. end
  625. local ret = getNumBand(huType,ZPDef.HuType.XIAO_HU)
  626. if ret > 0 then
  627. strSpec = strSpec.."小胡 "
  628. end
  629. local ret = getNumBand(huType,ZPDef.HuType.TUO_HEI_HU)
  630. if ret > 0 then
  631. if huUid == self:getXiaojiaUid() then
  632. strSpec = strSpec.."坨坨黑x1 "
  633. else
  634. strSpec = strSpec.."坨坨黑x3 "
  635. end
  636. end
  637. local ret = getNumBand(huType,ZPDef.HuType.BAO_HU)
  638. if ret > 0 then
  639. strSpec = strSpec.."报叫x1 "
  640. end
  641. end
  642. --另加番
  643. if app.room.roomInfo.fourHongNum > 0 or app.room.roomInfo.fourNormolNum > 0 then
  644. local num = app.room.roomInfo.fourHongNum + app.room.roomInfo.fourNormolNum
  645. strSpec = strSpec.."四张x"..num.." "
  646. end
  647. if app.room.roomInfo.threeHongNum > 0 or app.room.roomInfo.fourHongNum > 0 then
  648. local num = app.room.roomInfo.fourHongNum + app.room.roomInfo.threeHongNum
  649. strSpec = strSpec.."冲番牌x"..num.." "
  650. end
  651. return strSpec
  652. end--]]
  653. return xichongRoomXiaoJuView