KLUIOpenServerFirstKillPanel.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. ---@class KLUIOpenServerFirstKillPanel:UIKmlLuaPanelBase
  2. ---@field view KLUIOpenServerFirstKillPanelView
  3. ---@field rankingBoss cfg_goldFirstKill_column[]
  4. local KLUIOpenServerFirstKillPanel = class(UIKmlLuaPanelBase)
  5. local this =KLUIOpenServerFirstKillPanel
  6. function this:AsyncLoadUI()
  7. end
  8. ---创建时调用一次
  9. function this:Init()
  10. self.globalServerRewardListData = {}
  11. self.personRewardListData = {}
  12. self.monsterTemps = {}
  13. self.globalServerRewardListItem = {}
  14. self.personRewardListItem = {}
  15. self.rankingBoss = SL:GetConfigTable("cfg_goldFirstKill")
  16. self.curSelectIndex = 1
  17. self.SpSelectParent = nil
  18. self.lastSelectItem = nil
  19. self.startPosX = -975
  20. self.addSign = 1
  21. self:InitUI()
  22. end
  23. function this:InitUI()
  24. self:InitMonsterList()
  25. self:InitGlobalServerRewardList()
  26. self:InitPersonRewardList()
  27. end
  28. --region 个人奖励列表
  29. function this:InitPersonRewardList()
  30. GUI:DataListInitData(self.view.DataPersonRewardList, function()
  31. return self:PersonRewardItemCountFunc()
  32. end, function(realIndex)
  33. return self:PersonRewardItemGetFunc(realIndex)
  34. end, function(realIndex, kmlcontrol)
  35. return self:PersonRewardItemInitFunc(realIndex, kmlcontrol)
  36. end, function(realIndex, kmlcontrol)
  37. return self:PersonRewardItemUpdateFunc(realIndex, kmlcontrol)
  38. end)
  39. end
  40. function this:PersonRewardItemCountFunc()
  41. return table.count(self.personRewardListData)
  42. end
  43. function this:PersonRewardItemGetFunc(realIndex)
  44. end
  45. function this:PersonRewardItemInitFunc(realIndex, kmlcontrol)
  46. end
  47. function this:PersonRewardItemUpdateFunc(realIndex, kmlcontrol)
  48. ---设置个人首杀奖励item
  49. local data = self.personRewardListData[realIndex + 1]
  50. local ctrlItem = GUI:GetChildControl(self.view.DataPersonRewardList,realIndex,'ItemPerson')
  51. local stateImg = GUI:GetChildControl(self.view.DataPersonRewardList,realIndex,'StateImg')
  52. GUI:Item_setItemId(ctrlItem,data[1])
  53. GUI:setVisible(stateImg,self.isPersonGet)
  54. GUI:Item_setItemCount(ctrlItem,tostring(data[2]))
  55. GUI:AddOnClickEvent(ctrlItem,self,function()
  56. SL:OpenTips(nil, data[1])
  57. end)
  58. end
  59. --endregion
  60. --region 全服奖励列表
  61. function this:InitGlobalServerRewardList()
  62. GUI:DataListInitData(self.view.DataGlobalServerRewardList, function()
  63. return self:GlobalServerRewardItemCountFunc()
  64. end, function(realIndex)
  65. return self:GlobalServerRewardItemGetFunc(realIndex)
  66. end, function(realIndex, kmlcontrol)
  67. return self:GlobalServerRewardItemInitFunc(realIndex, kmlcontrol)
  68. end, function(realIndex, kmlcontrol)
  69. return self:GlobalServerRewardItemUpdateFunc(realIndex, kmlcontrol)
  70. end)
  71. end
  72. function this:GlobalServerRewardItemCountFunc()
  73. return table.count(self.globalServerRewardListData)
  74. end
  75. function this:GlobalServerRewardItemGetFunc(realIndex)
  76. end
  77. function this:GlobalServerRewardItemInitFunc(realIndex, kmlcontrol)
  78. end
  79. function this:GlobalServerRewardItemUpdateFunc(realIndex, kmlcontrol)
  80. local data = self.globalServerRewardListData[realIndex + 1]
  81. local ctrlItem = GUI:GetChildControl(self.view.DataGlobalServerRewardList,realIndex,'ItemServer')
  82. local tickImg = GUI:GetChildControl(self.view.DataGlobalServerRewardList,realIndex,'TickImg')
  83. local sendTxt = GUI:GetChildControl(self.view.DataGlobalServerRewardList,realIndex,'SendTxt')
  84. GUI:Item_setItemId(ctrlItem,data[1])
  85. GUI:Item_setItemCount(ctrlItem,data[2])
  86. GUI:setVisible(tickImg,self.state)
  87. GUI:setVisible(sendTxt,self.state)
  88. GUI:AddOnClickEvent(ctrlItem,self,function()
  89. SL:OpenTips(nil, data[1])
  90. end)
  91. end
  92. --endregion
  93. --region boss列表
  94. function this:InitMonsterList()
  95. GUI:DataListInitData(self.view.DataMonsterList, function()
  96. return self:MonsterItemCountFunc()
  97. end, function(realIndex)
  98. return self:MonsterItemGetFunc(realIndex)
  99. end, function(realIndex, kmlcontrol)
  100. return self:MonsterItemInitFunc(realIndex, kmlcontrol)
  101. end, function(realIndex, kmlcontrol)
  102. return self:MonsterItemUpdateFunc(realIndex, kmlcontrol)
  103. end)
  104. end
  105. function this:MonsterItemCountFunc()
  106. return table.count(self.rankingBoss)
  107. end
  108. function this:MonsterItemGetFunc(realIndex)
  109. ---@type KLUIFirstKillMonsterItem
  110. local item = GUI:UIPanel_Open("dev/outui/OpenServerActivity/Item/KLUIFirstKillMonster/KLUIFirstKillMonsterItem", self.view.DataMonsterList, self, nil, true,function(_item)
  111. self.monsterTemps[_item.view.root] = _item
  112. self:MonsterItemUpdateFunc(realIndex,_item.view.root)
  113. if SL:GetIsWebGL() then
  114. self.addSign = self.addSign + 1
  115. if self.addSign >= 6 then
  116. self.addSign = 1
  117. GUI:SetScrollView_scrollpos(self.view.MonsterViewList,self.curSelectIndex-1)
  118. end
  119. end
  120. end)
  121. local kmlCtrl = item.view.root
  122. self.monsterTemps[kmlCtrl] = item
  123. return kmlCtrl
  124. end
  125. function this:MonsterItemInitFunc(realIndex, kmlcontrol)
  126. end
  127. ---@param rectTrans KingML.KmlControl
  128. function this:MonsterItemUpdateFunc(cIndex, rectTrans)
  129. ---@type KLUIFirstKillMonsterItem
  130. local loopTemp = self.monsterTemps[rectTrans]
  131. if loopTemp.view and loopTemp.view.root.panel.isLoading then
  132. return
  133. end
  134. local bossFistKillInfo = InfoManager.openServiceAthleticsInfo.bossFistKillInfo
  135. local isShowRedDot = false
  136. local luaIndex = cIndex + 1
  137. local dat = self.rankingBoss[luaIndex]
  138. local monsterId = tostring(dat.id)
  139. if bossFistKillInfo then
  140. if (bossFistKillInfo.allServerData[monsterId] and (not bossFistKillInfo.envelope[monsterId] or bossFistKillInfo.envelope[monsterId] == false))
  141. or bossFistKillInfo.taskInfo[monsterId] == "2" then
  142. isShowRedDot = true
  143. end
  144. end
  145. loopTemp:RefreshUI(dat, luaIndex, isShowRedDot,self)
  146. if self.curSelectIndex == luaIndex then
  147. loopTemp:SetSelectActive(true)
  148. self.lastSelectItem = loopTemp
  149. self.SpSelectParent = rectTrans
  150. self:MonsterIconOnClick(loopTemp)
  151. elseif self.SpSelectParent and self.SpSelectParent == rectTrans then
  152. loopTemp:SetSelectActive(false)
  153. end
  154. end
  155. ---注册UI事件和服务器消息
  156. function this:RegistEvents()
  157. GUI:AddOnClickEvent(self.view.BtnFullServiceAward, self, self.BtnFullServiceAwardOnClick)
  158. GUI:AddOnClickEvent(self.view.LeaveForKill, self, self.LeaveForKillOnClick)
  159. GUI:AddOnClickEvent(self.view.ClaimPersonReward, self, self.ClaimPersonRewardOnClick)
  160. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_ALL_SERVER_FIRST_KILL_INFO, self.RES_ALL_SERVER_FIRST_KILL_INFO, self)
  161. SL:RegisterLUAEvent(LUA_EVENT_OPENSERVICE_GOLDBOSSKILL_REDPONT_CHANGE,self.OpenServiceBossKillChangeRedPoint,self)
  162. end
  163. ----响应全服首杀和红包数据
  164. ----@param message GoldFirstKillProtos.ResponseAllServerFirstKillData
  165. function this:RES_ALL_SERVER_FIRST_KILL_INFO(_, message)
  166. self:ShowTime()
  167. self.curMessage = message
  168. self:SetCurMonsterScrollRect(message)
  169. self:SetCurMonsterInfo(message)
  170. end
  171. function this:BtnFullServiceAwardOnClick(control)
  172. local bossId = self.rankingBoss[self.curSelectIndex].id
  173. local serverData = self.curMessage.allServerData[tostring(bossId)]
  174. local envelopeState = self.curMessage.envelope[tostring(bossId)]
  175. if serverData then
  176. envelopeState = envelopeState and 2 or 1
  177. else
  178. envelopeState = 0
  179. end
  180. ---全服红包
  181. if envelopeState == 1 then
  182. if SL:HasConfig("cfg_monster", bossId) then
  183. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_RECEIVE_FIRST_KILL_ENVELOPE,{monsterId = bossId})
  184. end
  185. InfoManager.openServiceAthleticsInfo.isClaimEvent = true
  186. end
  187. end
  188. ---领取个人首杀奖励
  189. function this:ClaimPersonRewardOnClick()
  190. local bossId = self.rankingBoss[self.curSelectIndex].id
  191. local personalReward = self.curMessage.taskInfo[tostring(bossId)]
  192. if personalReward == "2" then
  193. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_RECEIVE_PERSONAL_FIRST_KILL_AWARD,{monsterId = bossId})
  194. InfoManager.openServiceAthleticsInfo.isClaimEvent = true
  195. end
  196. end
  197. function this:LeaveForKillOnClick(control)
  198. GUI:UIPanel_Close("dev/outui/MainActivity/Panel/KLMainActivity/KLMainActivityPanel")
  199. SL.HideMainPanel()
  200. local monsterId = self.rankingBoss[self.curSelectIndex].id
  201. --local monsterType = SL:GetConfigMultiKeys('cfg_BOSS_challenge',monsterId , 'monsterid').monsterType
  202. GUI:UIPanel_Open("dev/outui/ChallengeBoss/Panel/KLChallengeBoss/KLChallengeBossPanel",nil,
  203. nil,{monsterId = monsterId,monsterType = 1 })
  204. end
  205. ---界面显示时调用一次
  206. function this:Show()
  207. end
  208. ---创建或者刷新界面数据时调用
  209. function this:Refresh()
  210. self.FirtBossKillOpen =true
  211. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_ALL_SERVER_FIRST_KILL_INFO)
  212. end
  213. function this:Close()
  214. self:StopCoroutine()
  215. self:StopTick()
  216. self:StopRankTimer()
  217. if self.scheduleId then
  218. SL:UnSchedule(self.scheduleId)
  219. self.scheduleId = nil
  220. end
  221. end
  222. ----@param message GoldFirstKillProtos.ResponseAllServerFirstKillData
  223. function this:SetCurMonsterScrollRect(message)
  224. self.curSelectIndex = self:GetDefaultIdnex(message)
  225. if self.FirtBossKillOpen then
  226. GUI:DataListUpdateData(self.view.DataMonsterList)
  227. GUI:SetScrollView_scrollpos(self.view.MonsterViewList,self.curSelectIndex-1)
  228. self.FirtBossKillOpen = false
  229. end
  230. end
  231. ---获取默认选中的下标
  232. ----@param message GoldFirstKillProtos.ResponseAllServerFirstKillData
  233. function this:GetDefaultIdnex(message)
  234. local curSelectIndex = 1
  235. local selectbossId = self.rankingBoss[1].id
  236. local haveRedMinLevel = 100000
  237. local ishaveRedDot = false
  238. for i, v in pairs(self.rankingBoss) do
  239. local isShowRedDot = self:JudgThisMonsterIsHaveRedDot(message,v.id)
  240. if isShowRedDot then
  241. local monsterLevel = SL:GetConfig("cfg_monster",v.id).level
  242. ishaveRedDot = true
  243. if monsterLevel < haveRedMinLevel then
  244. haveRedMinLevel = monsterLevel
  245. selectbossId = v.id
  246. end
  247. end
  248. end
  249. if ishaveRedDot == false then
  250. local level = 100000
  251. for i, v in pairs(self.rankingBoss) do
  252. local monsterId = tostring(v.id)
  253. if message.allServerData[monsterId] == nil or (not message.envelope[monsterId] or message.envelope[monsterId] == false) or message.taskInfo[monsterId] ~= "3" then
  254. local monsterLevel = SL:GetConfig("cfg_monster",v.id).level
  255. if monsterLevel < level then
  256. level = monsterLevel
  257. selectbossId = v.id
  258. end
  259. end
  260. end
  261. end
  262. for k, bossinfo in ipairs(self.rankingBoss) do
  263. local dtbossId = bossinfo.id
  264. if dtbossId == selectbossId then
  265. curSelectIndex = k
  266. break
  267. end
  268. end
  269. return curSelectIndex
  270. end
  271. ---红点数据回包
  272. ---@param redPointInfo table
  273. function this:OpenServiceBossKillChangeRedPoint(id,data)
  274. local bossFistKillInfo = InfoManager.openServiceAthleticsInfo.bossFistKillInfo
  275. if data then
  276. self.FirtBossKillOpen = true
  277. self:SetCurMonsterScrollRect(bossFistKillInfo)
  278. end
  279. self:SetCurMonsterInfo(bossFistKillInfo)
  280. self:RefreshRedDot()
  281. end
  282. ---设置当前boss信息
  283. ---@param data GoldFirstKillProtos.ResponseAllServerFirstKillData
  284. function this:SetCurMonsterInfo(data)
  285. local monsterConfig = self.rankingBoss[self.curSelectIndex]
  286. ---@type cfg_monster_column
  287. local monster = SL:GetConfig("cfg_monster", monsterConfig.id)
  288. local strId = tostring(monsterConfig.id)
  289. local serverData = data.allServerData[strId]
  290. local envelopeState = data.envelope[strId]
  291. local message = nil
  292. if serverData then
  293. envelopeState = envelopeState and 2 or 1
  294. message = { playerName = serverData.killerName,
  295. killTime = tonumber(serverData.killTime) ,
  296. personalReward = tonumber(data.taskInfo[strId]),
  297. redPacket = envelopeState
  298. }
  299. else
  300. envelopeState = 0
  301. message = {
  302. personalReward = tonumber(data.taskInfo[strId]) ,
  303. redPacket = envelopeState
  304. }
  305. end
  306. self:ShowMonsterModel(monster.appr,monsterConfig)
  307. GUI:Text_setString(self.view.CurBossName, monster.name)
  308. GUI:Text_setString(self.view.CurBossLevel, monster.level .. "级")
  309. self.state = message.playerName and true or false
  310. if self.state == false then
  311. GUI:Text_setString(self.view.TxtName, "暂无")
  312. else
  313. GUI:Text_setString(self.view.TxtName, message.playerName)
  314. end
  315. if message.killTime and message.killTime > 0 then
  316. local time = message.killTime // 1000
  317. local killTime = Time.FormatTimeYMDHMS(time)
  318. GUI:Text_setString(self.view.FirstKillTime, killTime)
  319. else
  320. GUI:Text_setString(self.view.FirstKillTime, "暂无")
  321. end
  322. self.globalServerRewardListData = monsterConfig.serReward
  323. GUI:DataListUpdateData(self.view.DataGlobalServerRewardList)
  324. self.isPersonGet = false
  325. ---1:不可领取 2可领取 3:已领取
  326. if message.personalReward == 1 then
  327. GUI:setVisible(self.view.ClaimPersonReward, false)
  328. GUI:setVisible(self.view.LeaveForKill, true)
  329. GUI:setVisible(self.view.FirstKillFinished, false)
  330. elseif message.personalReward == 2 then
  331. GUI:setVisible(self.view.LeaveForKill, false)
  332. GUI:setVisible(self.view.ClaimPersonReward, true)
  333. GUI:setVisible(self.view.FirstKillFinished, false)
  334. elseif message.personalReward == 3 then
  335. GUI:setVisible(self.view.ClaimPersonReward, false)
  336. GUI:Text_setString(self.view.FirstKillFinished, "已领取")
  337. GUI:setVisible(self.view.LeaveForKill, false)
  338. GUI:setVisible(self.view.FirstKillFinished, true)
  339. self.isPersonGet = true
  340. end
  341. self.personRewardListData = monsterConfig.perReward
  342. GUI:DataListUpdateData(self.view.DataPersonRewardList)
  343. if message.redPacket == 0 then
  344. GUI:setVisible(self.view.BtnFullServiceAward, false)
  345. GUI:setVisible(self.view.FullServiceAwardClaimed, false)
  346. self.isFlash = false
  347. elseif message.redPacket == 1 then
  348. GUI:setVisible(self.view.BtnFullServiceAward, true)
  349. GUI:setVisible(self.view.FullServiceAwardClaimed, false)
  350. --GUI:Text_setString(self.view.BtnFullServiceAwardTips, "可领取")
  351. self:StopCoroutine()
  352. self.isFlash = true
  353. self.coroutine = Coroutine.Start(self.ClaimBtnFlash, self)
  354. elseif message.redPacket == 2 then
  355. GUI:setVisible(self.view.BtnFullServiceAward, false)
  356. GUI:setVisible(self.view.FullServiceAwardClaimed, true)
  357. --GUI:Text_setString(self.view.BtnFullServiceAwardTips, "已领取")
  358. self.isFlash = false
  359. end
  360. GUI:setVisible(self.view.BossReliveTime, false)
  361. end
  362. ---福袋闪烁
  363. function this:ClaimBtnFlash()
  364. local alpha = 1
  365. local spike = -0.05
  366. while (self.isFlash) do
  367. if alpha >= 1 then
  368. spike = -0.05
  369. elseif alpha <= 0 then
  370. spike = 0.05
  371. end
  372. alpha = alpha + spike
  373. GUI:Image_setAlpha(self.view.BtnFullServiceAward, alpha)
  374. Coroutine.WaitForEndOfFrame()
  375. end
  376. end
  377. function this:StopCoroutine()
  378. if self.coroutine then
  379. Coroutine.Stop(self.coroutine)
  380. self.coroutine = nil
  381. end
  382. end
  383. ---开启倒计时
  384. ---@param time number @倒计时时间,毫秒
  385. function this:SetCountDown(time)
  386. self:StopTick()
  387. self.countDown = time
  388. if not self.countDownTimer then
  389. self.countDownTimer = SL:Schedule(self.countDownTimer,0,1,-1,self.Tick)
  390. end
  391. end
  392. ---黄金boss复活倒计时,展示不用展示
  393. function this:Tick()
  394. local time = Time.FormatTimeHMS(self.countDown)
  395. GUI:Text_setString(self.view.BossReliveTime, time)
  396. if self.countDown <= 0 then
  397. self:StopTick()
  398. else
  399. self.countDown = self.countDown - 1000
  400. end
  401. end
  402. function this:StopTick()
  403. if self.countDownTimer then
  404. SL:UnSchedule(self.countDownTimer)
  405. self.countDownTimer = nil
  406. end
  407. end
  408. ---创建怪物模型
  409. function this:ShowMonsterModel(modelId, monsterConfig)
  410. local path = SL:GetConfig("cfg_model_monster",modelId).path
  411. local _mscale = "50,50,50"
  412. if monsterConfig and monsterConfig.size then
  413. local scale = math.ceil(monsterConfig.size/100)
  414. _mscale = scale .. "," .. scale .. "," .. scale
  415. end
  416. local y = -120
  417. if self.MonsterModel then
  418. GUI:Model_setSrc(self.view.MonsterModel,path,_mscale,nil,"0,0,-1000")
  419. else
  420. self.MonsterModel = GUI:Model_Create(self.view.CurBossModelRoot,{
  421. id="MonsterModel",
  422. x="0",
  423. y="-120",
  424. z="-1000",
  425. a="00",
  426. mscale =_mscale,
  427. mrotate="0,200,0",
  428. src=path,
  429. })
  430. end
  431. if monsterConfig.offset and #monsterConfig.offset >= 2 then
  432. GUI:setPosition(self.view.MonsterModel,monsterConfig.offset[1],y+monsterConfig.offset[2])
  433. else
  434. GUI:setPosition(self.view.MonsterModel,0,y)
  435. end
  436. end
  437. ---一天毫秒数
  438. function this:ShowTime()
  439. local ONE_DAY_MILLISECOND = 86400000
  440. local differenceTime = self:GetServerOpendifferenceTime()
  441. local tabRankingConfig = SL:GetConfig("sub_mainActivity", 1)
  442. local serverTime = Time.GetServerTime()
  443. local outTimeTbl = ConditionManager.GetConditionParams(tabRankingConfig.actualCondition)
  444. local endTime = (tonumber(outTimeTbl[2])) * ONE_DAY_MILLISECOND + SL:GetEnterRoleRes().openServerTime
  445. local diff = endTime - serverTime - differenceTime * 1000
  446. if diff <= 0 then
  447. GUI:Text_setString(self.view.TxtTimePrefix, "挑战已结束")
  448. GUI:setPositionX(self.view.TxtTimePrefix,-936)
  449. self:StopRankTimer()
  450. GUI:Text_setString(self.view.TxtTime, "")
  451. self.isGoing = false
  452. else
  453. GUI:Text_setString(self.view.TxtTimePrefix, "挑战结束倒计时")
  454. GUI:setPositionX(self.view.TxtTimePrefix,self.startPosX)
  455. self:StartRankTimer(diff)
  456. self.isGoing = true
  457. end
  458. end
  459. function this:GetServerOpendifferenceTime()
  460. local enterRoleRes = SL:GetEnterRoleRes()
  461. if enterRoleRes == nil then
  462. return -1
  463. end
  464. local openTime = Time.FormatTimeYMDHMS(enterRoleRes.openServerTime / 1000)
  465. local hour = tonumber(string.sub(openTime, 12, 13))
  466. local minute = tonumber(string.sub(openTime, 15, 16))
  467. local second = tonumber(string.sub(openTime, 18, 19))
  468. local differenceTime = 0 --刷新差值
  469. differenceTime = hour * 3600 + minute * 60 + second
  470. return differenceTime
  471. end
  472. ---开启倒计时
  473. ---@param time number @倒计时时间,毫秒
  474. function this:StartRankTimer(time)
  475. local rankcountDown = time / 1000
  476. local txtTime = Time.FormatTimeDHMSFormColon(rankcountDown)
  477. GUI:Text_setString(self.view.TxtTime, txtTime)
  478. self:StopRankTimer()
  479. self.rankTimer = SL:Schedule(self.rankTimer,0,1,-1, function()
  480. local time = Time.FormatTimeDHMSFormColon(rankcountDown)
  481. GUI:Text_setString(self.view.TxtTime, time)
  482. if rankcountDown <= 0 then
  483. self:StopRankTimer()
  484. return
  485. end
  486. rankcountDown = rankcountDown - 1
  487. end)
  488. end
  489. function this:StopRankTimer()
  490. if self.rankTimer then
  491. SL:UnSchedule(self.rankTimer)
  492. self.rankTimer = nil
  493. end
  494. end
  495. ---@param temp KLUIFirstKillMonsterItem
  496. function this:MonsterIconOnClick(temp)
  497. self.curSelectIndex = temp.luaIndex
  498. if self.lastSelectItem then
  499. self.lastSelectItem:SetSelectActive(false)
  500. end
  501. temp:SetSelectActive(true)
  502. self:SetCurMonsterInfo(InfoManager.openServiceAthleticsInfo.bossFistKillInfo)
  503. self.lastSelectItem = temp
  504. end
  505. function this:RefreshRedDot()
  506. if self.lastSelectItem then
  507. local bossFistKillInfo = InfoManager.openServiceAthleticsInfo.bossFistKillInfo
  508. local dat = self.rankingBoss[self.curSelectIndex]
  509. local isShowRedDot = self:JudgThisMonsterIsHaveRedDot(bossFistKillInfo,dat.id)
  510. self.lastSelectItem:RefreshRedDot(isShowRedDot)
  511. end
  512. end
  513. function this:JudgThisMonsterIsHaveRedDot(bossFistKillInfo,_monsterId)
  514. local isShowRedDot = false
  515. local monsterId = tostring(_monsterId)
  516. if (bossFistKillInfo.allServerData[monsterId] and (not bossFistKillInfo.envelope[monsterId] or bossFistKillInfo.envelope[monsterId] == false))
  517. or bossFistKillInfo.taskInfo[monsterId] == "2" then
  518. isShowRedDot = true
  519. end
  520. return isShowRedDot
  521. end
  522. return this