25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.9 KiB

  1. local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine")
  2. local MJRoomDirection = MJFramework.MJFrameworkClassImprot("mj.luaScript.Views.Room.MJRoomDirection")
  3. local yibinmajiangRoomDirectionView = class("yibinmajiangRoomDirectionView", MJRoomDirection)
  4. function yibinmajiangRoomDirectionView:ctor(...)
  5. yibinmajiangRoomDirectionView.super.ctor(self, ...)
  6. end
  7. function yibinmajiangRoomDirectionView:updateView(desktopType)
  8. if self.ui then
  9. self.ui:removeFromParent()
  10. end
  11. self.desktopType = desktopType
  12. if self.desktopType == MJDefine.DesktopType.ThreeD then
  13. if MJDefine.IS_NEW_3D then
  14. local path = "mj/res/ui/ui_fangjian/mj_ui_room_direction_3d.ui"
  15. self.ui = loadUI(path)
  16. -- self:init3DDirectionNew()
  17. else
  18. local path = "mj/res/ui/ui_fangjian/mj_ui_room_direction.ui"
  19. self.ui = loadUI(path)
  20. self:init3DDirection()
  21. end
  22. else
  23. self.ui = loadUI("mj_yibinmajiang/res/ui_fangjian/mj_yibinmajiang_room_direction_2d.ui")
  24. self:init2DDirection()
  25. end
  26. self:addChild(self.ui)
  27. if self.seatId then
  28. self.currentDir = nil
  29. self:updateDirection(self.seatId)
  30. end
  31. end
  32. function yibinmajiangRoomDirectionView:init2DDirection()
  33. local roomInfo = app.room.roomInfo
  34. local nBankSeatId = roomInfo.nBankSeatId
  35. local bankViewId = app.room:getViewIdBySeatId(nBankSeatId)
  36. if bankViewId == MJDefine.PlayerViewType.My then
  37. self.direction = MJDefine.MJDirection.East
  38. elseif bankViewId == MJDefine.PlayerViewType.Left then
  39. self.direction = MJDefine.MJDirection.South
  40. elseif bankViewId == MJDefine.PlayerViewType.Right then
  41. self.direction = MJDefine.MJDirection.North
  42. elseif bankViewId == MJDefine.PlayerViewType.Top then
  43. self.direction = MJDefine.MJDirection.West
  44. end
  45. self.ui.Items.ImageView_Dir_Down:stopAllActions();
  46. self.ui.Items.ImageView_Dir_Up:stopAllActions();
  47. self.ui.Items.ImageView_Dir_Left:stopAllActions();
  48. self.ui.Items.ImageView_Dir_Right:stopAllActions();
  49. local acSeq = cc.Sequence:create(cc.FadeOut:create(1.0), cc.FadeIn:create(1.0))
  50. self.ui.Items.ImageView_Dir_Down:runAction(cc.RepeatForever:create(acSeq:clone()));
  51. self.ui.Items.ImageView_Dir_Up:runAction(cc.RepeatForever:create(acSeq:clone()));
  52. self.ui.Items.ImageView_Dir_Left:runAction(cc.RepeatForever:create(acSeq:clone()));
  53. self.ui.Items.ImageView_Dir_Right:runAction(cc.RepeatForever:create(acSeq:clone()));
  54. end
  55. function yibinmajiangRoomDirectionView:initDirection(desktopType)
  56. yibinmajiangRoomDirectionView.super.initDirection(self, desktopType)
  57. self:updateCardNums(MJDefine.totalCard)
  58. end
  59. function yibinmajiangRoomDirectionView:updateCardNums(cardNum)
  60. if not cardNum then
  61. return
  62. end
  63. if self.ui then
  64. self.ui.Items.Text_Leave_Card_Num:setText(cardNum)
  65. end
  66. end
  67. return yibinmajiangRoomDirectionView