源战役客户端
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

93 рядки
2.6 KiB

4 тижднів тому
  1. --[[@------------------------------------------------------------------
  2. @description:
  3. @author:wyb
  4. ----------------------------------------------------------------------]]
  5. FuliNoticeTab = FuliNoticeTab or BaseClass(BaseItem)
  6. function FuliNoticeTab:__init()
  7. self.base_file = "Fuli"
  8. self.layout_file = "FuliNoticeTab"
  9. self.is_delay_callback = true
  10. self:Load()
  11. end
  12. function FuliNoticeTab:Load_callback()
  13. self.imSelect = self:GetChild("imSelect").gameObject
  14. self.txtName = self:GetChild("txtName"):GetComponent("TextMeshProUGUI")
  15. self.type_image_img = self:GetChild("type_image"):GetComponent("Image")
  16. self.click_con_obj = self:GetChild("click_con").gameObject
  17. self.redDot = self:GetChild("redDot").gameObject
  18. if self.need_refreshData then
  19. self:SetData(self.data, self.index)
  20. end
  21. self:InitEvent()
  22. end
  23. function FuliNoticeTab:InitEvent()
  24. local function onBtnClickHandler(target)
  25. if target == self.click_con_obj then
  26. if self.callback and self.data then
  27. self.callback(self.index)
  28. end
  29. end
  30. end
  31. AddClickEvent(self.click_con_obj, onBtnClickHandler)
  32. end
  33. function FuliNoticeTab:SetData(data, index)
  34. self.data = data
  35. self.index = index
  36. if not self.is_loaded then
  37. self.need_refreshData = true
  38. return
  39. end
  40. self.need_refreshData = false
  41. -- self.type_text_txt.text = "活动"
  42. -- self.type_text_txt.color = ColorUtil:ConvertHexToRGBColor("ffdff5")
  43. -- if tonumber(data.tag) == 1 then
  44. -- lua_resM:setImageSprite(self,self.type_image_img, "account_asset", "account_notice_type1")
  45. -- self.type_text_txt.text = "系统"
  46. -- self.type_text_txt.color = ColorUtil:ConvertHexToRGBColor("79fffd")
  47. -- end
  48. self.txtName.text = data.tiltle
  49. if self.isSelect ~= nil then
  50. self:SetSelectState(self.isSelect)
  51. end
  52. if self.isShowRed ~= nil then
  53. self:ShowRedDot(self.isShowRed)
  54. end
  55. end
  56. function FuliNoticeTab:SetCallBack(callback)
  57. self.callback = callback
  58. end
  59. function FuliNoticeTab:SetSelectState(isShow)
  60. if self.is_loaded then
  61. self.imSelect:SetActive(isShow)
  62. -- local color = isShow and Color(64/255, 70/255, 90/255, 1) or Color(140/255, 149/255, 172/255, 1)
  63. local color = isShow and ColorUtil:ConvertHexToRGBColor("FFFFFF") or ColorUtil:ConvertHexToRGBColor("7D91AC")
  64. self.txtName.color = color
  65. if isShow then
  66. SetTMPSharedMaterial(self.txtName, ShaderTools.TMPSharedMaterialType.FZZZOutlineBlueTab)
  67. else
  68. SetTMPSharedMaterial(self.txtName, ShaderTools.TMPSharedMaterialType.FZZZDefault)
  69. end
  70. self.isSelect = nil
  71. else
  72. self.isSelect = isShow
  73. end
  74. end
  75. function FuliNoticeTab:ShowRedDot(bool)
  76. if self.is_loaded then
  77. self.redDot:SetActive(bool)
  78. self,isShowRed = nil
  79. else
  80. self.isShowRed = bool
  81. end
  82. end