KLGemInlayAllInfoPanel.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ---@class KLGemInlayAllInfoPanel:UIKmlLuaPanelBase
  2. ---@field view KLGemInlayAllInfoPanelView
  3. local KLGemInlayAllInfoPanel = class(UIKmlLuaPanelBase)
  4. local this =KLGemInlayAllInfoPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. GUI:DataListInitData(self.view.datalist4, function()
  10. return self:CurrentCountFunc()
  11. end, function(realIndex)
  12. return self:CurrentGetFunc(realIndex)
  13. end, function(realIndex, kmlcontrol)
  14. return self:CurrentInitFunc(realIndex, kmlcontrol)
  15. end, function(realIndex, kmlcontrol)
  16. return self:CurrentUpdateFunc(realIndex, kmlcontrol)
  17. end)
  18. end
  19. ---注册UI事件和服务器消息
  20. function this:RegistEvents()
  21. GUI:AddOnClickEvent(self.view.closeMaskBg, self, self.OnClickCloseMaskBg)
  22. end
  23. ---界面显示时调用一次
  24. function this:Show()
  25. end
  26. ---创建或者刷新界面数据时调用
  27. function this:Refresh()
  28. self.AllGemSuitList = {}
  29. for i, v in ipairs(InfoManager.gemSlateInfo.AllGemSuitCfgTbl) do
  30. local data = v
  31. local isActive = false
  32. if data.sortId<0 then
  33. if InfoManager.gemSlateInfo.maxLevelActiveGroupSuitCfgLst[data.gemCondition[1]] and data.id==InfoManager.gemSlateInfo.maxLevelActiveGroupSuitCfgLst[data.gemCondition[1]].id then
  34. isActive = true
  35. end
  36. end
  37. table.insert(self.AllGemSuitList,{data=data,isActive=isActive})
  38. end
  39. table.sort(self.AllGemSuitList,function(a, b)
  40. if not a.isActive and not b.isActive then
  41. return a.data.id < b.data.id
  42. end
  43. if a.isActive and b.isActive then
  44. return a.data.id < b.data.id
  45. end
  46. return a.isActive
  47. end)
  48. GUI:DataListUpdateData(self.view.datalist4)
  49. end
  50. function this:CurrentCountFunc()
  51. return #self.AllGemSuitList
  52. end
  53. function this:CurrentGetFunc(realIndex)
  54. end
  55. function this:CurrentInitFunc(realIndex,kmlcontrol)
  56. end
  57. function this:CurrentUpdateFunc(realIndex,kmlcontrol)
  58. ---@type cfg_equip_gemSuit_column
  59. local data = self.AllGemSuitList[realIndex + 1].data
  60. local isActive = self.AllGemSuitList[realIndex + 1].isActive
  61. local NotActive = GUI:GetChildControl(self.view.datalist4, realIndex, "NotActive")
  62. local ActiveTxt = GUI:GetChildControl(self.view.datalist4, realIndex, "ActiveTxt")
  63. GUI:SetActive(NotActive,false)
  64. GUI:SetActive(ActiveTxt,isActive)
  65. local txtShowColor="#DCE1E5"
  66. local titleColor="#e6e600"
  67. if not isActive then
  68. txtShowColor="#8E8E8E"
  69. titleColor="#8E8E8E"
  70. end
  71. local gemTitleParent = GUI:GetChildControl(self.view.datalist4, realIndex, "gemTitleParent")
  72. local attrInfoTxt = GUI:GetChildControl(self.view.datalist4, realIndex, "attrInfoTxt")
  73. local skillInfoTxt = GUI:GetChildControl(self.view.datalist4, realIndex, "skillInfoTxt")
  74. GUI:Text_setString(gemTitleParent,data.title)
  75. GUI:Text_setTextColor(gemTitleParent,titleColor)
  76. local attrStr=""
  77. for i,v in ipairs(data.suitAtt) do
  78. local tmpStr=SL:GetConfig("cfg_att_info", v[1]).showname..v[2].." "
  79. attrStr=attrStr..tmpStr
  80. end
  81. -- local attrTbl = SL:GetConfig("cfg_att_info", v[1])
  82. GUI:Text_setString(attrInfoTxt,attrStr)
  83. GUI:Text_setTextColor(attrInfoTxt,txtShowColor)
  84. GUI:SetActive(attrInfoTxt,attrStr ~= "")
  85. GUI:Text_setString(skillInfoTxt,data.skillText)
  86. GUI:Text_setTextColor(skillInfoTxt,txtShowColor)
  87. end
  88. function this:OnClickCloseMaskBg()
  89. GUI:UIPanel_Close("dev/outui/Equip/Panel/KLGemInlayAllInfo/KLGemInlayAllInfoPanel")
  90. end
  91. function this:Close()
  92. end
  93. return this