KLWolfSoulFortressSummonItem.lua 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ---@class KLWolfSoulFortressSummonItem:UIKmlLuaPanelBase
  2. ---@field view KLWolfSoulFortressSummonItemView
  3. ---@field data {}
  4. local KLWolfSoulFortressSummonItem = class(UIKmlLuaPanelBase)
  5. local this = KLWolfSoulFortressSummonItem
  6. ---创建时调用一次
  7. function this:Init()
  8. end
  9. function this:InitData()
  10. end
  11. ---注册UI事件和服务器消息
  12. function this:RegistEvents()
  13. GUI:AddOnClickEvent(self.view.btnSummon, self, self.SummonOnclick)
  14. end
  15. ---召唤
  16. function this:SummonOnclick()
  17. if self.data then
  18. ---召唤次数有限制
  19. if InfoManager.wolfSoulFortressInfo.summonCount > InfoManager.wolfSoulFortressInfo.nowWolfSoulCfg.guardians then
  20. SL:TipMessage( SL:GetConfig('cfg_string', 332).text, 1, NoticeType.NoticeMid )--"召唤次数已满!",
  21. return
  22. end
  23. ---只有准别阶段可以召唤
  24. if InfoManager.wolfSoulFortressInfo.state > 1 then
  25. SL:TipMessage( SL:GetConfig('cfg_string', 333).text, 1, NoticeType.NoticeMid )--"准备阶段外不能召唤!",
  26. return
  27. end
  28. ---道具需求
  29. local haveCount = SL:GetBagItemCount(self.data[2])
  30. if haveCount < self.data[3] then
  31. SL:TipMessage( SL:GetConfig('cfg_string', 431).text, 1, NoticeType.NoticeMid )--"战盟资金不足,无法召唤!",
  32. return
  33. end
  34. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_WOLF_SOUL_SUMMON, self.data[1])
  35. end
  36. end
  37. ---界面显示时调用一次
  38. function this:Show()
  39. end
  40. ---创建或者刷新界面数据时调用
  41. function this:Refresh()
  42. end
  43. ---类型#货币#数量
  44. function this:RefreshItem(message)
  45. self.data = message.data
  46. self.index = message.index
  47. if self.data then
  48. ---@type cfg_monster_column
  49. local monsterCfg = SL:GetConfig("cfg_monster", self.data[1])
  50. ---@type cfg_item_column
  51. local itemCfg = SL:GetConfig("cfg_item", self.data[2])
  52. GUI:Text_setString(self.view.name, monsterCfg.name)
  53. GUI:Text_setString(self.view.btnSummon, string.format("%s:<color=#EDD194FF>%s</color>", itemCfg.name, self.data[3]))
  54. self:InitModel(monsterCfg)
  55. end
  56. GUI:SetActive(self.view.specialBg,false)
  57. GUI:SetActive(self.view.specialBg_2,false)
  58. ---策划说写死...
  59. if self.index == 1 then
  60. elseif self.index == 2 then
  61. GUI:SetActive(self.view.specialBg,true)
  62. GUI:Text_setString(self.view.textSpecial,"最多同时攻击3个单位")
  63. else
  64. GUI:SetActive(self.view.specialBg,true)
  65. GUI:SetActive(self.view.specialBg_2,true)
  66. GUI:Text_setString(self.view.textSpecial,"最多同时攻击5个单位")
  67. GUI:Text_setString(self.view.textSpecial_2,"额外造成5%生命上上限伤害")
  68. end
  69. GUI:Image_loadTexture(self.view.rank,"quality_"..self.index, "Atlas/UIWolfSoulFortress.spriteatlas")
  70. end
  71. function this:InitModel(monsterCfg)
  72. local appr = monsterCfg.appr
  73. local path = SL:GetConfigMultiKeys('cfg_model_monster', appr, 'id').path
  74. GUI:Model_setSrc(self.view.model, path)
  75. end
  76. function this:Close()
  77. end
  78. return this