GoldChallengeTaskInfo.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. ---@class GoldChallengeTaskInfo @注释
  2. ---@field taskInfo {nowtaskpool:table,flushcount:number,nowtask:GoldChallengeTask,firstopen:boolean,dailyrecord:GoldChallengeTask,lastresettime:number,taskPool:{k:number,v:number}}
  3. ---@class GoldChallengeTask
  4. ---@field taskid number 配置表id
  5. ---@field star number 星级
  6. ---@field progress number 进度
  7. ---@field status GoldChallengeTaskEnum
  8. ---@class GoldChallengeTaskEnum
  9. GoldChallengeTaskEnum = {
  10. ---已领取
  11. Accept = 1,
  12. ---已完成
  13. Finish = 2,
  14. ---已提交
  15. submit = 3,
  16. }
  17. GoldChallengeTaskInfo = class()
  18. local this = GoldChallengeTaskInfo
  19. function this:ctor()
  20. end
  21. function this:Init()
  22. self.taskInfo = {}
  23. self:InitData()
  24. self:RegistMessages()
  25. end
  26. function this:InitData()
  27. end
  28. function this:RegistMessages()
  29. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_GOLD_TASK_INFO, self.ResGoldTaskInfo, self)
  30. --SL:RegisterLUAEvent(LUA_EVENT_MAIN_UI_VISIBLE,self.ShowMonsterList,self)
  31. end
  32. --[[function this:ShowMonsterList(_,message)
  33. if message and message.vis == true then
  34. if self:IsShowMonsterList(self.taskInfo) then
  35. GUI:UIPanel_Open("dev/ui/Monster/Panel/KLMonsterMapPoint/KLMonsterMapPointPanel")
  36. else
  37. GUI:UIPanel_Close("dev/ui/Monster/Panel/KLMonsterMapPoint/KLMonsterMapPointPanel")
  38. end
  39. end
  40. end]]
  41. function this:ResGoldTaskInfo(_, message)
  42. if message then
  43. self.taskInfo = message
  44. end
  45. end
  46. function this:IsShowMonsterList(taskList)
  47. if taskList and taskList.nowtask and taskList.nowtask.status then
  48. local status = taskList.nowtask.status
  49. if status == GoldChallengeTaskEnum.Accept then
  50. local monsterList = SL:GetConfig("cfg_task_gold", taskList.nowtask.taskid).monlist
  51. if monsterList and monsterList == 1 then
  52. return true
  53. end
  54. end
  55. end
  56. return false
  57. end
  58. function this:IsMapMonsterData()
  59. local mapMonsterData = {}
  60. local mapId = SL:GetMetaValue(EMetaVarGetKey.MAP_ID)
  61. for i, v in pairs(SL:FindConfigs('cfg_mongen', "mapid", mapId)) do
  62. if v.monsterShowList == 1 then
  63. v.reliveTime = 0
  64. table.insert(mapMonsterData, v)
  65. end
  66. end
  67. local monsterPoints = SL:GetMapMonsterStatus()
  68. if monsterPoints then
  69. for i = 1, #mapMonsterData, 1 do
  70. local monsterid = mapMonsterData[i].monsterid
  71. local id = mapMonsterData[i].id
  72. for _, v in pairs(monsterPoints) do
  73. if v.groupId == id and v.configId == monsterid then
  74. if v.reliveTime and v.reliveTime ~= 0 then
  75. mapMonsterData[i].reliveTime = v.reliveTime
  76. end
  77. end
  78. end
  79. end
  80. end
  81. if not next(mapMonsterData) then
  82. return false
  83. else
  84. return true
  85. end
  86. end
  87. function this:Reset()
  88. end