RewardBox_Generate.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. ---@class RewardBox__Generate_num
  2. ---@field public gameObject UnityEngine.GameObject
  3. ---@field public text TMPro.TextMeshProUGUI
  4. ---@class RewardBox__Generate_box
  5. ---@field public gameObject UnityEngine.GameObject
  6. ---@field public button UnityEngine.UI.Button
  7. ---@field public animator UnityEngine.Animator
  8. ---@class RewardBox__Generate
  9. ---@field private gameObject UnityEngine.GameObject
  10. ---@field private transform UnityEngine.Transform
  11. ---@field private rectTransform UnityEngine.RectTransform
  12. ---@field private box RewardBox__Generate_box
  13. ---@field private money UnityEngine.GameObject
  14. ---@field private fXParent UnityEngine.GameObject
  15. ---@field private tipPoint UnityEngine.GameObject
  16. ---@field private num RewardBox__Generate_num
  17. local RewardBoxView = class("RewardBoxView")
  18. function RewardBoxView:ctor()
  19. end
  20. ---@private
  21. function RewardBoxView:SetActive(result)
  22. self.gameObject:SetActive(result)
  23. end
  24. ---@private
  25. function RewardBoxView:InitGenerate(Root, data)
  26. self.transform = Root
  27. self.inited = true
  28. local tmp
  29. self:InitGenerate__1(Root,data)
  30. self:InitGenerate__2(Root,data)
  31. self:InitGenerate__3(Root,data)
  32. self:InitGenerate__4(Root,data)
  33. self:InitGenerate__5(Root,data)
  34. self:InitGenerate__6(Root,data)
  35. end
  36. ---@private
  37. function RewardBoxView:InitGenerate__1(Root, data)
  38. --[[
  39. Root
  40. --]]
  41. self.rectTransform = Root:GetComponent(Enum.TypeInfo.RectTransform)
  42. end
  43. ---@private
  44. function RewardBoxView:InitGenerate__2(Root, data)
  45. --[[
  46. Box
  47. --]]
  48. local tmp = Root:Find("Box").gameObject
  49. if tolua.getpeer(tmp) == nil then
  50. tolua.setpeer(tmp, {})
  51. end
  52. self.box = tmp
  53. tmp.button = tmp:GetComponent(Enum.TypeInfo.Button)
  54. tmp.animator = tmp:GetComponent(Enum.TypeInfo.Animator)
  55. tmp.animator.logWarnings = false
  56. end
  57. ---@private
  58. function RewardBoxView:InitGenerate__3(Root, data)
  59. --[[
  60. Money
  61. --]]
  62. local tmp = Root:Find("Money").gameObject
  63. if tolua.getpeer(tmp) == nil then
  64. tolua.setpeer(tmp, {})
  65. end
  66. self.money = tmp
  67. end
  68. ---@private
  69. function RewardBoxView:InitGenerate__4(Root, data)
  70. --[[
  71. FXParent
  72. --]]
  73. local tmp = Root:Find("FXParent").gameObject
  74. if tolua.getpeer(tmp) == nil then
  75. tolua.setpeer(tmp, {})
  76. end
  77. self.fXParent = tmp
  78. end
  79. ---@private
  80. function RewardBoxView:InitGenerate__5(Root, data)
  81. --[[
  82. TipPoint
  83. --]]
  84. local tmp = Root:Find("TipPoint").gameObject
  85. if tolua.getpeer(tmp) == nil then
  86. tolua.setpeer(tmp, {})
  87. end
  88. self.tipPoint = tmp
  89. end
  90. ---@private
  91. function RewardBoxView:InitGenerate__6(Root, data)
  92. --[[
  93. Num
  94. --]]
  95. local tmp = Root:Find("Num").gameObject
  96. if tolua.getpeer(tmp) == nil then
  97. tolua.setpeer(tmp, {})
  98. end
  99. self.num = tmp
  100. tmp.text = tmp:GetComponent(Enum.TypeInfo.TextMeshProUGUI)
  101. end
  102. ---@private
  103. function RewardBoxView:GenerateDestroy()
  104. if tolua.getpeer(self.num) ~= nil then
  105. tolua.setpeer(self.num, nil)
  106. end
  107. if tolua.getpeer(self.tipPoint) ~= nil then
  108. tolua.setpeer(self.tipPoint, nil)
  109. end
  110. if tolua.getpeer(self.fXParent) ~= nil then
  111. tolua.setpeer(self.fXParent, nil)
  112. end
  113. if tolua.getpeer(self.money) ~= nil then
  114. tolua.setpeer(self.money, nil)
  115. end
  116. if tolua.getpeer(self.box) ~= nil then
  117. tolua.setpeer(self.box, nil)
  118. end
  119. self.transform = nil
  120. self.gameObject = nil
  121. self.inited = false
  122. end
  123. return RewardBoxView