KLPrivilegeBossPosPanel.lua 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. ---@class KLPrivilegeBossPosPanel:UIKmlLuaPanelBase
  2. ---@field view KLPrivilegeBossPosPanelView
  3. local KLPrivilegeBossPosPanel = class(UIKmlLuaPanelBase)
  4. local this = KLPrivilegeBossPosPanel
  5. ---创建时调用一次
  6. function this:Init()
  7. GUI:DataListInitData(self.view.boss_pos_dl,function()
  8. return self:GoldBossPosDataListItemCountFunc()
  9. end,function(realIndex)
  10. return self:GoldBossPosDataListItemGetFunc(realIndex)
  11. end,function(realIndex, kmlcontrol)
  12. return self:GoldBossPosDataListItemInitFunc(realIndex, kmlcontrol)
  13. end, function(realIndex, kmlcontrol)
  14. return self:GoldBossPosDataListItemUpdateFunc(realIndex, kmlcontrol)
  15. end)
  16. self.boss_Pos_all_item = {}
  17. end
  18. function this:InitData(data)
  19. local one_data = SL:GetConfig("cfg_rep",data.configId)
  20. self.mapId = data.configId
  21. self.is_close = false
  22. -- self.monsterInfo = data.monsterInfo
  23. self.show_pos = true
  24. self.monster1 = {}
  25. local monster_tab = SL:GetConfig('cfg_monster', one_data.monsterUI)
  26. --SL:LogTable(monster_tab,true)
  27. local tab = {monsterId = one_data.monsterUI,isDie = data.isDie,monsterName = monster_tab.name}
  28. --SL:LogTable(tab,true)
  29. table.insert(self.monster1,tab)
  30. GUI:DataListUpdateData(self.view.boss_pos_dl)
  31. self:DieEnd(data.isDie,one_data.save)
  32. end
  33. ---创建或者刷新界面数据时调用
  34. function this:Refresh()
  35. end
  36. function this:SetVisible(isVisible)
  37. GUI:setVisible(self.view.root,isVisible)
  38. end
  39. ---注册UI事件和服务器消息
  40. function this:RegistEvents()
  41. -- GUI:SetToggleOnValueChange(self.view.boss_1_toggle, self, self.Boss1Click)
  42. -- GUI:SetToggleOnValueChange(self.view.boss_2_toggle, self, self.Boss2Click)
  43. -- GUI:SetToggleOnValueChange(self.view.boss_3_toggle, self, self.Boss3Click)
  44. GUI:AddOnClickEvent(self.view.exitBtn,self,self.Exit)
  45. SL:RegisterLUAEvent(LUA_EVENT_MONSTER_DIE, self.MonsterDie, self) --怪物死亡
  46. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_QUIT_DUPLICATE,self.RES_QUIT_SUCCESS,self)
  47. end
  48. function this:Exit()
  49. SL:CommonTipsMessage({ stringTblID=211, ui = self, sureBtnText = "确定", cancelBtnText = "取消",
  50. callback = self.ExitSure})
  51. end
  52. function this:ExitSure()
  53. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_QUIT_DUPLICATE)
  54. end
  55. function this:CloseOnclick()
  56. GUI:UIPanel_Close("dev/outui/ChallengeBoss/Panel/KLPrivilegeBossPos/KLPrivilegeBossPosPanel")
  57. SL.ShowMainPanel()
  58. end
  59. function this:MonsterDie(_id,message)
  60. -- SL:LogError("MonsterDie---------")
  61. -- SL:LogTable(message,true)
  62. if self.hateId and self.hateId~=0 and message == self.hateId then
  63. self:ShowPosView()
  64. end
  65. end
  66. function this:DieEnd(isDie,time)
  67. if isDie and isDie == 1 then
  68. local EndPanel = GUI:UIPanel_Open("dev/outui/ChallengeBoss/Panel/KLPrivilegeBossEnd/KLPrivilegeBossEndPanel")
  69. EndPanel:InitData(time)
  70. else
  71. GUI:UIPanel_Close("dev/outui/ChallengeBoss/Panel/KLPrivilegeBossEnd/KLPrivilegeBossEndPanel")
  72. end
  73. end
  74. function this:GoldBossPosDataListItemCountFunc()
  75. return #self.monster1
  76. end
  77. function this:GoldBossPosDataListItemGetFunc(realIndex)
  78. local data = self.monster1[realIndex + 1]
  79. local item = GUI:UIPanel_Open("dev/outui/ChallengeBoss/Item/KLUIPrivilegeBossPosItem/KLUIPrivilegeBossPosItem",self.view.boss_pos_dl,self,{},true)
  80. self.boss_Pos_all_item[item.view.root] = item
  81. return item.view.root
  82. end
  83. function this:GoldBossPosDataListItemInitFunc(realIndex, kmlcontrol)
  84. end
  85. function this:GoldBossPosDataListItemUpdateFunc(realIndex, kmlcontrol)
  86. local data = self.monster1[realIndex + 1]
  87. self.boss_Pos_all_item[kmlcontrol]:RefreshItem(data,self.mapId,self)
  88. end
  89. function this:Close()
  90. self.is_close = true
  91. end
  92. function this:RES_QUIT_SUCCESS(id,message)
  93. ---@type cfg_rep_column
  94. local tbl = SL:GetConfig("cfg_rep",message,"id")
  95. if tbl.type == EActivityType.PrivilegeBoss then
  96. self.is_close = true
  97. InfoManager.copActivityInfo.hideTask = false
  98. self:CloseOnclick()
  99. end
  100. end
  101. return this