KLUnionActivityItem.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---@class KLUnionActivityItem:UIKmlLuaPanelBase
  2. ---@field view KLUnionActivityItemView
  3. local KLUnionActivityItem = class(UIKmlLuaPanelBase)
  4. local this =KLUnionActivityItem
  5. ---创建时调用一次
  6. function this:Init()
  7. self.activityId = self.args.activityId
  8. self.isOpen = false
  9. GUI:setVisible(self.view.ImgOpen, false)
  10. end
  11. ---创建或者刷新界面数据时调用
  12. function this:Refresh()
  13. ---@type cfg_activity_rule_column
  14. local tbl = SL:GetConfig("cfg_activity_rule", self.activityId)
  15. GUI:Text_setString(self.view.TxtOpenTime, tbl.timeText)
  16. GUI:Text_setString(self.view.TxtLimit, tbl.uiTextSynopsis)
  17. GUI:Image_loadTexture(self.view.Bg, tbl.unionUiBg,"Atlas/Guild.spriteatlas")
  18. end
  19. ---注册UI事件和服务器消息
  20. function this:RegistEvents()
  21. GUI:AddOnClickEvent(self.view.Bg, self, self.ActivityOnClick)
  22. end
  23. function this:SetOpen(isOpen)
  24. self.isOpen = isOpen
  25. GUI:setVisible(self.view.ImgOpen, isOpen)
  26. end
  27. function this:ActivityOnClick()
  28. if not self.isOpen then
  29. SL:TipMessage(SL:GetConfig('cfg_string',250).text, 1, NoticeType.NoticeMid)--"活动未开启",
  30. return
  31. end
  32. ---@type cfg_activity_rule_column
  33. local tbl = SL:GetConfig("cfg_activity_rule", self.activityId)
  34. ---狼魂要塞
  35. if tbl.id == EActivityType.WolfSoulFortress then
  36. ---没有公会
  37. if SL:MeData_GetUnionId() == 0 then
  38. SL:TipMessage( SL:GetConfig('cfg_string', 433).text, 1, NoticeType.NoticeMid )
  39. return
  40. end
  41. ---@type cfg_rep_column
  42. local tempTbl = InfoManager.wolfSoulFortressInfo:GetCfgByOpenServerDay()
  43. if tempTbl then
  44. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_ENTER_DUPLICATE, tempTbl.id)
  45. end
  46. else
  47. SL:ShortcutDO(tbl.panel)
  48. end
  49. end
  50. function this:Close()
  51. end
  52. return this