KLUISkillUpTips2Panel.lua 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. ---@class KLUISkillUpTips2Panel:UIKmlLuaPanelBase
  2. ---@field view KLUISkillUpTips2PanelView
  3. ---@field SkillInfoDataList table<number,cfg_master_info_column>
  4. local KLUISkillUpTips2Panel = class(UIKmlLuaPanelBase)
  5. local this =KLUISkillUpTips2Panel
  6. ---创建时调用一次
  7. function this:Init()
  8. self.SkillInfoDataList = {}
  9. GUI:DataListInitData(self.view.SkillInfoDataList,function()
  10. return self:SkillInfoDataListItemCountFunc()
  11. end,function(realIndex)
  12. return self:SkillInfoDataListItemGetFunc(realIndex)
  13. end,function(realIndex, kmlcontrol)
  14. return self:SkillInfoDataListItemInitFunc(realIndex, kmlcontrol)
  15. end, function(realIndex, kmlcontrol)
  16. return self:SkillInfoDataListItemUpdateFunc(realIndex, kmlcontrol)
  17. end)
  18. --天赋
  19. if self.args and self.args.masterID and self.args.type then
  20. self.masterID = self.args.masterID
  21. self.type = self.args.type
  22. self:ShowMasterInfo()
  23. end
  24. end
  25. ---显示天赋信息
  26. function this:ShowMasterInfo()
  27. ---@type cfg_master_skilltalent_column
  28. local masterSkilltalentCfg = SL:GetConfig('cfg_master_skilltalent',self.masterID)
  29. self.masterLevel = InfoManager.masterTalentInfo:GetMasterLevel(self.type,masterSkilltalentCfg.series,masterSkilltalentCfg.id)
  30. GUI:Text_setString(self.view.SkillLv,self.masterLevel.."/"..masterSkilltalentCfg.minMaxLevel[2])
  31. GUI:Image_loadTexture(self.view.SkillIcon,masterSkilltalentCfg.icon,"Atlas/UIOutSkillIcon.spriteatlas")
  32. GUI:Text_setString(self.view.SkillName,masterSkilltalentCfg.name)
  33. local infoCfg = InfoManager.masterTalentInfo:GetMasterCfg(self.masterID,self.masterLevel + 1)
  34. self.totalNum = infoCfg and infoCfg.frontNum or 0
  35. --前置点数不足显示红色
  36. if not InfoManager.masterTalentInfo:IsCanUpLevel(masterSkilltalentCfg.id,masterSkilltalentCfg.series,masterSkilltalentCfg.steps,self.type) then
  37. --"#1add1f" or "#ff2323"
  38. GUI:Text_setString(self.view.NeedPoint,"<color=#ff2323>"..self.totalNum.."</color>")
  39. else
  40. GUI:Text_setString(self.view.NeedPoint,tostring(self.totalNum))
  41. end
  42. self.SkillInfoDataList = {}
  43. for i = 1, masterSkilltalentCfg.minMaxLevel[2] do
  44. local cfg = InfoManager.masterTalentInfo:GetMasterCfg(self.masterID,i)
  45. if cfg then
  46. table.insert(self.SkillInfoDataList,cfg)
  47. end
  48. end
  49. local isMaxLevel = self.masterLevel >= masterSkilltalentCfg.minMaxLevel[2]
  50. GUI:SetActive(self.view.UpButton,not isMaxLevel)
  51. GUI:SetActive(self.view.NeedPoint,not isMaxLevel)
  52. GUI:DataListUpdateData(self.view.SkillInfoDataList)
  53. end
  54. --------------------------------技能描述-------------------------------------------------------
  55. function this:SkillInfoDataListItemCountFunc()
  56. return #self.SkillInfoDataList
  57. end
  58. function this:SkillInfoDataListItemGetFunc(realIndex)
  59. end
  60. function this:SkillInfoDataListItemInitFunc(realIndex, kmlcontrol)
  61. end
  62. function this:SkillInfoDataListItemUpdateFunc(realIndex, kmlcontrol)
  63. ---有天赋ID说明是打开的天赋tips
  64. if self.masterID then
  65. local data = self.SkillInfoDataList[realIndex + 1]
  66. local strInfo = "LV."..data.level..":"..data.description
  67. local _text = GUI:GetChildControl(self.view.SkillInfoDataList,realIndex,'SkillInfo')
  68. if self.masterLevel == data.level then
  69. GUI:Text_setString(_text,"<color=#1add1f>"..strInfo.."</color>")
  70. elseif self.masterLevel < data.level then
  71. GUI:Text_setString(_text,"<color=#999999>"..strInfo.."</color>")
  72. else
  73. GUI:Text_setString(_text,strInfo)
  74. end
  75. end
  76. end
  77. ------------------------------------------------------------------------------------------------
  78. ---注册UI事件和服务器消息
  79. function this:RegistEvents()
  80. GUI:AddOnClickEvent(self.view.UpButton,self,self.OnClickUpButton)
  81. GUI:AddOnClickEvent(self.view.MaskCloseButton,self,self.OnClickCloseButton)
  82. SL:RegisterLUAEvent(LUA_EVENT_MASTER_SKILL_DATA_CHANGE, self.LUA_EVENT_MASTER_SKILL_DATA_CHANGE, self)
  83. end
  84. ---响应:大师变化信息
  85. function this:LUA_EVENT_MASTER_SKILL_DATA_CHANGE(id,message)
  86. if message and message["type"] then
  87. local type = tonumber(message["type"])
  88. if type == self.type then
  89. self:ShowMasterInfo()
  90. end
  91. end
  92. end
  93. function this:OnClickCloseButton()
  94. GUI:UIPanel_Close("dev/outui/SkillTips/Panel/KLUISkillUpTips2/KLUISkillUpTips2Panel")
  95. end
  96. function this:OnClickUpButton()
  97. if self.args and self.args.callBack then
  98. self.args.callBack()
  99. end
  100. end
  101. ---创建或者刷新界面数据时调用
  102. function this:Refresh()
  103. end
  104. function this:Close()
  105. end
  106. return this