KLFriendApplySubItem.lua 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ---@class KLFriendApplySubItem:UIKmlLuaPanelBase
  2. ---@field view KLFriendApplySubItemView
  3. local KLFriendApplySubItem = class(UIKmlLuaPanelBase)
  4. local this =KLFriendApplySubItem
  5. ---创建时调用一次
  6. function this:Init()
  7. self.list = {}
  8. self:UpdateData()
  9. end
  10. ---创建或者刷新界面数据时调用
  11. function this:Refresh()
  12. end
  13. ---注册UI事件和服务器消息
  14. function this:RegistEvents()
  15. SL:RegisterLUAEvent(LUA_EVENT_FRIEND_LIST_CHANGE, self.UpdateList, self)
  16. end
  17. function this:UpdateList(_, type)
  18. self:UpdateData()
  19. end
  20. function this:UpdateData()
  21. local filePath = "dev/ui/FriendSys/Item/KLFriendAddList/KLFriendAddListItem"
  22. for _, v in pairs(self.list) do
  23. GUI:UIPanel_Close(filePath, v)
  24. end
  25. table.clear(self.list)
  26. local friendApplyList = SL:GetFriendData(EFriendRelation.ApplyList)
  27. for _, v in pairs(friendApplyList) do
  28. table.insert(self.list, GUI:UIPanel_Open(filePath, self.view.ListContent,
  29. self, {addFriend = false, data = v}, true))
  30. end
  31. end
  32. function this:Close()
  33. end
  34. return this