KLTalentItem.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ---@class KLTalentItem:UIKmlLuaPanelBase
  2. ---@field view KLTalentItemView
  3. ---@field talentList cfg_equip_angelTalent_column[]
  4. local KLTalentItem = class(UIKmlLuaPanelBase)
  5. local this = KLTalentItem
  6. ---创建时调用一次
  7. function this:Init()
  8. GUI:DataListInitData(self.view.talent_data, function()
  9. return #self.talentList
  10. end, function(realIndex)
  11. --return self:talentNameGetItem(realIndex)
  12. end, function(realIndex, kmlcontrol)
  13. --return self:DataListItemInit(realIndex, kmlcontrol)
  14. end, function(realIndex, kmlcontrol)
  15. return self:TalentUpdateItem(realIndex, kmlcontrol)
  16. end)
  17. end
  18. function this:TalentUpdateItem(realIndex, kmlcontrol)
  19. local atlas = "Atlas/UIOutSkillIcon.spriteatlas"
  20. --local icon = self.view.talent_data:GetChildControl(realIndex, "icon")
  21. local icon = GUI:GetChildControl(self.view.talent_data, realIndex, "icon")
  22. --local bg = self.view.talent_data:GetChildControl(realIndex, "bg")
  23. local bg = GUI:GetChildControl(self.view.talent_data, realIndex, "bg")
  24. if self.talentList[realIndex + 1].talentType == 2 then
  25. GUI:Image_loadTexture(bg, "golden_frame", "Atlas/UIArchangel.spriteatlas")
  26. else
  27. GUI:Image_loadTexture(bg, "silver_frame", "Atlas/UIArchangel.spriteatlas")
  28. end
  29. GUI:Image_loadTexture(icon, self.talentList[realIndex + 1].talentIcon, atlas)
  30. GUI:AddOnClickEvent(icon, self, function()
  31. GUI:UIPanel_Open("dev/outui/Archangel/Panel/KLTalentTip/KLTalentTipPanel", _, _, { tbl = self.talentList[realIndex + 1], currentLv = self.talentList[realIndex + 1].curlv })
  32. end)
  33. --local level_text = self.view.talent_data:GetChildControl(realIndex, "level_text")
  34. local level_text = GUI:GetChildControl(self.view.talent_data, realIndex, "level_text")
  35. GUI:Text_setString(level_text, tostring(self.talentList[realIndex + 1].curlv) .. "/" .. tostring(self.talentList[realIndex + 1].talentMaxLv))
  36. --local icon_mask = self.view.talent_data:GetChildControl(realIndex, "icon_mask")
  37. local icon_mask = GUI:GetChildControl(self.view.talent_data, realIndex, "icon_mask")
  38. if self.talentList[realIndex + 1].curlv > 0 then
  39. GUI:setVisible(icon_mask, false)
  40. else
  41. GUI:setVisible(icon_mask, true)
  42. end
  43. end
  44. ---注册UI事件和服务器消息
  45. function this:RegistEvents()
  46. end
  47. ---界面显示时调用一次
  48. function this:Show()
  49. end
  50. ---创建或者刷新界面数据时调用
  51. function this:Refresh()
  52. end
  53. function this:UpdateUI(talentList)
  54. self.talentList = talentList
  55. GUI:DataListUpdateData(self.view.talent_data)
  56. end
  57. function this:Close()
  58. end
  59. return this