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

72 行
2.8 KiB

  1. local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine")
  2. local Mahjong3DGroupAnGang = MJFramework.MJFrameworkClassImprot("mj.luaScript.Common.3d.Mahjong3DGroupAnGang")
  3. --local MJChi = MJFramework.MJImport("mj.luaScript.Views.3d.GroupChi_3d")
  4. local GroupAnGang3D = class("GroupAnGang3D", Mahjong3DGroupAnGang)
  5. function GroupAnGang3D:ctor(values, viewId, groupIndex, cardNum)
  6. self._mjNum = cardNum or 0
  7. self.redNum = cardNum or 0
  8. self.viewId = viewId
  9. GroupAnGang3D.super.ctor(self, values, viewId, groupIndex, cardNum)
  10. end
  11. function GroupAnGang3D:createCard(value, viewId, index, groupIndex)
  12. local card = GroupAnGang3D.super.createCard(self, value, viewId, index, groupIndex)
  13. if self.redNum > 0 and index <= self.redNum then
  14. card = GroupAnGang3D.super.createCard(self, 65, viewId, index, groupIndex)
  15. else
  16. card = GroupAnGang3D.super.createCard(self, value, viewId, index, groupIndex)
  17. end
  18. return card
  19. end
  20. function GroupAnGang3D:customRefresh(...)
  21. GroupAnGang3D.super.customRefresh(...)
  22. local mjCards = self:getCards()
  23. if mjCards[4] and self.redNum > 0 then
  24. --mjCards[4]:refreshCardNum(self._mjNum, self:getGroupIndex())
  25. self:showRedNum(mjCards[4],self.redNum)
  26. end
  27. end
  28. function GroupAnGang3D:showRedNum(super,redNum)
  29. if redNum > 0 then
  30. local pos = super:getPosition()
  31. local sprite
  32. if self.viewId==MJDefine.PlayerViewType.My then
  33. sprite = cc.Sprite:create("mj_luzhougui/res/zy_fangjian/myRedNum.png")
  34. sprite:setPosition(pos.x+10,pos.y+80)
  35. elseif self.viewId==MJDefine.PlayerViewType.Left then
  36. sprite = cc.Sprite:create("mj_luzhougui/res/zy_fangjian/myRedNum.png")
  37. sprite:setPosition(pos.x+super:getContentSize().width+20,pos.y+40)
  38. elseif self.viewId==MJDefine.PlayerViewType.Right then
  39. sprite = cc.Sprite:create("mj_luzhougui/res/zy_fangjian/otherRedNum.png")
  40. --sprite:setPosition(pos.x-super:getContentSize().width+3,pos.y-super:getContentSize().height-8)
  41. elseif self.viewId==MJDefine.PlayerViewType.Top then
  42. sprite = cc.Sprite:create("mj_luzhougui/res/zy_fangjian/otherRedNum.png")
  43. --sprite:setPosition(pos.x-super:getContentSize().width*2,pos.y-super:getContentSize().height-5)
  44. end
  45. super:addChild(sprite,3)
  46. local num = cc.Text:createNode()
  47. num:setDefaults()
  48. local config = num:getFontConfig()
  49. config.fontSize = 22
  50. config.texColor = cc.c4b(213,46,11,255)
  51. num:setFontConfig(config)
  52. num:setAnchorPoint(cc.p(0.5,0.5))
  53. sprite:addChild(num)
  54. if self.viewId==MJDefine.PlayerViewType.Right then
  55. num:setPosition(cc.p(sprite:getContentSize().width/2,sprite:getContentSize().height/2-3))
  56. elseif self.viewId==MJDefine.PlayerViewType.Top then
  57. num:setPosition(cc.p(sprite:getContentSize().width/2,sprite:getContentSize().height/2-3))
  58. else
  59. num:setPosition(cc.p(sprite:getContentSize().width/2,sprite:getContentSize().height/2+3))
  60. end
  61. num:setString(string.format("%d中", redNum))
  62. end
  63. end
  64. return GroupAnGang3D