KLItemItem.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ---@class KLItemItem:UIKmlLuaPanelBase
  2. ---@field view KLItemItemView
  3. local KLItemItem = class(UIKmlLuaPanelBase)
  4. local this =KLItemItem
  5. ---创建时调用一次
  6. function this:Init()
  7. end
  8. ---创建或者刷新界面数据时调用
  9. function this:Refresh()
  10. GUI:setContentSize(self.view.control_item,self.args.width,self.args.height)
  11. GUI:setContentSize(self.view.KLItemItem,self.args.width,self.args.height)
  12. self:RefreshItem(self.args.cfgId,self.args.count)
  13. --GUI:Image_loadTexture(self.view.control_item,self.args.src,self.args.atlas)
  14. end
  15. ---注册UI事件和服务器消息
  16. function this:RegistEvents()
  17. GUI:AddOnClickEvent(self.view.control_item,self,self.OnCliCkTipBtn)
  18. end
  19. function this:OnCliCkTipBtn()
  20. SL:OpenTips(nil, self.args.cfgId)
  21. end
  22. function this:RefreshItem(cfgId,count)
  23. GUI:Item_UpdataData(self.view.control_item, {
  24. itemid = cfgId,
  25. itemcustomcount = not string.isNullOrEmpty(count) and GUIUtil.FormatNumber(tonumber(count),true) or count,
  26. mfixsize = self.args.width..","..self.args.height
  27. })
  28. end
  29. function this:Close()
  30. end
  31. return this