SkillItem_Generate.lua 3.6 KB

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