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.

91 lines
3.0 KiB

  1. -- 增加成员Layout
  2. local ClubAddPlayerView = class("ClubAddPlayerView" , cc.UIView);
  3. local ClubDefine = require("luaScript.Protocol.Club.ClubDefine")
  4. function ClubAddPlayerView:ctor(clubInfo,viewType)
  5. ClubAddPlayerView.super.ctor(self)
  6. self:loadUI()
  7. self.clubInfo = clubInfo
  8. self.viewType = viewType
  9. end
  10. function ClubAddPlayerView:loadUI()
  11. local ui = loadUI("res/ui/ui_club/ui_club_add_playerview.ui")
  12. self.ui = ui
  13. self:addChild(ui)
  14. end
  15. function ClubAddPlayerView:onEnter()
  16. ClubAddPlayerView.super.onEnter(self)
  17. --关闭
  18. self.ui.Items.Button_close:registerClick(handler(self , self.onClose))
  19. --添加普通成员
  20. self.ui.Items.Button_add:registerClick(handler(self , self.onAddplayer))
  21. self.ui.Items.Text_clubplayer:setText("导入"..(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME).."成员")
  22. --导入茶馆成员
  23. self.ui.Items.Button_import:registerClick(handler(self , self.onAddclubplayer))
  24. --复制茶馆成员
  25. self.ui.Items.Button_copy:registerClick(handler(self , self.onCopyClub))
  26. self.ui.Items.Text_clubcopy:setText("复制"..(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME).."成员")
  27. if app.club_php:getIsQuanMinSai(self.clubInfo.clubId) then
  28. self.ui.Items.Layout_import_copy:setVisible(self.clubInfo.role == ClubDefine.Job.Creator and not (table.nums(self.clubInfo.playersMatch) >= 2))
  29. else
  30. self.ui.Items.Layout_import_copy:setVisible(false)
  31. end
  32. if app.club_php:getCestIsOpen(self.clubInfo.clubId) then
  33. self.ui.Items.Text_clubplayer:setText("导入海选赛选手")
  34. self.ui.Items.Text_clubcopy:setText("复制海选赛选手")
  35. end
  36. self.ui.Items.Layout_btn:requestDoLayout()
  37. self.ui.Items.Layout_btn:doLayout()
  38. end
  39. function ClubAddPlayerView:onClose()
  40. playBtnCloseEffect()
  41. self:removeFromParent()
  42. end
  43. --添加普通成员
  44. function ClubAddPlayerView:onAddplayer()
  45. playBtnEffect()
  46. local view = import("luaScript.Views.Club.HeHuoRen.ClubHeHuoRenAddMember"):new(self.clubInfo)
  47. view:setAnchorPoint(cc.p(0.5, 0.5))
  48. app:showWaitDialog(view)
  49. self:removeFromParent()
  50. end
  51. function ClubAddPlayerView:onCopyClub()
  52. playBtnEffect()
  53. local view = import("luaScript.Views.Club.ClubCopyClubMember"):new(self.clubInfo,self.viewType)
  54. view:setAnchorPoint(cc.p(0.5, 0.5))
  55. app:showWaitDialog(view)
  56. self:removeFromParent()
  57. end
  58. --导入茶馆成员
  59. function ClubAddPlayerView:onAddclubplayer()
  60. playBtnEffect()
  61. local isplayerclub = false
  62. for k,v in pairs(app.club_php.clubList) do
  63. if v.role == ClubDefine.Job.Creator and self.clubInfo.clubId ~= v.clubId then
  64. isplayerclub = true
  65. end
  66. end
  67. if isplayerclub == true then
  68. local view = import("luaScript.Views.Club.ClubImportClubsPlayer"):new(self.clubInfo.clubId)
  69. view:setAnchorPoint(cc.p(0.5, 0.5))
  70. app:showWaitDialog(view)
  71. self:removeFromParent()
  72. else
  73. showTooltip("您名下暂无"..(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME).."无法导入!")
  74. end
  75. end
  76. return ClubAddPlayerView