KLUCrossServerMainBtnItem.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---@class KLUCrossServerMainBtnItem:UIKmlLuaPanelBase
  2. ---@field view KLUCrossServerMainBtnItemView
  3. local KLUCrossServerMainBtnItem = class(UIKmlLuaPanelBase)
  4. local this = KLUCrossServerMainBtnItem
  5. ---创建时调用一次
  6. function this:Init()
  7. end
  8. ---创建或者刷新界面数据时调用
  9. function this:Refresh()
  10. end
  11. function this:RefreshItem(data,select_id,panel)
  12. self.panel = panel
  13. self.data = data
  14. GUI:Text_setString(self.view.type_name,self.data.name)
  15. if self.data.id == select_id then
  16. GUI:setVisible(self.view.level_select,true)
  17. else
  18. GUI:setVisible(self.view.level_select,false)
  19. end
  20. end
  21. function this:HideItem()
  22. GUI:setVisible(self.view.level_select,false)
  23. end
  24. ---注册UI事件和服务器消息
  25. function this:RegistEvents()
  26. GUI:AddOnClickEvent(self.view.btn,self,self.OnclickIcon)
  27. end
  28. function this:OnclickIcon()
  29. self.panel:HideSelect()
  30. GUI:setVisible(self.view.level_select,true)
  31. self.panel:Select(self.data.id,self)
  32. end
  33. function this:Close()
  34. end
  35. return this