UIIdolMyFansTipsView.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. local UIIdolMyFansTipsView = require("UISeason/UIIdolMyFansTipsView_Generate")
  2. local FansInfoList = {}
  3. function UIIdolMyFansTipsView:OnAwake(data)
  4. self.controller = require("UISeason/UIIdolMyFansTipsCtr"):new()
  5. self.controller:Init(self)
  6. self.controller:SetData(data)
  7. end
  8. function UIIdolMyFansTipsView:AddEventListener()
  9. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
  10. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.REFRESH_IDOL_MYFANS_INFO, self, self.RefreshPlayerInfo)
  11. end
  12. function UIIdolMyFansTipsView:FillContent(data, uiBase)
  13. self.uiBase = uiBase
  14. local gameObject = self.uiBase:GetRoot()
  15. if gameObject ~= nil then
  16. self.gameObject = gameObject
  17. self.transform = gameObject.transform
  18. end
  19. self:InitGenerate(self.transform, data)
  20. self:Init()
  21. end
  22. function UIIdolMyFansTipsView:Init()
  23. self:InitGrid()
  24. ManagerContainer.DataMgr.IdolData:SendGetSelfFansInfoReq()
  25. end
  26. function UIIdolMyFansTipsView:InitGrid()
  27. self.rankScroll.scrollRect.enabled = false
  28. self.rankScroll.loopGridView:InitGridView(0, function(gridView, itemIndex, row, column)
  29. return self:GetItemByRowColumn(gridView, itemIndex, row, column)
  30. end, nil)
  31. end
  32. function UIIdolMyFansTipsView:RefreshPlayerInfo()
  33. FansInfoList = ManagerContainer.DataMgr.IdolData:GetMyFansData()
  34. self.rankScroll.loopGridView:RefreshListByIndex(FansInfoList and #FansInfoList or 0,0)
  35. end
  36. function UIIdolMyFansTipsView:GetItemByRowColumn(gridView, itemIndex, row, column)
  37. local item = nil
  38. item = gridView:NewListViewItem('FansItem')
  39. local data = FansInfoList[itemIndex + 1]
  40. local itemLua = CommonUtil.BindGridViewItem2Lua(self, 'FansItem', item.gameObject)
  41. itemLua.text.text.text = I18N.SetLanguageValue('MyFans1',CommonUtil.GetVaildNickName(data.name),data.score)
  42. return item
  43. end
  44. function UIIdolMyFansTipsView:OnPageInEnd()
  45. self.super.OnPageInEnd(self)
  46. self.rankScroll.scrollRect.enabled = true
  47. end
  48. function UIIdolMyFansTipsView:RemoveEventListener()
  49. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  50. end
  51. function UIIdolMyFansTipsView:AddUIEventListener()
  52. self.uiBase:AddButtonEventListener(self.closeBtn.button, self, self.OnClickCloseBtn)
  53. self.uiBase:AddButtonEventListener(self.AnyBtn.button, self, self.OnClickCloseBtn)
  54. end
  55. function UIIdolMyFansTipsView:OnClickCloseBtn()
  56. self:UIClose()
  57. end
  58. function UIIdolMyFansTipsView:OnHide()
  59. end
  60. function UIIdolMyFansTipsView:OnShow(data)
  61. self.controller:SetData(data)
  62. end
  63. function UIIdolMyFansTipsView:OnClose()
  64. end
  65. function UIIdolMyFansTipsView:OnDispose()
  66. self.controller:OnDispose()
  67. self.rankScroll.loopGridView:Dispose()
  68. end
  69. return UIIdolMyFansTipsView