UIFriendListCtr.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. local UIFriendListCtr = class("UIFriendListCtr", require("UICtrBase"))
  2. local FriendDataMgr =ManagerContainer.DataMgr.FriendDataMgr
  3. function UIFriendListCtr:Init(view)
  4. self.view = view
  5. end
  6. function UIFriendListCtr:SetData(data)
  7. self.asyncIdx = 0
  8. if data == nil then return end
  9. self.data = data
  10. end
  11. function UIFriendListCtr:GetAsyncIdx()
  12. self.asyncIdx = self.asyncIdx + 1
  13. return self.asyncIdx
  14. end
  15. function UIFriendListCtr:GetData()
  16. return self.data
  17. end
  18. function UIFriendListCtr:OnDispose()
  19. self.data = nil
  20. self.view = nil
  21. end
  22. function UIFriendListCtr:GetMaxNum(type)
  23. if type == Enum.FriendTogglePageType.InterestList then
  24. return FriendDataMgr.maxFriendNum
  25. elseif type == Enum.FriendTogglePageType.FansList then
  26. return FriendDataMgr.maxFansNum
  27. elseif type == Enum.FriendTogglePageType.BlackList then
  28. return FriendDataMgr.maxBlackNum
  29. else
  30. return 0
  31. end
  32. end
  33. function UIFriendListCtr:GetNum(type)
  34. if type == Enum.FriendTogglePageType.InterestList then
  35. return FriendDataMgr.totalFriendNum
  36. elseif type == Enum.FriendTogglePageType.FansList then
  37. return FriendDataMgr.totalFansNum
  38. elseif type == Enum.FriendTogglePageType.BlackList then
  39. return FriendDataMgr.totalBlackNum
  40. else
  41. return 0
  42. end
  43. end
  44. function UIFriendListCtr:GetDefaultPageType()
  45. return self.data or Enum.FriendTogglePageType.InterestList
  46. end
  47. function UIFriendListCtr:GetDataByType(type)
  48. return FriendDataMgr:GetDataListByType(type)
  49. end
  50. function UIFriendListCtr:GetSearchData()
  51. return FriendDataMgr:GetSearchData()
  52. end
  53. function UIFriendListCtr:RequestSearchPlayerByName(targetName)
  54. FriendDataMgr:SearchFriendReq(targetName)
  55. -- ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_Show_SearchFriendData)
  56. end
  57. function UIFriendListCtr:RequestDataByType(type)
  58. FriendDataMgr:RequestDataList(type)
  59. -- ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_Refresh_FriendData,type)
  60. end
  61. function UIFriendListCtr:RequestFriendRecommend()
  62. FriendDataMgr:GetFriendRecommendReq()
  63. -- ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_Refresh_FriendData,Enum.FriendTogglePageType.FriendRecommend)
  64. end
  65. function UIFriendListCtr:ReqestFriendBriefData(type)
  66. local uid_list = FriendDataMgr:GetUidListByType(type,10)
  67. FriendDataMgr:ReqFriendBriefData(type,uid_list)
  68. end
  69. function UIFriendListCtr:FollowPlayer(uid)
  70. FriendDataMgr:AddFriendReq(uid)
  71. end
  72. function UIFriendListCtr:UnfollowPlayer(uid)
  73. FriendDataMgr:DeleteFriendReq(uid)
  74. end
  75. function UIFriendListCtr:RemoveBlackPlayer(uid)
  76. FriendDataMgr:RemoveBlackReq(uid)
  77. end
  78. function UIFriendListCtr:ChatToPlayer(uid,nickName,headId, jobId, level,sex)
  79. ManagerContainer.LuaUIMgr:PrivateChatOtherPlayer(uid,nickName,headId, jobId, level,sex)
  80. end
  81. function UIFriendListCtr:ShowPlayerInfo(uid)
  82. ManagerContainer.LuaUIMgr:OpenRoleMessagePanel(uid)
  83. end
  84. function UIFriendListCtr:CleanRedPoint()
  85. FriendDataMgr:CleanRedPoint()
  86. end
  87. return UIFriendListCtr