UIGMCtr.lua 716 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. local UIGMCtr = class("UIGMCtr", require("UICtrBase"))
  2. function UIGMCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIGMCtr:SetData(data)
  6. self.data = data
  7. self.asyncIdx = 0
  8. end
  9. function UIGMCtr:GetAsyncIdx()
  10. self.asyncIdx = self.asyncIdx + 1
  11. return self.asyncIdx
  12. end
  13. function UIGMCtr:GetData()
  14. return self.data
  15. end
  16. function UIGMCtr:OnDispose()
  17. self.data = nil
  18. self.view = nil
  19. end
  20. function UIGMCtr:TidyData()
  21. if not self._data then
  22. self._data = {};
  23. local _data = ManagerContainer.CfgMgr:GetGMCfg();
  24. for _k, _v in pairs(_data) do
  25. table.insert(self._data, _v);
  26. end
  27. table.sort(self._data, function(a, b)
  28. return a.SortIndex < b.SortIndex;
  29. end)
  30. end
  31. return self._data;
  32. end
  33. return UIGMCtr