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.

86 lines
2.8 KiB

  1. local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
  2. local MJMessage = MJFramework.MJImport("mj.luaScript.Protocol.MJMessage")
  3. local MJHandCardView = MJFramework.MJFrameworkClassImprot("mj_luzhougui.luaScript.Views.Game.luzhouguiHandCardView")
  4. local HandCardView = class("luzhouguiHandCardView_Coin", MJHandCardView)
  5. function HandCardView:ctor(viewId, desktopType)
  6. HandCardView.super.ctor(self, viewId, desktopType)
  7. end
  8. --发送出牌消息
  9. function HandCardView:sendOutCard()
  10. self.handOutCard = true--发送了出牌请求字段,此时收到出牌成功时如果在托管状态不创牌,否则会导致出一次牌,牌桌上有两张牌
  11. HandCardView.super.sendOutCard(self)
  12. --[[if not self.isOutCard or not self.touchMJ then return end
  13. local request = MJMessage.Card:new()
  14. request.card = self.touchMJ.value
  15. -- logE("LHQRecordView:setOutCardVisible"..table.tostring(request))
  16. self.ui:sendMsg(app.room, MJDefine.MJEvent.OutCard, request, function(status, response)
  17. logE("MJHandCardView sendOutCard() response = ", table.tostring(response))
  18. end)
  19. --音效
  20. local userInfo=app.room:getUserInfoByViewId(self.viewId)
  21. if userInfo then
  22. MJSound.PlayMJSound(userInfo.sex,request.card)
  23. end
  24. self:runOutCardAction(self.touchMJ.value)
  25. app.room:dispatchEvent({name = MJDefine.MJEvent.OutCardFalg,value=self.touchMJ.value,viewId=self.viewId})
  26. self:setOutCardEnable(false)
  27. --插牌
  28. if self.touchMJ==self.handCards[#self.handCards] then
  29. table.removeItem(self.handCards,self.touchMJ)
  30. self:resetHandCards()
  31. else
  32. table.removeItem(self.handCards,self.touchMJ)
  33. self:runInsertCardAction()
  34. end
  35. self.touchMJ:removeFromParent()
  36. self.touchMJ=nil
  37. app.room:dispatchEvent({name = MJDefine.MJEvent.SelectCard})
  38. app.room:dispatchEvent({name = MJDefine.MJEvent.ShowTing})
  39. self:setTing(false)
  40. app.room:resetTings()--]]
  41. --[[ if not self.isOutCard or not self.touchMJ then return end
  42. self:hideOperate()
  43. if self.touchMJ.status == MJDefine.MJStatus.Disable then return end
  44. local request = MJMessage.Card:new()
  45. request.card = self.touchMJ.value
  46. self.ui:sendMsg(app.room, MJDefine.MJEvent.OutCard, request, function(status, response)
  47. logE("MJHandCardView sendOutCard() response = ", table.tostring(response))
  48. end)
  49. self.touchMJ:restorePostion()
  50. self.touchMJ:setStatus(MJDefine.MJStatus.Normal)
  51. app.room:dispatchEvent({name = MJDefine.MJEvent.SelectCard})
  52. app.room:dispatchEvent({name = MJDefine.MJEvent.ShowTing})
  53. self.touchMJ = nil --]]
  54. end
  55. function HandCardView:removeTouchEventOnly()
  56. self:getEventDispatcher():removeEventListenersForTarget(self)
  57. end
  58. function HandCardView:setTing(b)
  59. if b and b == true and (not self:isCanOutCard()) then
  60. return
  61. end
  62. if self:isUseNew3D() then
  63. self._handcard:setTing(b)
  64. else
  65. for k,mj in pairs(self.handCards) do
  66. mj:setTing(b)
  67. end
  68. end
  69. end
  70. return HandCardView