KLCrossServerPanel.lua 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ---@class KLCrossServerPanel:UIKmlLuaPanelBase
  2. ---@field view KLCrossServerPanelView
  3. local KLCrossServerPanel = class(UIKmlLuaPanelBase)
  4. local this = KLCrossServerPanel
  5. ---创建时调用一次
  6. function this:Init()
  7. SL.HideMainPanel()
  8. GUI:DataListInitData(self.view.activity_panel_dl,function()
  9. return self:BtnDataListItemCountFunc()
  10. end,function(realIndex)
  11. return self:BtnDataListItemGetFunc(realIndex)
  12. end,function(realIndex, kmlcontrol)
  13. return self:BtnDataListItemInitFunc(realIndex, kmlcontrol)
  14. end, function(realIndex, kmlcontrol)
  15. return self:BtnDataListItemUpdateFunc(realIndex, kmlcontrol)
  16. end)
  17. self.all_item = {}
  18. self.allActivity = {
  19. {id=1, name="神之国度", cfgid = 20001},
  20. {id=2, name="诸神降临", cfgid = 23001},
  21. {id=4, name="圣域秘境", cfgid = 21001},
  22. }
  23. local kundun_cfg = SL:GetConfig("cfg_system_switch", 228)
  24. if kundun_cfg and kundun_cfg.needLevel <= SL:GetMetaValue("LEVEL") and kundun_cfg.needDay <= SL:GetOpenServerDay() then
  25. table.insert(self.allActivity,{id=3, name="昆顿入侵", cfgid = 21009})
  26. end
  27. end
  28. ---创建或者刷新界面数据时调用
  29. function this:Refresh()
  30. if self.args then
  31. --selectType 1神之国度
  32. if self.args.selectType == 1 then
  33. GUI:SetTogDefaultThis(self.view.type_1_toggle)
  34. end
  35. else
  36. GUI:SetTogDefaultThis(self.view.type_1_toggle)
  37. end
  38. GUI:DataListUpdateData(self.view.activity_panel_dl, true, function()
  39. SL:RefreshPanelALLRedStateKmlByCondition("checkGodDescentMonster")
  40. end)
  41. end
  42. ---注册UI事件和服务器消息
  43. function this:RegistEvents()
  44. GUI:SetToggleOnValueChange(self.view.type_1_toggle, self, self.GodCountrySelectClick)
  45. GUI:AddOnClickEvent(self.view.btn_close,self,self.CloseOnclick)
  46. GUI:AddOnClickEvent(self.view.desBtn,self,self.DesOnclick)
  47. --SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_PRIVILEGE_BOSS_PANEL,self.RES_PRIVILEGE_BOSS_PANEL,self)
  48. end
  49. function this:CloseOnclick()
  50. GUI:UIPanel_Close("dev/outui/CrossServer/Panel/KLCrossServerMain/KLCrossServerPanel")
  51. GUI:UIPanel_Close("dev/outui/CrossServer/Panel/KLGodCountry/KLGodCountryPanel")
  52. end
  53. function this:GodCountrySelectClick(kmlCtrl, eventData, args)
  54. if args[1] then
  55. self:SelectActicity()
  56. end
  57. end
  58. function this:SelectActicity()
  59. if not self.select_id then
  60. self.select_id = self.allActivity[1].id
  61. end
  62. if self.show_ui then
  63. GUI:UIPanel_Close(self.show_ui)
  64. end
  65. if self.select_id == 1 then
  66. self:SelectGodCountryBoss()
  67. elseif self.select_id == 2 then
  68. self:SelectGodDescentPage()
  69. elseif self.select_id == 3 then
  70. self:SelectQuintonInvasionPage()
  71. elseif self.select_id == 4 then
  72. self:SelectSanctuaryPage()
  73. end
  74. end
  75. --神之国度
  76. function this:SelectGodCountryBoss()
  77. self.show_ui = "dev/outui/CrossServer/Panel/KLGodCountry/KLGodCountryPanel"
  78. GUI:UIPanel_Open("dev/outui/CrossServer/Panel/KLGodCountry/KLGodCountryPanel")
  79. end
  80. --诸神降临
  81. function this:SelectGodDescentPage()
  82. self.show_ui = "dev/outui/CrossServer/Item/KLGodDescent/KLGodDescentItem"
  83. GUI:UIPanel_Open(self.show_ui, self.view.root, self)
  84. SL:RefreshPanelALLRedStateKmlByCondition("checkGodDescentMonster")
  85. end
  86. --混顿入侵
  87. function this:SelectQuintonInvasionPage()
  88. self.show_ui = "dev/outui/Activity/Panel/KLQuintonInvasion/KLQuintonInvasionPanel"
  89. GUI:UIPanel_Open(self.show_ui, self.view.root, self)
  90. end
  91. --圣域BOSS
  92. function this:SelectSanctuaryPage()
  93. self.show_ui = "dev/outui/CrossServer/Panel/KLSanctuaryBossActivity/KLSanctuaryBossActivityPanel"
  94. GUI:UIPanel_Open(self.show_ui, self.view.root, self)
  95. end
  96. function this:BtnDataListItemCountFunc()
  97. return #self.allActivity
  98. end
  99. function this:BtnDataListItemGetFunc(realIndex)
  100. local index = realIndex + 1
  101. local data = self.allActivity[realIndex + 1]
  102. local item = GUI:UIPanel_Open("dev/outui/CrossServer/Item/KLUCrossServerMainBtnItem/KLUCrossServerMainBtnItem",self.view.activity_panel_dl,self,nil,true)
  103. self.all_item[index] = item
  104. item:RefreshItem(data,self.select_id,self)
  105. if self.select_id == data.id then
  106. self:Select(data.id,item)
  107. end
  108. GUI:SetID(item.view.root, "KLUCrossServerMainBtnItem_"..data.cfgid)
  109. return item.view.root
  110. end
  111. function this:BtnDataListItemInitFunc(realIndex, kmlcontrol)
  112. end
  113. function this:BtnDataListItemUpdateFunc(realIndex, kmlcontrol)
  114. local index = realIndex + 1
  115. local data = self.allActivity[realIndex + 1]
  116. self.all_item[index]:RefreshItem(data,self.select_id,self)
  117. if data.id == self.select_id then
  118. self.LevelBtn = self.all_item[index]
  119. end
  120. end
  121. function this:HideSelect()
  122. if self.LevelBtn then
  123. self.LevelBtn:HideItem()
  124. end
  125. end
  126. function this:Select(id,Btn)
  127. self.LevelBtn = Btn
  128. self.select_id = id
  129. self:SelectActicity()
  130. end
  131. function this:DesOnclick()
  132. GUI:UIPanel_Open("dev/outui/CrossServer/Panel/KLCrossServerIntroduce/KLCrossServerIntroducePanel")
  133. end
  134. function this:Close()
  135. SL.ShowMainPanel()
  136. end
  137. return this