MainActivityInfo.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ---@class MainActivityInfo
  2. MainActivityInfo = class()
  3. local this = MainActivityInfo
  4. function this:ctor()
  5. end
  6. function this:Reset()
  7. self.mainActivityRedsTbl = {}
  8. end
  9. function this:Init()
  10. self:InitData()
  11. self:RegistMessages()
  12. end
  13. function this:InitData()
  14. self.mainActivityRedsTbl = {}
  15. local togDataList = SL:GetConfigTable("sub_mainActivity")
  16. table.sort(togDataList,function(a,b)
  17. return a.sortId < b.sortId
  18. end)
  19. for _, v in pairs(togDataList) do
  20. self.mainActivityRedsTbl[v.togName] = false
  21. end
  22. end
  23. ---刷新活动主界面按钮红点以及子页签红点
  24. ---togName sub_mainActivity表内字段
  25. ---isShow是否展示红点 true展示
  26. function this:RefreshMainActivityRedPoint(togName,isShow)
  27. InfoManager.mainActivityInfo.mainActivityRedsTbl[togName] = isShow
  28. SL:RefreshPanelALLRedStateKmlByCondition("checkMainActivityRed")
  29. local panel = GUI:GetUI("dev/outui/MainActivity/Panel/KLMainActivity/KLMainActivityPanel")
  30. if panel then
  31. panel:RefreshTogRedPointShow()
  32. end
  33. end
  34. function this:RegistMessages()
  35. end
  36. ---@param data table sub表数据
  37. ---获取活动结束开服天数
  38. function this:GetActivityEndDay(data)
  39. local condition = data.showCondition
  40. local conditionTbl = string.split(condition,"&")
  41. for _, v in pairs(conditionTbl) do
  42. local conditions = string.split(v,"#")
  43. if tonumber(conditions[1]) == 903 then
  44. return tonumber(conditions[2])
  45. end
  46. end
  47. return 0
  48. end
  49. ---@param days number 开服第几天 活动结束的开服天数
  50. ---@param hour number 第几个小时 0代表0点
  51. ---获取活动结束倒计时 秒
  52. function this:ShowActivityDJSFunc(days,hour)
  53. local endTime = SL:GetEndTimeStamp(days,hour)
  54. local nowTime = Time.GetServerTime()
  55. local countdown = (endTime - nowTime) / 1000
  56. countdown = Mathf.Max(0, countdown)
  57. countdown = math.floor(countdown)
  58. return countdown
  59. end