DemonRewardItem_Generate.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. ---@class DemonRewardItem__Generate_iconSmallItem
  2. ---@field public gameObject UnityEngine.GameObject
  3. ---@field public rectTransform UnityEngine.RectTransform
  4. ---@field public layoutElement UnityEngine.UI.LayoutElement
  5. ---@class DemonRewardItem__Generate_scrollView
  6. ---@field public gameObject UnityEngine.GameObject
  7. ---@field public scrollRect UnityEngine.UI.ScrollRect
  8. ---@field public loopGridView SuperScrollView.LoopGridView
  9. ---@class DemonRewardItem__Generate_boxIcon
  10. ---@field public gameObject UnityEngine.GameObject
  11. ---@field public image UnityEngine.UI.Image
  12. ---@field public button UnityEngine.UI.Button
  13. ---@class DemonRewardItem__Generate_nameTxt
  14. ---@field public gameObject UnityEngine.GameObject
  15. ---@field public text UnityEngine.UI.Text
  16. ---@class DemonRewardItem__Generate
  17. ---@field private gameObject UnityEngine.GameObject
  18. ---@field private transform UnityEngine.Transform
  19. ---@field private button UnityEngine.UI.Button
  20. ---@field private nameTxt DemonRewardItem__Generate_nameTxt
  21. ---@field private boxIcon DemonRewardItem__Generate_boxIcon
  22. ---@field private scrollView DemonRewardItem__Generate_scrollView
  23. ---@field private iconSmallItem DemonRewardItem__Generate_iconSmallItem
  24. local DemonRewardItemView = class("DemonRewardItemView")
  25. function DemonRewardItemView:ctor()
  26. end
  27. ---@private
  28. function DemonRewardItemView:SetActive(result)
  29. self.gameObject:SetActive(result)
  30. end
  31. ---@private
  32. function DemonRewardItemView:InitGenerate(Root, data)
  33. self.transform = Root
  34. self.inited = true
  35. local tmp
  36. self:InitGenerate__1(Root,data)
  37. self:InitGenerate__2(Root,data)
  38. self:InitGenerate__3(Root,data)
  39. self:InitGenerate__4(Root,data)
  40. self:InitGenerate__5(Root,data)
  41. end
  42. ---@private
  43. function DemonRewardItemView:InitGenerate__1(Root, data)
  44. --[[
  45. Root
  46. --]]
  47. self.button = Root:GetComponent(Enum.TypeInfo.Button)
  48. end
  49. ---@private
  50. function DemonRewardItemView:InitGenerate__2(Root, data)
  51. --[[
  52. NameTxt
  53. --]]
  54. local tmp = Root:Find("NameTxt").gameObject
  55. if tolua.getpeer(tmp) == nil then
  56. tolua.setpeer(tmp, {})
  57. end
  58. self.nameTxt = tmp
  59. tmp.text = tmp:GetComponent(Enum.TypeInfo.Text)
  60. end
  61. ---@private
  62. function DemonRewardItemView:InitGenerate__3(Root, data)
  63. --[[
  64. BoxIcon
  65. --]]
  66. local tmp = Root:Find("BoxIcon").gameObject
  67. if tolua.getpeer(tmp) == nil then
  68. tolua.setpeer(tmp, {})
  69. end
  70. self.boxIcon = tmp
  71. tmp.image = tmp:GetComponent(Enum.TypeInfo.Image)
  72. tmp.button = tmp:GetComponent(Enum.TypeInfo.Button)
  73. end
  74. ---@private
  75. function DemonRewardItemView:InitGenerate__4(Root, data)
  76. --[[
  77. Scroll View
  78. --]]
  79. local tmp = Root:Find("Scroll View").gameObject
  80. if tolua.getpeer(tmp) == nil then
  81. tolua.setpeer(tmp, {})
  82. end
  83. self.scrollView = tmp
  84. tmp.scrollRect = tmp:GetComponent(Enum.TypeInfo.ScrollRect)
  85. tmp.loopGridView = tmp:GetComponent(Enum.TypeInfo.LoopGridView)
  86. end
  87. ---@private
  88. function DemonRewardItemView:InitGenerate__5(Root, data)
  89. --[[
  90. Scroll View/Viewport/Content/IconSmallItem
  91. --]]
  92. local tmp = Root:Find("Scroll View/Viewport/Content/IconSmallItem").gameObject
  93. if tolua.getpeer(tmp) == nil then
  94. tolua.setpeer(tmp, {})
  95. end
  96. self.iconSmallItem = CommonUtil.BindGridViewItem2LuaStatic("IconItem", tmp)
  97. self.iconSmallItem.prefabName = "IconItem"
  98. tmp.rectTransform = tmp:GetComponent(Enum.TypeInfo.RectTransform)
  99. tmp.layoutElement = tmp:GetComponent(Enum.TypeInfo.LayoutElement)
  100. end
  101. ---@private
  102. function DemonRewardItemView:GenerateDestroy()
  103. if tolua.getpeer(self.nameTxt) ~= nil then
  104. tolua.setpeer(self.nameTxt, nil)
  105. end
  106. self.nameTxt = nil
  107. if tolua.getpeer(self.boxIcon) ~= nil then
  108. tolua.setpeer(self.boxIcon, nil)
  109. end
  110. self.boxIcon = nil
  111. if tolua.getpeer(self.scrollView) ~= nil then
  112. tolua.setpeer(self.scrollView, nil)
  113. end
  114. self.scrollView = nil
  115. if self.iconSmallItem.GenerateDestroy ~= nil then
  116. self.iconSmallItem:GenerateDestroy()
  117. end
  118. if tolua.getpeer(self.iconSmallItem) ~= nil then
  119. tolua.setpeer(self.iconSmallItem, nil)
  120. end
  121. self.iconSmallItem = nil
  122. self.transform = nil
  123. self.gameObject = nil
  124. self.inited = false
  125. end
  126. return DemonRewardItemView