KLChallengeBossSanctuaryMapItem.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ---@class KLChallengeBossSanctuaryMapItem:UIKmlLuaPanelBase
  2. ---@field view KLChallengeBossSanctuaryMapItemView
  3. ---@field data cfg_mapMove_column
  4. ---@field panel KLChallengeBossSanctuaryMapPanel
  5. ---@field isSelected boolean @是否选中
  6. ---@field isLevel boolean @等级是否满足
  7. local KLChallengeBossSanctuaryMapItem = class(UIKmlLuaPanelBase)
  8. local this = KLChallengeBossSanctuaryMapItem
  9. ---创建时调用一次
  10. function this:Init()
  11. end
  12. function this:InitData(index, data,panel)
  13. self.index = index
  14. self.data = data
  15. self.panel = panel
  16. self.isSelected = false
  17. end
  18. ---注册UI事件和服务器消息
  19. function this:RegistEvents()
  20. GUI:AddOnClickEvent(self.view.btnSelect, self, self.BtnSelectOnClick)
  21. end
  22. function this:BtnSelectOnClick()
  23. if self.panel then
  24. self.panel:ItemSelectOnClick(self)
  25. end
  26. end
  27. function this:SetSelected(isSelected)
  28. GUI:SetActive(self.view.select,isSelected)
  29. self.isSelected = isSelected
  30. end
  31. ---界面显示时调用一次
  32. function this:Show()
  33. end
  34. ---创建或者刷新界面数据时调用
  35. function this:Refresh()
  36. end
  37. function this:RefreshUI()
  38. if self.data then
  39. GUI:Text_setString(self.view.textMapName,self.data.mapName)
  40. GUI:Text_setString(self.view.textLevel,self.data.level.."级开启")
  41. local playerLevel = SL:GetMetaValue(EMetaVarGetKey.LEVEL)
  42. if playerLevel >= self.data.level then
  43. GUI:Text_setTextColor(self.view.textLevel,"#00FF00")
  44. self.isLevel = true
  45. else
  46. GUI:Text_setTextColor(self.view.textLevel,"#FF0000")
  47. self.isLevel = false
  48. end
  49. end
  50. end
  51. function this:Hide()
  52. end
  53. function this:Close()
  54. end
  55. return this