1234567891011121314151617181920212223242526272829303132333435363738 |
- ---@class KLUIBuffInfoListPanel:UIKmlLuaPanelBase
- ---@field view KLUIBuffInfoListPanelView
- ---@field args table<number,Buff>
- local KLUIBuffInfoListPanel = class(UIKmlLuaPanelBase)
- local this =KLUIBuffInfoListPanel
- ---创建时调用一次
- function this:Init()
- self.buffTemplateList = {}
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
- self:Clear()
- for i, v in pairs(self.args) do
- local buffTemplate = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLBuffInfo/KLBuffInfoItem",self.view.buffInfo_list,self,v,true)
- table.insert(self.buffTemplateList,buffTemplate)
- end
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- GUI:AddOnClickEvent(self.view.closeBtn,self,self.Close)
- end
- function this:Close()
- GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfo/KLUIBuffInfoPanel")
- GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
- end
- ---清除数据
- function this:Clear()
- ---@param buffTemplate KLBuffInfoItem
- for i, buffTemplate in pairs(self.buffTemplateList) do
- GUI:UIPanel_Close(nil,buffTemplate)
- end
- self.buffTemplateList = {}
- end
- return this
|