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.

1185 line
37 KiB

  1. local MJ=MJFramework.MJImport("mj.luaScript.Views.Game.MJ")
  2. local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine")
  3. local MJGroupFactory=MJFramework.MJImport("mj.luaScript.Views.Game.MJGroupFactory")
  4. local MJPositionCompnent = MJFramework.MJImport("mj.luaScript.Views.Compnent.MJPositionCompnent")
  5. local MJMessage=MJFramework.MJImport("mj.luaScript.Protocol.MJMessage")
  6. local MJHandCardView=MJFramework.MJFrameworkClassImprot("mj.luaScript.Views.Game.MJHandCardView")
  7. local MJSound = MJFramework.MJImport("mj.luaScript.MJSound")
  8. local linshuiHandCardView = class("linshuiHandCardView", MJHandCardView)
  9. function linshuiHandCardView:ctor(viewId,desktopType)
  10. linshuiHandCardView.super.ctor(self,viewId,desktopType)
  11. end
  12. function linshuiHandCardView:loadUI()
  13. local ui
  14. if self.desktopType==MJDefine.DesktopType.TwoD or self.desktopType==MJDefine.DesktopType.TwoDGold or self.desktopType==MJDefine.DesktopType.TwoDL then
  15. ui = loadUI("mj_linshui/res/ui_fangjian/mj_linshui_hand_card_2d.ui");
  16. else
  17. ui = loadUI("mj_linshui/res/ui_fangjian/mj_linshui_hand_card.ui");
  18. end
  19. self.ui = ui;
  20. self:addChild(ui)
  21. end
  22. function linshuiHandCardView:initView()
  23. if self:isUseNew3D() then
  24. self:initNew3DUI()
  25. else
  26. linshuiHandCardView.super.initView(self)
  27. self:hideOperateItem()
  28. local playerCount = app.room:getMaxPlayerCount()
  29. local startPos = MJDefine.MJConfig_2d.OutCardStartPos[self.viewId]
  30. if playerCount == 2 then
  31. startPos = MJDefine.MJConfig_2d.OutCardStartPos2[self.viewId]
  32. end
  33. self.outX=startPos.x
  34. self.outY=startPos.y
  35. end
  36. end
  37. ---
  38. -- 初始化新3d牌
  39. --
  40. function linshuiHandCardView:initNew3DUI()
  41. self:loadUI()
  42. if self.ui.Items.Layout_Hand_Card then
  43. self.ui.Items.Layout_Hand_Card:setVisible(false)
  44. end
  45. if self.ui.Items.Layout_OperateItem then
  46. self.ui.Items.Layout_OperateItem:setVisible(false)
  47. end
  48. if self.ui.Items.Button_Sure then
  49. self.ui.Items.Button_Sure:setVisible(false)
  50. end
  51. local MJConfig = MJDefine.MJConfig_2d
  52. if self.desktopType == MJDefine.DesktopType.ThreeD then
  53. MJConfig = MJDefine.MJConfig_3d
  54. end
  55. local MahjongHandCard = require(MJConfig.HANDCARD_VIEW)
  56. local MahjongOutCardView = require(MJConfig.OUTCARD_VIEW)
  57. local MahjongHuCardView = require(MJConfig.HU_CARD_VIEW)
  58. self._huCardView = MahjongHuCardView:new(self.viewId)
  59. self:addChild(self._huCardView)
  60. self._handcard = MahjongHandCard:new(self.viewId, self.desktopType)
  61. self:addChild(self._handcard)
  62. self._outCardView = MahjongOutCardView:new(self.viewId)
  63. self:addChild(self._outCardView)
  64. self.ui:setLocalZOrder(10)
  65. end
  66. function linshuiHandCardView:pushTing()
  67. local groupCards
  68. if self:isUseNew3D() then
  69. self._handcard:pushTing()
  70. groupCards = self._handcard._groupNodes
  71. else
  72. local tings=app.room.roomInfo.tings
  73. if tings then
  74. for k,v in pairs(tings) do
  75. for _,mj in pairs(self.handCards) do
  76. if mj.value==v.outCard then
  77. mj:setTing(true)
  78. end
  79. end
  80. end
  81. end
  82. groupCards = self.handGroupCards
  83. end
  84. end
  85. --摸牌
  86. function linshuiHandCardView:onGetCard(operates,card,isSwap)
  87. if self:isUseNew3D() then
  88. self.touchMJ = nil
  89. self:createHandCards(card)
  90. self:setPaoCard(true)--为了标记摸到的牌也是炮牌
  91. if not operates or table.nums(operates) == 0 then
  92. self._handcard:setOutCardEnable(true)
  93. MJDefine.outCardSendGuo = false
  94. else
  95. self._handcard:setOutCardEnable(true)
  96. MJDefine.outCardSendGuo = true
  97. -- self:canOutCard(true)
  98. end
  99. if self.viewId==MJDefine.MyViewId then
  100. MJSound.PlayGetCard()
  101. end
  102. else
  103. if self.viewId==MJDefine.MyViewId then
  104. self:resetHandCardsPosAndOpacity()
  105. end
  106. self:createHandCards(card)
  107. self:setPaoCard(true)--为了标记摸到的牌也是炮牌
  108. self:resetCardsSortValue()--为了给刚摸上的牌重新赋值排序值
  109. if self.viewId==MJDefine.PlayerViewType.Right and not self.isReplay then
  110. self:resetHandCards()
  111. end
  112. if isSwap and isSwap == true then return end --如果是换牌阶段,返回
  113. if not operates or table.nums(operates)==0 then
  114. self:setOutCardEnable(true)
  115. MJDefine.outCardSendGuo = false
  116. else
  117. self:setOutCardEnable(true)
  118. self:moveLastCard()
  119. MJDefine.outCardSendGuo = true
  120. -- self:canOutCard(true)
  121. end
  122. if self.viewId==MJDefine.MyViewId then
  123. MJSound.PlayGetCard()
  124. end
  125. end
  126. end
  127. function linshuiHandCardView:setOutCardEnable(b)
  128. if self:isUseNew3D() then
  129. self._handcard:setOutCardEnable(b)
  130. else
  131. self.isOutCard=b
  132. if b then
  133. self:moveLastCard()
  134. end
  135. if self.viewId==MJDefine.MyViewId and self.ui.Items.Button_Sure then
  136. -- self.ui.Items.Button_Sure:setVisible(b)
  137. end
  138. end
  139. end
  140. --不管是否自动对齐,红中始终保持放在最左边
  141. function linshuiHandCardView:sortRedMahjong()
  142. local redNum = 0
  143. for k,mj in pairs(self.handCards) do
  144. if mj.value == 65 then
  145. redNum = redNum + 1
  146. table.remove(self.handCards,k)
  147. table.insert(self.handCards,redNum,mj)
  148. end
  149. end
  150. end
  151. function linshuiHandCardView:removeHandCardByNum(value,num,redNum)
  152. redNum = redNum or 0
  153. if self:isUseNew3D() then
  154. self._handcard:removeHandCardByNum(value, num,redNum)
  155. else
  156. if self.viewId==MJDefine.MyViewId or self.isReplay then
  157. for i=1,num do
  158. local mj
  159. if redNum > 0 and i <= redNum then
  160. mj=self:getMjByValue(65) --红中值
  161. else
  162. mj=self:getMjByValue(value)
  163. end
  164. if mj then
  165. table.removeItem(self.handCards,mj)
  166. mj:removeFromParent()
  167. end
  168. end
  169. else
  170. -- local num=#self.handCards-#arg
  171. -- print(num)
  172. for i=#self.handCards,#self.handCards-num+1,-1 do
  173. if self.handCards[i] then
  174. self.handCards[i]:removeFromParent()
  175. table.remove(self.handCards,i)
  176. end
  177. end
  178. end
  179. end
  180. end
  181. function linshuiHandCardView:getGroup(card,opType)
  182. if self:isUseNew3D() then
  183. return self._handcard:getGroup(card, opTypes)
  184. else
  185. for k,v in pairs(self.handGroupCards) do
  186. if v.opType==opType and (v.mjs[1].value==card or v.mjs[2].value == card or v.mjs[3].value == card) then
  187. local redNum = 0
  188. for i,mj in pairs(v.mjs) do
  189. --先取出原组合的红中个数
  190. if mj.value == 65 then
  191. redNum = redNum + 1
  192. end
  193. end
  194. return v,redNum
  195. end
  196. end
  197. end
  198. end
  199. function linshuiHandCardView:createGroupCards(arg,fromViewId)
  200. if self:isUseNew3D() then
  201. self._handcard:createGroupCards(arg, fromViewId)
  202. else
  203. local x=self.initX
  204. local y=self.initY
  205. local MJGroupStartOffSet = MJDefine.MJGroupStartOffSet[self.desktopType]
  206. for k,v in pairs(arg) do
  207. if not fromViewId then
  208. fromViewId = v.fromViewId
  209. end
  210. local group=MJGroupFactory.CreateGroup(v.values,v.showType,self.viewId,self.desktopType,v.redNum)
  211. if group then
  212. --设置碰杠来源
  213. --group:setDirection(self.viewId,v.fromViewId1)
  214. if group.setAnColor and (v.opType == MJDefine.MJOperateType.OPREATE_PENG
  215. or v.opType == MJDefine.MJOperateType.OPREATE_ZHIGANG
  216. or v.opType == MJDefine.MJOperateType.OPREATE_BAGANG) then
  217. --牌的阴影显示刚好和视图id相反
  218. if v.fromViewId == 1 then v.fromViewId = 3
  219. elseif v.fromViewId==3 then v.fromViewId = 1 end
  220. -- 杠牌对家,换成第四张
  221. if v.opType ~= MJDefine.MJOperateType.OPREATE_PENG then
  222. if v.fromViewId==2 then v.fromViewId = 4 end
  223. end
  224. group:setAnColor(v.opCard, v.fromViewId)
  225. end
  226. if v.opType == MJDefine.MJOperateType.OPREATE_BAGANG and group.mjs and group.mjs[4] then
  227. group.mjs[4]:setOutBlackImage(0,self.viewId)
  228. end
  229. group.fromViewId = v.fromViewId ---保留触发操作的玩家位置,补杠需要
  230. group.opType=v.opType
  231. self.ui.Items.Layout_Hand_Card:addChild(group,-4+#self.handGroupCards)
  232. group:setPosition(cc.p(x+MJGroupStartOffSet[self.viewId].x,y+MJGroupStartOffSet[self.viewId].y))
  233. x,y=MJPositionCompnent.getGroupPosition(self.viewId,x,y,group,self.desktopType)
  234. table.insert(self.handGroupCards,group)
  235. end
  236. end
  237. --更新起始位置
  238. self.initX=x
  239. self.initY=y
  240. end
  241. end
  242. --添加杠操作按钮
  243. function linshuiHandCardView:addOperateBtn(operates,isCanHu)
  244. local x=self.ui.Items.Layout_Operate:getContentSize().width
  245. local y=self.ui.Items.Layout_Operate:getContentSize().height/2
  246. local btnOperate=cc.Button:createNode()
  247. btnOperate:setDefaults()
  248. btnOperate:setText("")
  249. btnOperate:loadTextureNormal(MJDefine.MJOperateImage[operates[1].opType])
  250. btnOperate:ignoreAnchorPointForPosition(false)
  251. self.btnPosX = self.btnPosX-MJDefine.MJ_OPERATE_PADDING
  252. btnOperate:setPosition(cc.p(self.btnPosX, y))
  253. self.ui.Items.Layout_Operate:addChild(btnOperate,2)
  254. if operates and table.nums(operates) <=1 then
  255. --self.btnPosX = self.btnPosX-50
  256. btnOperate:setPosition(cc.p(self.btnPosX, y))
  257. local gangBg = cc.Layout:create()
  258. gangBg:setBackGroundImageScale9Enabled(true)
  259. gangBg:setBackGroundImage("mj_linshui/res/zy_fangjian/linshuiadd/linshui_room_gangBg1.png",0)
  260. --gangBg:setOpacity(150)
  261. --gangBg:setPosition(cc.p(btnOperate:getPositionX()+30, y-40))
  262. gangBg:setPosition(cc.p(btnOperate:getPositionX()-52, y+50))
  263. gangBg:setSize(cc.size(70,90))
  264. gangBg:setScale(1.3)
  265. self.ui.Items.Layout_Operate:addChild(gangBg,5)
  266. gangBg:registerClick(function(sender)
  267. self:sendOp({opType = operates[1].opType,opCard = operates[1].opCard,redNum = operates[1].redNum})
  268. end)
  269. local mj
  270. local linshui_mj_color = loadUserInfo("mj_linshui_desktop_2d_mjType") or MJDefine.DesktopType.TwoDL
  271. local CardClass
  272. --if linshui_mj_color == "2dl" then
  273. -- CardClass = require("mj_linshui.luaScript.Views.2d.Card_2d_L")
  274. -- mj = CardClass:new(operates[1].opCard, 4, MJDefine.MJConfig_2d.MJType.Out, 1)
  275. --else
  276. mj=MJ:new(operates[1].opCard,MJDefine.MJType.Out,MJDefine.MyViewId,self.desktopType)
  277. --end
  278. --mj:setScale(0.7)
  279. mj:setAnchorPoint(cc.p(0.5,0.5))
  280. gangBg:addChild(mj)
  281. --self.ui.Items.Layout_Operate:addChild(mj)
  282. mj:setPosition(cc.p(gangBg:getContentSize().width/2, gangBg:getContentSize().height/2))
  283. --mj:setPosition(cc.p(btnOperate:getPositionX()-6, y+90))
  284. end
  285. local function qiHuConfirm()
  286. local content = string.format("确定放弃胡牌吗?")
  287. local okCallBack = function ()
  288. if operates and table.nums(operates) <=1 then
  289. self:sendOp({opType = operates[1].opType,opCard = operates[1].opCard,redNum = operates[1].redNum})
  290. else
  291. self:showGangItem(operates)
  292. end
  293. end
  294. local cancelCallBack = function ()
  295. end
  296. showConfirmDialog(content,okCallBack,cancelCallBack)
  297. end
  298. if isCanHu and isCanHu == true then
  299. btnOperate:registerClick(qiHuConfirm)
  300. else
  301. btnOperate:registerClick(function()
  302. -- playBtnEffect()
  303. if operates and table.nums(operates) <=1 then
  304. self:sendOp({opType = operates[1].opType,opCard = operates[1].opCard,redNum = operates[1].redNum})
  305. else
  306. self:showGangItem(operates)
  307. end
  308. end)
  309. end
  310. end
  311. function linshuiHandCardView:showGangItem(operates)
  312. self.ui.Items.Layout_OperateItem:setVisible(true)
  313. self.ui.Items.Layout_Operate_Content:removeAllChildren()
  314. local col = 0
  315. local count = 6
  316. for k,v in pairs(operates) do
  317. local item = self.ui.Items.Layout_MJ_Item:getCopied()
  318. local mj=MJ:new(v.opCard,MJDefine.MJType.Stand,self.viewId,self.desktopType)
  319. item:addChild(mj)
  320. local size = item:getContentSize()
  321. mj:setPosition(cc.p(size.width/2,size.height/2))
  322. self.ui.Items.Layout_Operate_Content:addChild(item)
  323. mj:registerClick(function()
  324. self:sendOp({opType = v.opType,opCard = v.opCard,redNum = v.redNum})
  325. end)
  326. -- local col = k
  327. local row = math.ceil(k/count)
  328. -- logD(k.." :".. (k%count))
  329. -- local isChangeRow = k%count==0
  330. local x = self.ui.Items.Layout_Operate_Content:getContentSize().width-col*133
  331. local y = (row-1)*size.height
  332. item:setPositionX(x)
  333. item:setPositionY(y)
  334. col = col+1
  335. if k%count==0 then
  336. col = 0
  337. end
  338. end
  339. -- local count = table.nums(operates)
  340. -- local padding=10
  341. -- local width=self.ui.Items.Layout_OperateItem:getContentSize().width
  342. -- local height=self.ui.Items.Layout_OperateItem:getContentSize().height
  343. -- local layoutItem = cc.Layout:create()
  344. -- layoutItem:setBackGroundImageScale9Enabled(true)
  345. -- --layoutItem:setBackGroundImage("mj/res/ui/zy_fangjian/mj_gang_bg.png")
  346. -- layoutItem:setAnchorPoint(cc.p(0.5,1))
  347. -- self.ui.Items.Layout_OperateItem:addChild(layoutItem)
  348. -- if count <= 3 then
  349. -- layoutItem:setSize(cc.size(230*count+padding*count,height+padding))
  350. -- else
  351. -- layoutItem:setSize(cc.size(230*3+padding*3,height*(math.floor(count/3)+1)+(math.floor(count/3)+1)*padding))
  352. -- --self.ui.Items.Layout_OperateItem:setSize(cc.size(230*3+padding*3,height*(math.floor(count/3)+1)+(math.floor(count/3)+1)*padding))
  353. -- end
  354. -- layoutItem:setPosition(cc.p(width/2,height))
  355. -- local layoutHeight = layoutItem:getContentSize().height
  356. -- local y = 0
  357. -- for k,v in ipairs(operates) do
  358. -- local layout=cc.Layout:create()
  359. -- layout:setBackGroundImageScale9Enabled(true)
  360. -- layout:setBackGroundImage("mj/res/ui/zy_fangjian/mj_gang_bg.png")
  361. -- self.ui.Items.Layout_OperateItem:addChild(layout)
  362. -- layout:setSize(cc.size(230,height))
  363. -- layout:setAnchorPoint(cc.p(0,1))
  364. -- if k%3 == 1 then
  365. -- y = layoutHeight -15- height*(math.floor(k/3)+1)-10*(math.floor(k/3)+1)
  366. -- end
  367. -- if count < 3 then
  368. -- layout:setPosition(cc.p(-145+padding*(k-1)+230*(k-1),layoutHeight-15))
  369. -- elseif count == 3 then
  370. -- layout:setPosition(cc.p(-260+padding*(k-1)+230*(k-1),layoutHeight-15))
  371. -- else
  372. -- layout:setPosition(cc.p(-260+padding*(k%3-1)+230*(k%3-1),y))
  373. -- if k%3 == 0 then
  374. -- layout:setPosition(cc.p(-260+padding*2+230*2,y))
  375. -- end
  376. -- end
  377. -- for i=1,4 do
  378. -- local mj
  379. -- if v.redNum > 0 and i<=v.redNum then
  380. -- mj=MJ:new(65,MJDefine.MJType.Stand,self.viewId,self.desktopType)
  381. -- else
  382. -- mj=MJ:new(v.opCard,MJDefine.MJType.Stand,self.viewId,self.desktopType)
  383. -- end
  384. -- mj:setScale(0.6)
  385. -- layout:addChild(mj)
  386. -- local mjWidth = mj:getContentSize().width*0.6
  387. -- mj:setAnchorPoint(cc.p(0.5,0.5))
  388. -- mj:setPosition(32+3*(i-1)+mjWidth*(i-1),layout:getContentSize().height/2)
  389. -- end
  390. -- layout:registerClick(function ( sender )
  391. -- self:sendOp({opType = v.opType,opCard = v.opCard,redNum = v.redNum})
  392. -- end)
  393. -- end
  394. end
  395. function linshuiHandCardView:hideOperateItem()
  396. if self.ui.Items.Layout_OperateItem then
  397. self.ui.Items.Layout_Operate_Content:removeAllChildren()
  398. self.ui.Items.Layout_OperateItem:setVisible(false)
  399. end
  400. end
  401. --显示操作
  402. function linshuiHandCardView:showOperate(operates,card,isMyGetCard)
  403. if not operates or table.nums(operates)==0 then return end
  404. print(table.tostring(operates))
  405. local card = card or 0
  406. self:hideOperateItem()
  407. self:hideOperate()
  408. if operates and table.nums(operates) > 0 then
  409. self.ui.Items.Button_Sure:setVisible(false)
  410. end
  411. local newOperates = {}
  412. --有操作默认添加过的操作
  413. local operate=MJMessage.OperateRequest:new()
  414. operate.opType=MJDefine.MJOperateType.OPREATE_CANCEL
  415. operate.opCard=card
  416. operate.sortValue=0
  417. operate.redNum = 0
  418. --table.insert(operates.Datas,1,operate)
  419. table.insert(newOperates,1,operate)
  420. self.ui.Items.Layout_Operate:removeAllChildren()
  421. self.ui.Items.Layout_Operate:setVisible(true)
  422. local x=self.ui.Items.Layout_Operate:getContentSize().width
  423. local y=self.ui.Items.Layout_Operate:getContentSize().height/2
  424. self.btnPosX = x
  425. local gangCards ={} --所有杠組合
  426. local onceGang = false
  427. local onceTang = false
  428. local isCanHu = false
  429. --增加排序标签
  430. for k,v in pairs(operates.Datas) do
  431. if (v.opType == MJDefine.MJOperateType.OPREATE_DIANPAOHU) or (v.opType == MJDefine.MJOperateType.OPREATE_ZIMOHU) then
  432. v.sortValue = 1
  433. --v.Datas.sortValue = 1
  434. elseif (v.opType==MJDefine.MJOperateType.OPREATE_ZHIGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_BAGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_ANGANG) then
  435. v.sortValue = 2
  436. --v.Datas.sortValue = 2
  437. elseif (v.opType==MJDefine.MJOperateType.OPREATE_PENG) then
  438. v.sortValue = 3
  439. else--OPREATE_QIANG_GANG_HU
  440. v.sortValue = 4
  441. --v.Datas.sortValue = 3
  442. end
  443. end
  444. --operates.Datas包含所有碰杠组合,服务器不管是否贴鬼碰/杠,需客户端自己分离贴鬼碰和无贴鬼碰
  445. for k,v in pairs(operates.Datas) do
  446. if v.opType ~= MJDefine.MJOperateType.OPREATE_CANCEL then
  447. if MJDefine.isTieGui == true then --选择贴鬼碰/杠
  448. if (v.opType == MJDefine.MJOperateType.OPREATE_PLACE_CARD) or (v.opType == MJDefine.MJOperateType.OPREATE_DIANPAOHU) or (v.opType == MJDefine.MJOperateType.OPREATE_ZIMOHU) or onceGang == false then
  449. if (v.opType == MJDefine.MJOperateType.OPREATE_DIANPAOHU) or (v.opType == MJDefine.MJOperateType.OPREATE_ZIMOHU) then
  450. isCanHu = true
  451. --[[self:runAction(cc.Sequence:create(cc.DelayTime:create(1.5),cc.CallFunc:create(function()
  452. self:sendOp(v)--胡牌自动胡牌
  453. end)))--]]
  454. end
  455. table.insert(newOperates,v)
  456. end
  457. if (v.opType==MJDefine.MJOperateType.OPREATE_ZHIGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_BAGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_ANGANG) then
  458. --onceGang = true
  459. table.insert(gangCards,v)
  460. end
  461. else
  462. if (v.opType == MJDefine.MJOperateType.OPREATE_PLACE_CARD) or (v.opType == MJDefine.MJOperateType.OPREATE_DIANPAOHU) or (v.opType == MJDefine.MJOperateType.OPREATE_ZIMOHU) then
  463. isCanHu = true
  464. table.insert(newOperates,v)
  465. end
  466. --不勾选贴鬼碰/杠时,过滤掉带红中的碰杠
  467. if v.redNum == 0 and v.opType ~= MJDefine.MJOperateType.OPREATE_DIANPAOHU and (v.opType ~= MJDefine.MJOperateType.OPREATE_ZIMOHU) then
  468. if onceGang == false then
  469. table.insert(newOperates,v)
  470. end
  471. if (v.opType==MJDefine.MJOperateType.OPREATE_ZHIGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_BAGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_ANGANG) then
  472. --onceGang = true
  473. table.insert(gangCards,v)
  474. end
  475. end
  476. end
  477. end
  478. end
  479. if isCanHu and isCanHu == true then
  480. self:setOutCardEnable(false)
  481. end
  482. print(table.tostring(newOperates))
  483. if table.nums(newOperates) >= 2 then
  484. local function sortOperate(opA,opB)
  485. if opA.sortValue and opB.sortValue then
  486. if opA.sortValue<opB.sortValue then
  487. return true
  488. elseif opA.sortValue==opB.sortValue then
  489. if opA.opCard<opB.opCard then
  490. return true
  491. end
  492. end
  493. end
  494. return false
  495. end
  496. table.sort(newOperates,sortOperate)
  497. --没有碰杠操作,此条件只有不勾选贴鬼碰/杠才可能会执行
  498. else
  499. --[[--如果不是自己摸牌的情况下
  500. if not isMyGetCard then --app.room.roomInfo.outCardUserId~=app.room:getMyUserId() then --
  501. print("not isMyGetCard")
  502. self:sendOp({opType = MJDefine.MJOperateType.OPREATE_CANCEL,opCard=card,redNum=0})
  503. MJDefine.isSendGuo = true
  504. return;
  505. end
  506. --是自己摸牌
  507. self:hideOperate()
  508. self:setOutCardEnable(true)
  509. logD("linshuiHandCardView:showOperate setOutCardEnable true")--]]
  510. end
  511. local pengCard = {}
  512. for k,v in pairs(newOperates) do
  513. if MJDefine.MJOperateImage[v.opType] then
  514. if(v.opType==MJDefine.MJOperateType.OPREATE_ZHIGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_BAGANG) or (v.opType==MJDefine.MJOperateType.OPREATE_ANGANG) then
  515. self:addOperateBtn({v},isCanHu)
  516. elseif v.opType==MJDefine.MJOperateType.OPREATE_PENG then
  517. table.insert(pengCard,v)
  518. self:addOperateBtn(pengCard,isCanHu)
  519. elseif (v.opType~=MJDefine.MJOperateType.OPREATE_ZHIGANG) or (v.opType~=MJDefine.MJOperateType.OPREATE_BAGANG) or (v.opType~=MJDefine.MJOperateType.OPREATE_ANGANG) or (v.opType~=MJDefine.MJOperateType.OPREATE_PENG) then
  520. local btnOperate=cc.Button:createNode()
  521. btnOperate:setDefaults()
  522. btnOperate:setText("")
  523. btnOperate:loadTextureNormal(MJDefine.MJOperateImage[v.opType])
  524. btnOperate:ignoreAnchorPointForPosition(false)
  525. self.btnPosX = self.btnPosX-MJDefine.MJ_OPERATE_PADDING
  526. btnOperate:setPosition(cc.p(self.btnPosX, y))
  527. self.ui.Items.Layout_Operate:addChild(btnOperate)
  528. if isCanHu and isCanHu == true and v.opType == MJDefine.MJOperateType.OPREATE_CANCEL then
  529. local function qiHuConfirm()
  530. local content = string.format("确定放弃胡牌吗?")
  531. local okCallBack = function ()
  532. self:sendOp(v)
  533. end
  534. local cancelCallBack = function ()
  535. end
  536. showConfirmDialog(content,okCallBack,cancelCallBack)
  537. end
  538. btnOperate:registerClick(qiHuConfirm)
  539. else
  540. if v.opType == MJDefine.MJOperateType.OPREATE_PLACE_CARD then--摆牌
  541. btnOperate:registerClick(function()
  542. local handCards = {}
  543. self:tangCardEnabled(true)
  544. local function quxiaoCallback()
  545. if self.baopai and self.baopai == 1 then
  546. self:tangCardEnabled(true)
  547. self:setIsTanging(false)
  548. else
  549. self:tangCardEnabled(false)
  550. end
  551. self.ui.Items.Layout_Operate:setVisible(true)
  552. end
  553. if not self.tangView or tolua.isnull(self.tangView) then
  554. self.tangView = import("mj_linshui.luaScript.Views.Compnent.linshuiTangView"):new(handCards,self.desktopType)
  555. self.tangView:setQuXiaoCallBack(quxiaoCallback)
  556. self.tangView:showCancelBtnOnly()
  557. --self.tangView:setPosition()
  558. self:addChild(self.tangView)
  559. else
  560. self.tangView:showCancelBtnOnly()
  561. end
  562. self.ui.Items.Layout_Operate:setVisible(false)
  563. end)
  564. else
  565. btnOperate:registerClick(function()
  566. -- playBtnEffect()
  567. self:sendOp(v)
  568. end)
  569. end
  570. end
  571. end
  572. end
  573. end
  574. end
  575. function linshuiHandCardView:sendOp(value)
  576. local request = MJMessage.OperateRequest:new()
  577. request.opType = value.opType
  578. request.opCard = value.opCard
  579. request.redNum = value.redNum
  580. logE("linshuiHandCardView:sendOp"..table.tostring(request))
  581. self.ui:sendMsg(app.room, MJDefine.MJEvent.Operate, request, function(status, response)
  582. logE("MJHandCardView showOperate() response = ", table.tostring(response))
  583. end)
  584. self:hideOperateItem()
  585. self:hideOperate()
  586. if value.opType == MJDefine.MJOperateType.OPREATE_CANCEL then
  587. app.room:dispatchEvent({name = MJDefine.MJEvent.SendGuo})
  588. end
  589. --self:setTing(false)
  590. --app.room:resetTings()
  591. end
  592. --发送出牌消息
  593. function linshuiHandCardView:sendOutCard()
  594. if not self.isOutCard or not self.touchMJ then return end
  595. self:hideOperate()
  596. -- if MJDefine.outCardSendGuo == true then
  597. -- self:sendOp({opType = MJDefine.MJOperateType.OPREATE_CANCEL,opCard=0,redNum=0})
  598. -- -- self:runDelay(0.1,function()
  599. -- linshuiHandCardView.super.sendOutCard(self)
  600. -- -- end)
  601. -- else
  602. linshuiHandCardView.super.sendOutCard(self)
  603. -- end
  604. app.room.roomInfo.lastOutViewId = MJDefine.MyViewId
  605. self:checkQueAndDisableOtherCard()
  606. end
  607. --插牌动画
  608. function linshuiHandCardView:runInsertCardAction()
  609. self:resetHandCards()
  610. end
  611. --恢复麻将位置和透明度
  612. function linshuiHandCardView:resetHandCardsPosAndOpacity()
  613. local initX,initY=self:getInitHandCardPostion()
  614. local x=initX
  615. local y=initY
  616. local insertX=0
  617. local insertY=0
  618. if MJDefine.isAutomatic == true then
  619. self:sortHandCards()
  620. else
  621. end
  622. for k,mj in pairs(self.handCards) do
  623. mj:setPosition(x,y)
  624. mj:setOpacity(255)
  625. x,y=MJPositionCompnent.getHandCardPosition(self.viewId,initX,initY,mj,k,self.desktopType)
  626. end
  627. return insertX,insertY
  628. end
  629. function linshuiHandCardView:resetHandCards(insertMj,isAnimation)
  630. if self:isUseNew3D() then
  631. self._handcard:resetHandCards(insertMj,isAnimation)
  632. else
  633. -- local initX=self.initX
  634. -- local initY=self.initY
  635. local initX,initY=self:getInitHandCardPostion()
  636. local x=initX
  637. local y=initY
  638. local insertX=0
  639. local insertY=0
  640. if MJDefine.isAutomatic == true then
  641. self:sortHandCards()
  642. else
  643. -- self:sortRedMahjong()
  644. end
  645. for k,mj in pairs(self.handCards) do
  646. if mj.status ~= MJDefine.MJStatus.Disable then
  647. mj:setStatus(MJDefine.MJStatus.Normal)
  648. mj:stopAllActions()
  649. end
  650. logD("k:"..k.." value:"..mj.value)
  651. if insertMj==mj then --记录插入麻将的坐标 动画需要
  652. insertX=x
  653. insertY=y
  654. else
  655. if isAnimation then
  656. mj:runAction(cc.MoveTo:create(0.1,cc.p(x,y)))
  657. else
  658. mj:setPosition(x,y)
  659. end
  660. end
  661. x,y=MJPositionCompnent.getHandCardPosition(self.viewId,initX,initY,mj,k,self.desktopType)
  662. end
  663. return insertX,insertY
  664. end
  665. end
  666. function linshuiHandCardView:moveRestHandCards(insertMj,isAnimation)
  667. local initX,initY=self:getInitHandCardPostion()
  668. local x=initX
  669. local y=initY
  670. local insertX=0
  671. local insertY=0
  672. for k,mj in pairs(self.handCards) do
  673. --如果可以出牌 最后的麻将不重置位置
  674. -- local isLastCard = self.isOutCard and k==#self.handCards
  675. -- if isLastCard then
  676. -- break
  677. -- end
  678. if mj.status ~= MJDefine.MJStatus.Disable then
  679. mj:setStatus(MJDefine.MJStatus.Normal)
  680. mj:stopAllActions()
  681. end
  682. logD("k:"..k.." value:"..mj.value)
  683. if insertMj==mj then --记录插入麻将的坐标 动画需要
  684. insertX=x
  685. insertY=y
  686. else
  687. if isAnimation then
  688. mj:runAction(cc.MoveTo:create(0.1,cc.p(x,y)))
  689. else
  690. mj:setPosition(x,y)
  691. end
  692. end
  693. x,y=MJPositionCompnent.getHandCardPosition(self.viewId,initX,initY,mj,k,self.desktopType)
  694. end
  695. return insertX,insertY
  696. end
  697. --[[function linshuiHandCardView:onTouchEnd(touch)
  698. if MJDefine.isAutomatic == false then
  699. local touchPos=self:convertToNodeSpace(touch:getLocation())
  700. local newHandCards = {}
  701. for k,mj in pairs(self.handCards) do
  702. table.insert(newHandCards,k,mj)
  703. local width = mj:getContentSize().width
  704. local height = mj:getContentSize().height
  705. local x = mj:getPosition().x-width/2
  706. local y = mj:getPosition().y-height/2
  707. local rect = cc.Rectangle:new(x,y,width,height)
  708. if rect:contains(touchPos.x,touchPos.y) then
  709. if self.handCards[k] then
  710. table.remove(newHandCards,k)
  711. end
  712. if self.touchMJ and not tolua.isnull(self.touchMJ) then
  713. table.insert(newHandCards,k,self.touchMJ)
  714. end
  715. end
  716. end
  717. self.handCards = nil
  718. self.handCards = DeepCopy(newHandCards)
  719. end
  720. self:touchOutCard()
  721. end
  722. --]]
  723. function linshuiHandCardView:buGang(card,newRedNum)
  724. newRedNum = newRedNum or 0
  725. if self:isUseNew3D() then
  726. self._handcard:buGang(card, newRedNum)
  727. else
  728. local oldGroup,oldRedNum=self:getGroup(card,MJDefine.MJOperateType.OPREATE_PENG)
  729. if not oldGroup then return end
  730. local fromViewId = oldGroup.fromViewId
  731. -- 杠牌对家,换成第四张
  732. if app.room:getMaxPlayerCount()==2 and fromViewId~=0 then
  733. fromViewId = 4
  734. end
  735. if app.room:getMaxPlayerCount()==4 and fromViewId == 2 then
  736. fromViewId = 4
  737. end
  738. local redNum = newRedNum + oldRedNum
  739. local newGroup=MJGroupFactory.CreateGroup({card,card,card,card},MJDefine.MJGroupType.Gang,self.viewId,self.desktopType,redNum)
  740. if newGroup.setAnColor then
  741. newGroup:setAnColor(card, fromViewId)
  742. end
  743. newGroup.fromViewId = fromViewId
  744. newGroup.opType=MJDefine.MJOperateType.OPREATE_BAGANG
  745. newGroup:setPosition(oldGroup:getPosition())
  746. if newGroup.mjs and newGroup.mjs[4] then
  747. newGroup.mjs[4]:setOutBlackImage(0,self.viewId)
  748. end
  749. self.ui.Items.Layout_Hand_Card:addChild(newGroup)
  750. local index=table.indexOf(self.handGroupCards,oldGroup)
  751. table.remove(self.handGroupCards,index)
  752. table.insert(self.handGroupCards,index,newGroup)
  753. oldGroup:removeFromParent()
  754. end
  755. end
  756. function linshuiHandCardView:retoreBuGang(card,newRedNum)
  757. newRedNum = newRedNum or 0
  758. if self:isUseNew3D() then
  759. self._handcard:restoreBuGang(card, cardNum)
  760. else
  761. local oldGroup,oldRedNum=self:getGroup(card,MJDefine.MJOperateType.OPREATE_BAGANG)
  762. if not oldGroup then return end
  763. local fromViewId = oldGroup.fromViewId
  764. -- 杠牌对家,换成第四张
  765. if app.room:getMaxPlayerCount()==2 and fromViewId~=0 then
  766. fromViewId = 4
  767. end
  768. if app.room:getMaxPlayerCount()==4 and fromViewId == 2 then
  769. fromViewId = 4
  770. end
  771. --local redNum = newRedNum + oldRedNum
  772. local redNum = oldRedNum
  773. local newGroup=MJGroupFactory.CreateGroup({card,card,card},MJDefine.MJGroupType.Peng,self.viewId,self.desktopType,redNum)
  774. if newGroup.setAnColor then
  775. newGroup:setAnColor(card, fromViewId)
  776. end
  777. newGroup.fromViewId = fromViewId
  778. newGroup.opType=MJDefine.MJOperateType.OPREATE_PENG
  779. newGroup:setPosition(oldGroup:getPosition())
  780. self.ui.Items.Layout_Hand_Card:addChild(newGroup)
  781. local index=table.indexOf(self.handGroupCards,oldGroup)
  782. table.remove(self.handGroupCards,index)
  783. table.insert(self.handGroupCards,index,newGroup)
  784. oldGroup:removeFromParent()
  785. end
  786. end
  787. function linshuiHandCardView:lockHandCard(isForbidTouch)
  788. if self:isUseNew3D() then
  789. self._handcard:lockHandCard(isForbidTouch)
  790. else
  791. for k,v in pairs(self.handCards) do
  792. v:setStatus(MJDefine.MJStatus.Disable)
  793. end
  794. self:getEventDispatcher():removeEventListenersForTarget(self)
  795. end
  796. end
  797. function linshuiHandCardView:moveLastOpenCard()
  798. local count=#self.handCards
  799. if count>=2 then
  800. local frontMj=self.handCards[count-1]
  801. local lastMj=self.handCards[count]
  802. local margin=0
  803. local frontX=frontMj:getPositionX()
  804. local frontY=frontMj:getPositionY()
  805. local lastX=lastMj:getPositionX()
  806. local lastY=lastMj:getPositionY()
  807. local MJLastHandCardOffset=MJDefine.MJLastHandCardOffset[self.desktopType]
  808. local MJ_HAND_CARD_LEFT_PADDING_HEIGHT = MJDefine.MJ_HAND_CARD_LEFT_PADDING_HEIGHT[self.desktopType]
  809. --根据视图ID 计算坐标
  810. if self.viewId==MJDefine.PlayerViewType.My then
  811. margin=lastMj:getContentSize().width
  812. -- if math.abs(lastX-frontX)==margin then
  813. lastMj:setPositionX(lastX+MJLastHandCardOffset[self.viewId].x)
  814. -- end
  815. elseif self.viewId==MJDefine.PlayerViewType.Left then
  816. margin=MJ_HAND_CARD_LEFT_PADDING_HEIGHT
  817. -- if math.abs(lastY-frontY)==margin then
  818. lastMj:setPositionX(lastX+MJLastHandCardOffset[self.viewId].x)
  819. lastMj:setPositionY(lastY+MJLastHandCardOffset[self.viewId].y)
  820. -- end
  821. elseif self.viewId==MJDefine.PlayerViewType.Right then
  822. margin=MJ_HAND_CARD_LEFT_PADDING_HEIGHT
  823. -- if math.abs(lastY-frontY)==margin then
  824. lastMj:setPositionX(lastX+MJLastHandCardOffset[self.viewId].x)
  825. lastMj:setPositionY(lastY+MJLastHandCardOffset[self.viewId].y)
  826. -- end
  827. elseif self.viewId==MJDefine.PlayerViewType.Top then
  828. margin=lastMj:getContentSize().width-MJDefine.MJ_HAND_CARD_TOP_OFFSET_X
  829. -- print("width:"..lastMj:getContentSize().width)
  830. -- if math.abs(lastX-frontX)==margin then
  831. lastMj:setPositionX(lastX+MJLastHandCardOffset[self.viewId].x)
  832. -- end
  833. end
  834. end
  835. end
  836. function linshuiHandCardView:onTouchMove(touch)
  837. linshuiHandCardView.super.onTouchMove(self,touch)
  838. if self.touchMJ and self.isTouchMove==true then
  839. local pos = self.touchMJ:getPosition()
  840. local index = nil
  841. for k,v in pairs(self.handCards) do
  842. local width = v:getContentSize().width
  843. local height = v:getContentSize().height
  844. local x = v:getPosition().x-width/2
  845. local y = v:getPosition().y-height/2
  846. local rect = cc.Rectangle:new(x,y,width*0.8,height*0.8)
  847. --如果可以出牌 最后的麻将不参与移动操作
  848. -- local isLastCard = self.isOutCard and k==#self.handCards
  849. if rect:contains(pos.x,pos.y) and v ~=self.touchMJ and not isLastCard then
  850. index = k
  851. break
  852. end
  853. end
  854. if index then
  855. local touchMJIndex = table.indexOf(self.handCards,self.touchMJ)
  856. local offsetIndex = touchMJIndex-index
  857. local num = math.abs(offsetIndex)-1
  858. --大于0则往左移动 3-1:3-2 2-1 小于0右 5-8:5-6 6-7 7-8
  859. local reduce = offsetIndex>0 and -1 or 1
  860. for i = touchMJIndex,index-reduce,reduce do
  861. self.handCards[i],self.handCards[i+reduce] = self.handCards[i+reduce],self.handCards[i]
  862. end
  863. local x,y = self:moveRestHandCards(self.touchMJ)
  864. self.touchMJ:recordPostion(cc.p(x,y))
  865. end
  866. end
  867. end
  868. function linshuiHandCardView:touchOutCard()
  869. if self.touchMJ and self.isTouchMove then
  870. if self.touchMJ:getPositionY()>MJDefine.MJ_TOUCH_OUT_CARD_Y and self.isOutCard then
  871. self:sendOutCard()
  872. else
  873. self.touchMJ:restorePostion()
  874. self.touchMJ:setStatus(MJDefine.MJStatus.Normal)
  875. app.room:dispatchEvent({name = MJDefine.MJEvent.SelectCard})
  876. app.room:dispatchEvent({name = MJDefine.MJEvent.ShowTing})
  877. if self.isOutCard then
  878. self:moveLastCard()
  879. end
  880. end
  881. end
  882. self.isTouchMove=false
  883. end
  884. function linshuiHandCardView:outCardFalg(event)
  885. if event.viewId == MJDefine.MyViewId then
  886. self:hideOperateItem()
  887. self:hideOperate()
  888. end
  889. if self:isUseNew3D() then
  890. self._outCardView:outCardFalg(event)
  891. else
  892. for k,v in pairs(self.outCards) do
  893. for i,child in pairs(v:getChildren()) do
  894. local tag = child:getTag()
  895. if tag ~= MJ.MJ_HAND_CARD_FLAG_LAIZI then
  896. child:removeFromParent()
  897. end
  898. end
  899. end
  900. local mj=self.outCards[#self.outCards]
  901. if event.value and mj and mj.value==event.value and event.viewId==self.viewId then
  902. local flag = cc.Sprite:create()
  903. flag:setTexture("mj_linshui/res/zy_fangjian/linshui_pointer.png");
  904. -- flag:setScale(0.8)
  905. mj:addChild(flag)
  906. flag:setPosition(mj:getContentSize().width/2,mj:getContentSize().height)
  907. local moveBy=cc.MoveBy:create(0.5,cc.p(0, 30))
  908. flag:runAction(cc.RepeatForever:create(cc.Sequence:create(moveBy,moveBy:reverse())))
  909. end
  910. end
  911. end
  912. function linshuiHandCardView:getHandCardNodes()
  913. if self:isUseNew3D() then
  914. return self._handcard:getHandCardNodes()
  915. else
  916. return self.handCards
  917. end
  918. end
  919. function linshuiHandCardView:isUseNew3D()
  920. return (self.desktopType == MJDefine.DesktopType.ThreeD or self.desktopType == MJDefine.DesktopType.TwoD) and MJDefine.IS_NEW_3D
  921. end
  922. --躺成功了
  923. function linshuiHandCardView:setTangSuccess(is)
  924. linshuiHandCardView.super.setTangSuccess(self,is)
  925. if self.tangView and (not tolua.isnull(self.tangView)) then
  926. self.tangView:removeFromParent()
  927. self.tangView = nil
  928. end
  929. self.isTangCard = is
  930. end
  931. function linshuiHandCardView:showTangView(event)
  932. if self.tangView and (not tolua.isnull(self.tangView)) then
  933. local handCards = {}
  934. for k,v in pairs(self:getHandCardNodes() or {}) do
  935. table.insert(handCards,{card = v.value or v:getValue()})
  936. end
  937. --[[for i,v in pairs(handCards) do
  938. if v.card == event.card then
  939. table.remove(handCards,i)
  940. break
  941. end
  942. end--]]
  943. self.tangView:showTangView(handCards,event.card,self.desktopType)
  944. end
  945. end
  946. function MJHandCardView:createOutCards(arg)
  947. if self:isUseNew3D() then
  948. self._outCardView:createOutCards(arg)
  949. else
  950. if type(arg)=="number" then
  951. arg={
  952. {card=arg}
  953. }
  954. end
  955. for k,v in pairs(arg) do
  956. print("测试:"..v.card)
  957. local mj=MJ:new(v.card,MJDefine.MJType.Out,self.viewId,self.desktopType)
  958. self.ui.Items.Layout_Hand_Card:addChild(mj)
  959. table.insert(self.outCards,mj)
  960. local x,y=MJPositionCompnent.getOutCardPosition(self.viewId,self.outX,self.outY,mj,#self.outCards,self.desktopType,app.room:getMaxPlayerCount())
  961. mj:setPosition(x,y)
  962. end
  963. end
  964. end
  965. --玩家出牌
  966. function linshuiHandCardView:onOutCard(card,callback)
  967. if self:isUseNew3D() then
  968. self._handcard:onOutCard(card, callback)
  969. self._outCardView:onOutCard(card, callback)
  970. else
  971. self:runOutCardAction(card)
  972. if callback then
  973. callback()
  974. end
  975. if self.viewId~=MJDefine.MyViewId then --其他玩家删除最后一个牌
  976. local mj=self:getMjByValue(card)
  977. if mj then
  978. self:removeHandCard(card)
  979. self:resetHandCards()
  980. -- mj:removeFromParent()
  981. else
  982. local last=#self.handCards
  983. if last and self.handCards[last] then
  984. self.handCards[last]:removeFromParent()
  985. table.remove(self.handCards,last)
  986. end
  987. end
  988. else
  989. -- self:runOutCardAction(self.touchMJ.value)
  990. -- app.room:dispatchEvent({name = MJDefine.MJEvent.OutCardFalg,value=self.touchMJ.value,viewId=self.viewId})
  991. self:setOutCardEnable(false)
  992. local mj=self:getMjByValueReverseOrder(card)
  993. --插牌
  994. if mj==self.handCards[#self.handCards] then
  995. table.removeItem(self.handCards,mj)
  996. self:resetHandCards()
  997. else
  998. table.removeItem(self.handCards,mj)
  999. --self:runInsertCardAction()
  1000. self:resetHandCards()
  1001. end
  1002. -- self:removeHandCard(card)
  1003. -- self:resetHandCards()
  1004. if mj then
  1005. mj:removeFromParent()
  1006. mj=nil
  1007. end
  1008. end
  1009. -- local memberInfo=app.room.roomInfo.memberList[data.response.nUserId]
  1010. local userInfo=app.room:getUserInfoByViewId(self.viewId)
  1011. if userInfo and (self.viewId~=MJDefine.MyViewId or self.isReplay) then
  1012. MJSound.PlayMJSound(userInfo.sex,card)
  1013. end
  1014. end
  1015. end
  1016. --设置定缺类型 0万,1同,2条
  1017. function linshuiHandCardView:setQueType(que)
  1018. if self:isUseNew3D() then
  1019. self._handcard:setQueType(que)
  1020. else
  1021. self.queType = que
  1022. --设置完定缺牌后,重新设置一下麻将的排序值,目标为了把定缺牌放到右边
  1023. self:resetCardsSortValue()
  1024. end
  1025. end
  1026. function linshuiHandCardView:resetCardsSortValue()
  1027. for k,v in pairs(self.handCards) do
  1028. if v:getMJColorType() == self.queType then
  1029. v.sortValue = v.value + 100
  1030. end
  1031. end
  1032. end
  1033. function linshuiHandCardView:selectCard(event)
  1034. --if not self.touchMJ then return end
  1035. if event.value then
  1036. for k,v in pairs(self.outCards) do
  1037. if not tolua.isnull(v) then
  1038. if v.value==event.value then
  1039. v:setStatus(MJDefine.MJStatus.Select,true)
  1040. else
  1041. v:setStatus(MJDefine.MJStatus.Normal)
  1042. end
  1043. end
  1044. end
  1045. else
  1046. --self:setTing(false)
  1047. for k,v in pairs(self.outCards) do
  1048. if v.status~=MJDefine.MJStatus.Disable and (not tolua.isnull(v)) then
  1049. v:setStatus(MJDefine.MJStatus.Normal)
  1050. end
  1051. end
  1052. end
  1053. -- app.room:dispatchEvent({name = "showProp",response = response});
  1054. end
  1055. return linshuiHandCardView