KLQuintonInvasionTaskProgressPanel.lua 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. ---@class KLQuintonInvasionTaskProgressPanel:UIKmlLuaPanelBase
  2. ---@field view KLQuintonInvasionTaskProgressPanelView
  3. local KLQuintonInvasionTaskProgressPanel = class(UIKmlLuaPanelBase)
  4. local this = KLQuintonInvasionTaskProgressPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. SL:KeepOpenPanel("KLQuintonInvasionTaskProgressPanelKml", true)
  10. self.reward_all_item = {}
  11. self.rewardData = {}
  12. GUI:DataListInitData(
  13. self.view.rewardList,
  14. function()
  15. return self:RewardDataListItemCountFunc()
  16. end,
  17. function(realIndex)
  18. return self:RewardDataListItemGetFunc(realIndex)
  19. end,
  20. function(realIndex, kmlcontrol)
  21. return self:RewardDataListItemInitFunc(realIndex, kmlcontrol)
  22. end,
  23. function(realIndex, kmlcontrol)
  24. return self:RewardDataListItemUpdateFunc(realIndex, kmlcontrol)
  25. end
  26. )
  27. self.countdown = nil
  28. self.timer =
  29. SL:Schedule(
  30. self.timer,
  31. 0,
  32. 1,
  33. -1,
  34. function()
  35. if not self.countdown then
  36. return
  37. end
  38. local str = self:timeStr(self.countdown)
  39. GUI:Text_setString(self.view.countDownTime, str)
  40. -- if t <= 0 then
  41. -- SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_CHANGE_DUPLICATE_STATE, EDuplicateType.StartCopy)
  42. -- end
  43. end
  44. )
  45. SL:SetCampNameList({"巨龙阵营","猎鹰阵营","苍狼阵营"})
  46. SL:SetIsShowRoleTitle(true)
  47. --SL:LogError("SET_PKMODE--01--")
  48. SL:SetMetaValue(EMetaVarSetKey.SET_PKMODE, EPKMode.Camp)
  49. end
  50. ---注册UI事件和服务器消息
  51. function this:RegistEvents()
  52. GUI:AddOnClickEvent(self.view.desBtn, self, self.OnCliCkDesBtn)
  53. GUI:AddOnClickEvent(self.view.exitBtn, self, self.OnCliCkExitBtn)
  54. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_QUIT_DUPLICATE, self.RES_QUIT_SUCCESS, self)
  55. end
  56. function this:SetData(message)
  57. if not message.taskStage then
  58. return
  59. end
  60. SL:SetMetaValue(EMetaVarSetKey.SET_PKMODE, EPKMode.Camp)
  61. self.data = message
  62. self.taskStage = self.data.taskStage
  63. self.countdown = self.data.nextStateStartTime
  64. local tbl = SL:GetConfig("cfg_rep", 21001, "id")
  65. ---@type cfg_repTask_column
  66. local tbl1 = SL:GetConfig("cfg_repTask", tonumber(tbl.repTarget), "id")
  67. GUI:Text_setString(self.view.taskCount, self.taskStage.."/" .. tbl1.param[2])
  68. end
  69. function this:OnCliCkDesBtn()
  70. local data = {
  71. content = "1、昆顿入侵可通过跨服入口-神之国度-昆顿入侵入口进入地图。\n2.活动开启后玩家进入活动后会被分为猎鹰阵营、巨龙阵营、苍狼阵营3个阵营。\n3、活动开启后每对昆顿造成一定伤害获得1点积分,获得1点积分所需的伤害会随着开服天数提升而提升。\n4、击杀其他玩家可以获得被击杀者20%的积分。\n5.活动结束后阵营积分第一的阵营可获得拍卖分红。\n6、活动结束后根据积分排名发放奖励。\n7、玩家每日只能获得一次积分奖励,获得每日活动排名奖励后再次参加活动将不能获得积分O\n8、排名奖励需积分大于30分才能领取。\n9、昆顿被击杀后还有概率在跨服拍卖行上架稀有坐骑,阵营积分第一阵营中的玩家个人积分超过30可获得拍卖分红。",
  72. title = "昆顿入侵规则说明"
  73. }
  74. GUI:UIPanel_Open("dev/outui/Activity/Panel/KLDescribeDetail/KLDescribeDetailPanel", nil, nil, data)
  75. end
  76. function this:OnCliCkExitBtn()
  77. SL:CommonTipsMessage({ stringTblID=211, ui = self, sureBtnText = "确定", cancelBtnText = "取消",
  78. callback = self.ExitSure})
  79. end
  80. function this:ExitSure()
  81. InfoManager.copActivityInfo.hideTask = false
  82. InfoManager.copActivityInfo.hideTeam = false
  83. SL:onLUAEvent(LUA_EVENT_SHOW_TASK)
  84. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_QUIT_DUPLICATE)
  85. end
  86. function this:RES_QUIT_SUCCESS(id, message)
  87. InfoManager.copActivityInfo.hideTask = false
  88. InfoManager.copActivityInfo.hideTeam = false
  89. ---@type cfg_rep_column
  90. local tbl = SL:GetConfig("cfg_rep", message, "id")
  91. if tbl.type == EActivityType.QuintonInvasion then
  92. GUI:UIPanel_Close("dev/outui/Activity/Panel/KLQuintonInvasionTaskProgress/KLQuintonInvasionTaskProgressPanel")
  93. end
  94. end
  95. ---界面显示时调用一次
  96. function this:Show()
  97. end
  98. ---创建或者刷新界面数据时调用
  99. function this:Refresh()
  100. ---@type cfg_rep_column
  101. local tbl = SL:GetConfig("cfg_rep", 21001, "id")
  102. ---@type cfg_repTask_column
  103. local tbl1 = SL:GetConfig("cfg_repTask", tonumber(tbl.repTarget), "id")
  104. GUI:Text_setString(self.view.taskName, tbl1.name)
  105. --GUI:Text_setString(self.view.taskCount, "0/" .. tbl1.param[2])
  106. --self.countdown = Time.GetServerTime() + tbl.continuous
  107. self:RefreshReward()
  108. SL:SetMetaValue(EMetaVarSetKey.SET_PKMODE, EPKMode.Camp)
  109. end
  110. function this:timeStr(time)
  111. local t = time - Time.GetServerTime()
  112. t = math.modf(t/1000)
  113. local time_tab = SL:SecondToHMS(t)
  114. local str = ""
  115. local is_add = false
  116. if time_tab.d and time_tab.d > 0 then
  117. str = str .. time_tab.d
  118. is_add = true
  119. end
  120. if time_tab.h and time_tab.h > 0 or is_add then
  121. if not is_add then
  122. str = str .. time_tab.h
  123. else
  124. str = str ..":" .. time_tab.h
  125. end
  126. is_add = true
  127. end
  128. if time_tab.h and time_tab.h > 0 or is_add then
  129. if not is_add then
  130. str = str .. time_tab.h
  131. else
  132. str = str ..":" .. time_tab.h
  133. end
  134. is_add = true
  135. end
  136. if time_tab.m and time_tab.m > 0 or is_add then
  137. if not is_add then
  138. str = str .. time_tab.m
  139. else
  140. str = str ..":" .. time_tab.m
  141. end
  142. is_add = true
  143. end
  144. if time_tab.s then
  145. if not is_add then
  146. str = str .. time_tab.s
  147. else
  148. str = str ..":" .. time_tab.s
  149. end
  150. is_add = true
  151. end
  152. return str
  153. end
  154. function this:s()
  155. GUI:Text_setString(self.view.taskName, "")
  156. GUI:Text_setString(self.view.taskCount, "0/1")
  157. end
  158. function this:RefreshReward()
  159. ---@type cfg_rep_column
  160. local tbl = SL:GetConfig("cfg_rep", 21001, "id")
  161. self.rewardData = tbl.UIreward
  162. GUI:DataListUpdateData(self.view.rewardList)
  163. end
  164. function this:RewardDataListItemCountFunc()
  165. return #self.rewardData
  166. end
  167. function this:RewardDataListItemGetFunc(realIndex)
  168. local data = self.rewardData[realIndex + 1]
  169. local message = {cfgId = data[1], count = "", width = 70, height = 70}
  170. local item =
  171. GUI:UIPanel_Open("dev/outui/Activity/Item/KLItem/KLItemItem", self.view.rewardList, self, message, true)
  172. self.reward_all_item[item.view.root] = item
  173. return item.view.root
  174. end
  175. function this:RewardDataListItemInitFunc(realIndex, kmlcontrol)
  176. end
  177. function this:RewardDataListItemUpdateFunc(realIndex, kmlcontrol)
  178. local data = self.rewardData[realIndex + 1]
  179. self.reward_all_item[kmlcontrol]:RefreshItem(data[1], "")
  180. end
  181. function this:SetVisible(isVisible)
  182. GUI:setVisible(self.view.fightRoot, isVisible)
  183. end
  184. function this:Close()
  185. if self.timer then
  186. SL:UnSchedule(self.timer)
  187. end
  188. self.timer = nil
  189. InfoManager.copActivityInfo.hideTask = false
  190. end
  191. return this