WidgetCacheMediator.lua 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. local DebugMediator = requireMediator("DebugMediator")
  2. local WidgetCacheMediator = class("WidgetCacheMediator", DebugMediator)
  3. WidgetCacheMediator.NAME = "WidgetCacheMediator"
  4. function WidgetCacheMediator:ctor()
  5. WidgetCacheMediator.super.ctor(self)
  6. global.WidgetCacheManager:WidgetPoolCapacity("item/item", 50)
  7. global.WidgetCacheManager:WidgetPoolCapacity("bag_item/bag_item", 40)
  8. global.WidgetCacheManager:WidgetPoolCapacity("bag_item/bag_item_effect", 40)
  9. global.WidgetCacheManager:WidgetPoolCapacity("bag_item/bag_item_num", 40)
  10. end
  11. function WidgetCacheMediator:listNotificationInterests()
  12. local noticeTable = global.NoticeTable
  13. return {
  14. noticeTable.ReleaseMemory
  15. }
  16. end
  17. function WidgetCacheMediator:handleNotification(notification)
  18. local noticeName = notification:getName()
  19. local noticeTable = global.NoticeTable
  20. local noticeData = notification:getBody()
  21. if noticeName == noticeTable.ReleaseMemory then
  22. global.WidgetCacheManager:Clear()
  23. end
  24. end
  25. return WidgetCacheMediator