UIDojoBattleView.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. local UIDojoBattleView = require("UIDojo/UIDojoBattleView_Generate")
  2. local HeadItemCtr = require("Common/HeadItemCtr")
  3. local BattleHeadsBoxPart = require("UIBattle/BattleHeadsBoxPart")
  4. local BattleEnemyPart = require("UIBattle/BattleEnemyPart")
  5. local BattleStatisticsPart = require("UIBattle/BattleStatisticsPart")
  6. function UIDojoBattleView:OnAwake(data)
  7. self.controller = require("UIDojo/UIDojoBattleCtr"):new()
  8. self.controller:Init(self)
  9. self.controller:SetData(data)
  10. end
  11. function UIDojoBattleView:AddEventListener()
  12. end
  13. function UIDojoBattleView:FillContent(data, uiBase)
  14. self.uiBase = uiBase
  15. local gameObject = self.uiBase:GetRoot()
  16. if gameObject ~= nil then
  17. self.gameObject = gameObject
  18. self.transform = gameObject.transform
  19. end
  20. self:InitGenerate(self.transform, data)
  21. self:Init()
  22. end
  23. function UIDojoBattleView:Init()
  24. if self.HeadsBoxPart == nil then
  25. self.HeadsBoxPart = BattleHeadsBoxPart:new()
  26. end
  27. if self.EnemyPart == nil then
  28. self.EnemyPart = BattleEnemyPart:new()
  29. end
  30. if self.StatisticsPart == nil then
  31. self.StatisticsPart = BattleStatisticsPart:new()
  32. end
  33. self.HeadsBoxPart:InitGo(self,self.uiBase:FindChildGo("UIBattle/BattleHeadsBox"))
  34. self.EnemyPart:InitGo(self,self.uiBase:FindChildGo("UIBattle/BattleEnemy"))
  35. self.StatisticsPart:InitGo(self,self.uiBase:FindChildGo("UIBattle/BattleStatistics"))
  36. self.HeadsBoxPart:Show(self.controller:GetOurMembers())
  37. self.EnemyPart:Show(self.controller:GetMatchFighterName(),self.controller:GetEnemyMembers(), self.controller:GetIsLeftTime(), self.controller:GetTotalTime())
  38. self.StatisticsPart:Show(self.controller:GetBattleMode(),self.controller:GetBattleSubMode())
  39. self.StatisticsPart:SetCanvasOrder(self.uiBase.SortingOrder-1)
  40. end
  41. function UIDojoBattleView:RemoveEventListener()
  42. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  43. end
  44. function UIDojoBattleView:AddUIEventListener()
  45. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.EID_SHOW_PVP_PRESSPOINT,self,self.OnShowPvePressPoint);
  46. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
  47. self.HeadsBoxPart:AddUIEventListener()
  48. self.EnemyPart:AddUIEventListener()
  49. self.StatisticsPart:AddUIEventListener()
  50. end
  51. function UIDojoBattleView:OnShowPvePressPoint(vis)
  52. self.rageBoxGo:SetActive(vis)
  53. end
  54. function UIDojoBattleView:OnHide()
  55. end
  56. function UIDojoBattleView:OnShow(data)
  57. self.controller:SetData(data)
  58. self:Init()
  59. end
  60. function UIDojoBattleView:OnClose()
  61. if self.HeadsBoxPart ~= nil then
  62. self.HeadsBoxPart:Dispose()
  63. self.HeadsBoxPart = nil
  64. end
  65. if self.EnemyPart ~= nil then
  66. self.EnemyPart:Dispose()
  67. self.EnemyPart = nil
  68. end
  69. if self.StatisticsPart ~= nil then
  70. self.StatisticsPart:Hide()
  71. self.StatisticsPart:Dispose()
  72. self.StatisticsPart = nil
  73. end
  74. end
  75. function UIDojoBattleView:OnDispose()
  76. end
  77. return UIDojoBattleView