您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

102 行
3.0 KiB

  1. local MJSound = MJFramework.MJImport("mj.luaScript.MJSound")
  2. local Mahjong3DOutCardView = MJFramework.MJFrameworkClassImprot("mj.luaScript.Common.3d.Mahjong3DOutCardView")
  3. local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine")
  4. local OutCardView3D = class("OutCardView3D", Mahjong3DOutCardView)
  5. function OutCardView3D:ctor(...)
  6. OutCardView3D.super.ctor(self, ...)
  7. end
  8. function OutCardView3D:onOutCard(card, callback)
  9. MJSound.PlayOutCard()
  10. self:addCard(card)
  11. self:refreshZOrder()
  12. if callback then
  13. callback()
  14. end
  15. self:runOutCardAction(card)
  16. end
  17. --łöĹĆśŻť­
  18. function OutCardView3D:runOutCardAction(value,callback)
  19. local outCard=self._outCardNodes[#self._outCardNodes]
  20. local guangan_mj_color = loadUserInfo("mj_guangan_desktop_2d_mjType") or MJDefine.DesktopType.TwoDL
  21. CardClass = require("mj_guangan.luaScript.Views.3d.Card_3d")--MJDefine.MJConfig_3d.MAHJONG_CARD
  22. local showCardBg = cc.ImageView:createNode()
  23. showCardBg:loadTexture("mj_guangan/res/zy_fangjian/guanan_outCard_bg.png")
  24. showCardBg:setAutoSize(true)
  25. showCardBg:setScale9Enabled(true)
  26. showCardBg:setSize(cc.size(140,170))
  27. showCardBg:setLocalZOrder(9999)
  28. self:addChild(showCardBg)
  29. local showCard = CardClass:new(value, 4, MJDefine.MJConfig_2d.MJType.Stand, 1)
  30. --local showCard=MJ:new(value,MJDefine.MJType.Stand,MJDefine.MyViewId,self.desktopType)
  31. showCardBg:addChild(showCard)
  32. showCard:setScale(1.2)
  33. local showsize = showCardBg:getContentSize()
  34. showCard:setPosition(cc.p(showsize.width/2,showsize.height/2))
  35. showCard:setLocalZOrder(9999)
  36. --showCard:setScale(MJDefine.MJ_OUT_CARD_SCALE)
  37. showCardPostion = {
  38. [1] = {x = 1015*g_radio_x, y = 423*g_radio_y},
  39. [2] = {x = 641*g_radio_x, y = 571*g_radio_y},
  40. [3] = {x = 265*g_radio_x, y = 423*g_radio_y},
  41. [4] = {x = 640*g_radio_x, y = 210*g_radio_y},
  42. }
  43. showCardBg:setPosition(showCardPostion[self._viewId])
  44. local rotate=0
  45. if self._viewId==MJDefine.PlayerViewType.Left then
  46. rotate=-45
  47. elseif self._viewId==MJDefine.PlayerViewType.Right then
  48. rotate=45
  49. end
  50. local actions={
  51. --cc.ScaleTo:create(MJDefine.MJ_TIME_OUT_CARD_SCALE,1),
  52. cc.DelayTime:create(MJDefine.MJ_TIME_OUT_CARD_WAIT),
  53. --[[cc.Spawn:create(
  54. cc.Spawn:create(
  55. cc.MoveTo:create(MJDefine.MJ_TIME_OUT_CARD,outCard:getPosition()),
  56. cc.ScaleTo:create(MJDefine.MJ_TIME_OUT_CARD,MJDefine.MJ_OUT_CARD_SCALE)
  57. ),
  58. cc.RotateBy:create(MJDefine.MJ_TIME_OUT_CARD,rotate)
  59. ),--]]
  60. cc.CallFunc:create(function()
  61. -- MJSound.PlayOutCard()
  62. if outCard and not tolua.isnull(outCard) then
  63. --outCard:setVisible(true)
  64. end
  65. if callback then callback() end
  66. end),
  67. cc.RemoveSelf:create(),
  68. }
  69. showCardBg:runAction(cc.Sequence:create(actions))
  70. end
  71. function OutCardView3D:onSelectCard(event)
  72. if not event then
  73. return
  74. end
  75. local value = event.value;
  76. for k, v in ipairs(self._outCardNodes or {}) do
  77. if ((not value) or value <= 0) then
  78. v:setNormalColor()
  79. else
  80. if v:getValue() == value then
  81. v:setColor(cc.c3b(249,213,115))
  82. else
  83. v:setNormalColor()
  84. end
  85. end
  86. end
  87. end
  88. return OutCardView3D