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.

65 lines
2.4 KiB

  1. local MJ = MJFramework.MJImport("mj.luaScript.Views.Game.MJ")
  2. local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine")
  3. local MJPositionCompnent=MJFramework.MJImport("mj.luaScript.Views.Compnent.MJPositionCompnent")
  4. local MJChi = MJFramework.MJFrameworkClassImprot("mj.luaScript.Views.Game.MJChi")
  5. local NeiJiangMJChi = class("NeiJiangMJChi", MJChi)
  6. function NeiJiangMJChi:ctor(values,viewId,desktopType)
  7. NeiJiangMJChi.super.ctor(self, values, viewId, desktopType);
  8. -- self.viewId=viewId or MJDefine.PlayerViewType.My
  9. -- self.desktopType = desktopType or MJDefine.DesktopType.ThreeD
  10. -- self.mjs={}
  11. -- local MJGroupOffSet=MJDefine.MJGroupOffSet[desktopType]
  12. -- -- local x=0
  13. -- -- local y=0
  14. -- --计算整个组牌的宽高
  15. -- local width=0
  16. -- local height=0
  17. -- for i=1,3 do
  18. -- local mj =MJ:new(values[i],MJDefine.MJType.Operate,self.viewId,self.desktopType)
  19. -- self:addChild(mj)
  20. -- local mjWidth=mj:getContentSize().width
  21. -- local mjHeight=mj:getContentSize().height
  22. -- --根据视图ID 计算坐标
  23. -- if self.viewId==MJDefine.PlayerViewType.My then
  24. -- -- x=#self.mjs*(mjWidth-MJDefine.MJGroupOffSet[self.viewId].x)+mjWidth/2
  25. -- width=width+mjWidth
  26. -- height=mj:getContentSize().height
  27. -- elseif self.viewId==MJDefine.PlayerViewType.Left then
  28. -- -- x=x-#self.mjs*MJDefine.MJGroupOffSet[self.viewId].x
  29. -- -- y=y+(mjHeight-MJDefine.MJGroupOffSet[self.viewId].y)*(3-i)
  30. -- width=mjWidth
  31. -- height=height+mjHeight
  32. -- if i<3 then
  33. -- height=height-MJGroupOffSet[self.viewId].y
  34. -- end
  35. -- elseif self.viewId==MJDefine.PlayerViewType.Right then
  36. -- -- x=x-#self.mjs*MJDefine.MJGroupOffSet[self.viewId].x
  37. -- -- y=y+(mjHeight-MJDefine.MJGroupOffSet[self.viewId].y)*#self.mjs
  38. -- width=mjWidth
  39. -- height=height+mjHeight
  40. -- if i<3 then
  41. -- height=height-MJGroupOffSet[self.viewId].y
  42. -- end
  43. -- mj:setLocalZOrder(3-i)
  44. -- elseif self.viewId==MJDefine.PlayerViewType.Top then
  45. -- -- local scale=1--0.8 --上面的麻将要缩小
  46. -- -- mj:setScale(scale)
  47. -- -- x=x*scale
  48. -- -- y=y*scale
  49. -- -- x=#self.mjs*(mjWidth*scale-MJDefine.MJGroupOffSet[self.viewId].x)+mjWidth*scale/2
  50. -- width=width+mjWidth
  51. -- height=mj:getContentSize().height
  52. -- end
  53. -- local x,y=MJPositionCompnent.getIntragroupPosition(self.viewId,mj,i,#self.mjs,self.desktopType)
  54. -- mj:setPosition(x,y)
  55. -- table.insert(self.mjs,mj)
  56. -- end
  57. -- self:setContentSize(cc.size(width,height))
  58. end
  59. return NeiJiangMJChi