NewGotTipsMgr.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --[[
  2. 新获得提示,管理 UISuccessTips 的显示数据
  3. ]]
  4. local NewGotTipsMgr = class("NewGotTipsMgr")
  5. function NewGotTipsMgr:ctor()
  6. self.showDatas = {}
  7. end
  8. function NewGotTipsMgr:Destroy()
  9. self.showDatas = nil
  10. end
  11. function NewGotTipsMgr:GetShowData()
  12. if self.showDatas then
  13. local curData = self.showDatas[1]
  14. if curData and curData.datas then
  15. return curData.type, curData.datas[1]
  16. end
  17. end
  18. return nil, nil
  19. end
  20. ---@param type type为类型获得新技能,解锁新功能等,(1:为获得新技能)
  21. ---@param datas 技能时为List{skillType=Enum.SkillType.Active,skillId=10001}
  22. function NewGotTipsMgr:AddShowData(type, datas)
  23. if not self.showDatas then self.showDatas = {} end
  24. table.insert(self.showDatas, {type = type, datas = datas})
  25. if not ManagerContainer.LuaUIMgr:HasOpenPage(Enum.UIPageName.UISuccessTips) then
  26. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UISuccessTips)
  27. end
  28. end
  29. function NewGotTipsMgr:RemoveCurShowData()
  30. if not self.showDatas then return false end
  31. local curData = self.showDatas[1]
  32. if curData and curData.datas then
  33. table.remove(curData.datas, 1)
  34. if #curData.datas <= 0 then
  35. table.remove(self.showDatas, 1)
  36. end
  37. else
  38. table.remove(self.showDatas, 1)
  39. end
  40. return self.showDatas[1] ~= nil
  41. end
  42. return NewGotTipsMgr