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.

101 lines
2.7 KiB

  1. -- 加入亲友圈界面
  2. local ClubBaoJianInfo = class("ClubBaoJianInfo", cc.UIView)
  3. local ClubDefine = require("luaScript.Protocol.Club.ClubDefine")
  4. function ClubBaoJianInfo:ctor(gid,gameId,gameNum,strGameRule,arena,title)
  5. ClubBaoJianInfo.super.ctor(self);
  6. local ui = loadUI("res/ui/ui_club/match/ui_club_match_baoJianInfo.ui");
  7. self.ui = ui;
  8. self:addChild(ui);
  9. self.clubInfo = app.club_php.clubList[tonumber(gid)]
  10. self.clubId = gid
  11. self.rule = getRuleFromString(gameId, gameNum, strGameRule,arena)
  12. if app.club_php:getCestIsOpen(app.club_php.clubID) then
  13. self.arena = getClubCestRule(arena)
  14. else
  15. self.arena = getClubMatchRule(arena)
  16. end
  17. self.title = title == "" and "未设包间名" or title
  18. if app.club_php:getCestIsOpen(app.club_php.clubID) then
  19. self.title = title == "" and "未设赛事名" or title
  20. end
  21. end
  22. function ClubBaoJianInfo:onEnter()
  23. ClubBaoJianInfo.super.onEnter(self)
  24. self.ui.Items.Layout_Item:setVisible(false)
  25. self:updateView()
  26. --按钮注册事件
  27. self:registerButton()
  28. end
  29. --按钮注册点击事件
  30. function ClubBaoJianInfo:registerButton()
  31. self.ui.Items.Button_Sure:registerClick(handler(self , self.onClose))
  32. end
  33. function ClubBaoJianInfo:updateView()
  34. if app.club_php:getCestIsOpen(app.club_php.clubID) then
  35. self.ui.Items.ImageView_1:loadTexture("res/ui/zy_club/club_room/club_baojian/club_saishi_xinxi.png")
  36. end
  37. self.ui.Items.Text_title:setText(tostring(self.title))
  38. --游戏玩法
  39. self:createText("游戏玩法",self.rule)
  40. if app.club_php:getMatchIsOpen(self.clubId) then
  41. if app.club_php:getIsQuanMinSai(self.clubId) then
  42. self:createText("排名赛规则",self.arena,true)
  43. else
  44. self:createText("比赛规则",self.arena,true)
  45. end
  46. end
  47. if app.club_php:getCestIsOpen(self.clubId) then
  48. -- if app.club_php:getIsQuanMinSai(self.clubId) then
  49. -- self:createText("排名赛规则",self.arena,true)
  50. -- else
  51. self:createText("赛事规则",self.arena,true)
  52. -- end
  53. end
  54. end
  55. function ClubBaoJianInfo:createText(title,data,isBiSai)
  56. local layoutItem = self.ui.Items.Layout_Item:getCopied()
  57. layoutItem.Items = getUIItems(layoutItem)
  58. layoutItem.Items.Text:setText(title)
  59. local str = ""
  60. for k,v in ipairs(data or {}) do
  61. for _,ruleStr in ipairs(v.value or {}) do
  62. str = str..tostring(ruleStr).." "
  63. end
  64. end
  65. layoutItem.Items.Text_Rule:setText(str)
  66. if isBiSai then
  67. layoutItem.Items.Text_Rule:setTextColor(cc.c4b(30,42,52,255))
  68. end
  69. layoutItem:requestDoLayout()
  70. layoutItem:doLayout()
  71. self.ui.Items.Layout_wanfa:addChild(layoutItem)
  72. self.ui.Items.Layout_wanfa:requestDoLayout()
  73. self.ui.Items.Layout_wanfa:doLayout()
  74. end
  75. function ClubBaoJianInfo:onClose()
  76. playBtnCloseEffect()
  77. self:removeFromParent()
  78. end
  79. return ClubBaoJianInfo;