KLShapeShiftCardMainPanel.lua 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. ---@class KLShapeShiftCardMainPanel:UIKmlLuaPanelBase
  2. ---@field view KLShapeShiftCardMainPanelView
  3. local KLShapeShiftCardMainPanel = class(UIKmlLuaPanelBase)
  4. local this =KLShapeShiftCardMainPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. SL.HideMainPanel()
  10. --GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardMain/KLShapeShiftCardMainPanel")
  11. end
  12. ---注册UI事件和服务器消息
  13. function this:RegistEvents()
  14. GUI:AddOnClickEvent(self.view.btn_close,self,self.BtnCloseClick)
  15. GUI:SetToggleOnValueChange(self.view.toggle_inlay,self,self.ToggleInlayChange)
  16. GUI:SetToggleOnValueChange(self.view.toggle_house,self,self.ToggleHouseChange)
  17. GUI:SetToggleOnValueChange(self.view.toggle_synthesis,self,self.ToggleSynthesisChange)
  18. GUI:SetToggleOnValueChange(self.view.toggle_shop,self,self.ToggleShopChange)
  19. GUI:SetToggleOnValueChange(self.view.toggle_break,self,self.ToggleBreakChange)
  20. end
  21. function this:ToggleInlayChange(_,_,value)
  22. if value[1] then
  23. GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardInlay/KLShapeShiftCardInlayPanel")
  24. GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png")
  25. self:OnClickBlock()
  26. else
  27. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardInlay/KLShapeShiftCardInlayPanel")
  28. end
  29. end
  30. function this:ToggleHouseChange(_,_,value)
  31. if value[1] then
  32. GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardHouse/KLShapeShiftCardHousePanel")
  33. GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png")
  34. self:OnClickBlock()
  35. else
  36. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardHouse/KLShapeShiftCardHousePanel")
  37. end
  38. end
  39. function this:ToggleSynthesisChange(_,_,value)
  40. if value[1] then
  41. GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel")
  42. GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png")
  43. self:OnClickBlock()
  44. else
  45. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel")
  46. end
  47. end
  48. function this:ToggleShopChange(_,_,value)
  49. if value[1] then
  50. GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardShop/KLShapeShiftCardShopPanel")
  51. GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_3.png")
  52. self:OnClickBlock()
  53. else
  54. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardShop/KLShapeShiftCardShopPanel")
  55. end
  56. end
  57. function this:ToggleBreakChange(_,_,value)
  58. if value[1] then
  59. GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel")
  60. GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png")
  61. self:OnClickBlock()
  62. else
  63. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel")
  64. end
  65. end
  66. function this:OnClickBlock()
  67. GUI:setVisible(self.view.img_block, true)
  68. if self.timer then
  69. SL:UnSchedule(self.timer)
  70. end
  71. self.timer = SL:ScheduleOnce(0.5, function()
  72. GUI:setVisible(self.view.img_block, false)
  73. end)
  74. end
  75. function this:BtnCloseClick()
  76. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardMain/KLShapeShiftCardMainPanel")
  77. end
  78. ---界面显示时调用一次
  79. function this:Show()
  80. end
  81. ---创建或者刷新界面数据时调用
  82. function this:Refresh()
  83. if self.args then
  84. local index
  85. if type(self.args) == "table" then
  86. index = tonumber(self.args[1])
  87. else
  88. index = tonumber(self.args)
  89. end
  90. if index == 2 then
  91. GUI:Toggle_setIsOn(self.view.toggle_house, true)
  92. elseif index == 3 then
  93. GUI:Toggle_setIsOn(self.view.toggle_synthesis, true)
  94. elseif index == 4 then
  95. GUI:Toggle_setIsOn(self.view.toggle_shop, true)
  96. elseif index == 5 then
  97. GUI:Toggle_setIsOn(self.view.toggle_break, true)
  98. end
  99. else
  100. GUI:Toggle_setIsOn(self.view.toggle_inlay, true)
  101. end
  102. self:RefreshMainRedPoint()
  103. end
  104. function this:RefreshMainRedPoint()
  105. local redPoint_shop = InfoManager.shapeShiftCardInfo:RefreshCardShopRedPointInfo()
  106. local redPoint_inlay = InfoManager.shapeShiftCardInfo:RefreshCardInlayRedPointInfo()
  107. local redPoint_house = InfoManager.shapeShiftCardInfo:RefreshCardHouseRedPointInfo()
  108. local redPoint_synthesis = InfoManager.shapeShiftCardInfo:RefreshCardSynthesisRedPointInfo()
  109. local redPoint_break = InfoManager.shapeShiftCardInfo:RefreshCardBreakRedPointInfo()
  110. GUI:setVisible(self.view.item_equip_redPoint_shop, redPoint_shop)
  111. GUI:setVisible(self.view.item_equip_redPoint_inlay, redPoint_inlay)
  112. GUI:setVisible(self.view.item_equip_redPoint_house, redPoint_house)
  113. GUI:setVisible(self.view.item_equip_redPoint_synthesis, redPoint_synthesis)
  114. GUI:setVisible(self.view.item_equip_redPoint_break, redPoint_break)
  115. end
  116. function this:Close()
  117. if self.timer then
  118. SL:UnSchedule(self.timer)
  119. self.timer = nil
  120. end
  121. SL.ShowMainPanel()
  122. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardInlay/KLShapeShiftCardInlayPanel")
  123. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardShop/KLShapeShiftCardShopPanel")
  124. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel")
  125. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardHouse/KLShapeShiftCardHousePanel")
  126. GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel")
  127. SL:RefreshPanelALLRedStateKmlByCondition("checkShapeShiftCardRedDot")
  128. end
  129. return this