KLOpenServiceGiftInnerPanel.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---@class KLOpenServiceGiftInnerPanel:UIKmlLuaPanelBase
  2. ---@field view KLOpenServiceGiftInnerPanelView
  3. local KLOpenServiceGiftInnerPanel = class(UIKmlLuaPanelBase)
  4. local this = KLOpenServiceGiftInnerPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. self.allGiftItem = {}
  10. GUI:DataListInitData(self.view.giftDataList, function()
  11. return self:GiftDataListItemCountFunc()
  12. end, function(realIndex)
  13. return self:GiftDataListItemGetFunc(realIndex)
  14. end, function(realIndex, kmlcontrol)
  15. return self:GiftDataListItemInitFunc(realIndex, kmlcontrol)
  16. end, function(realIndex, kmlcontrol)
  17. return self:GiftDataListItemUpdateFunc(realIndex, kmlcontrol)
  18. end)
  19. self.allReward = SL:GetConfigTable("cfg_accumulateLogOn")
  20. end
  21. ---注册UI事件和服务器消息
  22. function this:RegistEvents()
  23. SL:RegisterLUAEvent(LUA_EVENT_SEVEN_DAY_GIFT, self.Refresh, self)
  24. end
  25. ---界面显示时调用一次
  26. function this:Show()
  27. end
  28. ---创建或者刷新界面数据时调用
  29. function this:Refresh()
  30. GUI:DataListUpdateData(self.view.giftDataList)
  31. end
  32. function this:Close()
  33. end
  34. function this:GiftDataListItemCountFunc()
  35. return #self.allReward
  36. end
  37. function this:GiftDataListItemGetFunc(realIndex)
  38. local item = GUI:UIPanel_Open("dev/outui/OpenService/Item/KLOpenServiceGift/KLOpenServiceGiftItem",
  39. self.view.giftDataList, self, {}, true)
  40. self.allGiftItem[item.view.root] = item
  41. return item.view.root
  42. end
  43. function this:GiftDataListItemInitFunc(realIndex, kmlcontrol)
  44. end
  45. function this:GiftDataListItemUpdateFunc(realIndex, kmlcontrol)
  46. local data = self.allReward[realIndex + 1]
  47. self.allGiftItem[kmlcontrol]:RefreshItem(data)
  48. end
  49. return this