PageModule.lua.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. local PageModule = {}
  2. local EffectType = {
  3. ["LeftTop"] = "LeftTop",
  4. ["LeftBottom"] = "LeftBottom",
  5. ["RightTop"] = "RightTop",
  6. ["RightBottom"] = "RightBottom",
  7. }
  8. local currentEffectType
  9. local funPlayPageModuleEffect
  10. local function StopAllCoroutine()
  11. if funPlayPageModuleEffect then require("Base/CoroutineHelper.lua"):Stop(funPlayPageModuleEffect) end
  12. end
  13. local function CreateBottomImgUI()
  14. local rootPanel = PageModule.rootPanel
  15. local bottomImgObj = rootPanel.transform:Find("Img_Bottom")
  16. if bottomImgObj then return end
  17. bottomImgObj = CS.UnityEngine.GameObject("Img_Bottom")
  18. bottomImgObj:AddComponent(typeof(CS.UnityEngine.UI.Image))
  19. bottomImgObj.transform:SetParent(rootPanel.transform)
  20. local rootPanelRectCom = rootPanel:GetComponent("RectTransform")
  21. local bottomImgObjRectCom = bottomImgObj:GetComponent("RectTransform")
  22. bottomImgObjRectCom.anchoredPosition = CS.UnityEngine.Vector2.zero
  23. bottomImgObjRectCom.sizeDelta = CS.UnityEngine.Vector2(rootPanelRectCom.sizeDelta.x, rootPanelRectCom.sizeDelta.y)
  24. end
  25. local function CreateMaskShowImgUI()
  26. local rootPanel = PageModule.rootPanel
  27. local maskObj = rootPanel.transform:Find("Mask").gameObject
  28. local maskShowImgObj = rootPanel.transform:Find("Mask/Img_MaskShow")
  29. if maskShowImgObj then return end
  30. maskShowImgObj = CS.UnityEngine.GameObject("Img_MaskShow")
  31. maskShowImgObj:AddComponent(typeof(CS.UnityEngine.UI.Image))
  32. maskShowImgObj.transform:SetParent(maskObj.transform)
  33. local rootPanelRectCom = rootPanel:GetComponent("RectTransform")
  34. local maskObjRectCom = maskShowImgObj:GetComponent("RectTransform")
  35. maskObjRectCom.anchoredPosition = CS.UnityEngine.Vector2.zero
  36. maskObjRectCom.sizeDelta = CS.UnityEngine.Vector2(rootPanelRectCom.sizeDelta.x, rootPanelRectCom.sizeDelta.y)
  37. end
  38. local function CreateMaskUI()
  39. local rootPanel = PageModule.rootPanel
  40. local maskObj = rootPanel.transform:Find("Mask")
  41. if maskObj then return end
  42. maskObj = CS.UnityEngine.GameObject("Mask")
  43. maskObj:AddComponent(typeof(CS.UnityEngine.UI.Image))
  44. maskObj:AddComponent(typeof(CS.UnityEngine.UI.Mask))
  45. maskObj.transform:SetParent(rootPanel.transform)
  46. maskObj.transform:GetComponent("Mask").showMaskGraphic = false
  47. local rootPanelRectCom = rootPanel:GetComponent("RectTransform")
  48. local maskObjRectCom = maskObj:GetComponent("RectTransform")
  49. maskObjRectCom.anchoredPosition = CS.UnityEngine.Vector2.zero
  50. maskObjRectCom.sizeDelta = CS.UnityEngine.Vector2(rootPanelRectCom.sizeDelta.x * 2, rootPanelRectCom.sizeDelta.y)
  51. end
  52. local function CreateNextImgUI()
  53. local rootPanel = PageModule.rootPanel
  54. local nextObj = rootPanel.transform:Find("Next").gameObject
  55. local nextImgObj = nextObj.transform:Find("Img_Next")
  56. if nextImgObj then return end
  57. nextImgObj = CS.UnityEngine.GameObject("Img_Next")
  58. nextImgObj.transform:SetParent(nextObj.transform)
  59. nextImgObj:AddComponent(typeof(CS.UnityEngine.UI.Image))
  60. nextImgObj:AddComponent(typeof(CS.UnityEngine.UI.Mask))
  61. local rootPanelRectCom = rootPanel:GetComponent("RectTransform")
  62. local nextImgObjRectCom = nextImgObj:GetComponent("RectTransform")
  63. nextImgObjRectCom.anchoredPosition = CS.UnityEngine.Vector2.zero
  64. nextImgObjRectCom.sizeDelta = CS.UnityEngine.Vector2(rootPanelRectCom.sizeDelta.x, rootPanelRectCom.sizeDelta.y)
  65. end
  66. local function CreateShadowImgUI(szShadowImgPath, nShadowWidth)
  67. if not szShadowImgPath then
  68. return
  69. end
  70. local rootPanel = PageModule.rootPanel
  71. local nextImgObj = rootPanel.transform:Find("Next/Img_Next").gameObject
  72. local shadowImgObj = rootPanel.transform:Find("Next/Img_Next/Img_Shadow")
  73. if not shadowImgObj then
  74. shadowImgObj = CS.UnityEngine.GameObject("Img_Shadow")
  75. shadowImgObj:AddComponent(typeof(CS.UnityEngine.UI.Image))
  76. shadowImgObj.transform:SetParent(nextImgObj.transform)
  77. end
  78. local rootPanelRectCom = rootPanel:GetComponent("RectTransform")
  79. local shadowImgObjRectCom = shadowImgObj:GetComponent("RectTransform")
  80. if not nShadowWidth then
  81. nShadowWidth = 0
  82. end
  83. shadowImgObjRectCom.anchoredPosition = CS.UnityEngine.Vector2.zero
  84. shadowImgObjRectCom.sizeDelta = CS.UnityEngine.Vector2(nShadowWidth, rootPanelRectCom.sizeDelta.y * 2)
  85. local uiHelper = require('Base/UIHelper.lua')
  86. uiHelper:LoadSprite(shadowImgObj, szShadowImgPath, szShadowImgPath)
  87. end
  88. local function CreateNextUI()
  89. local rootPanel = PageModule.rootPanel
  90. local nextObj = rootPanel.transform:Find("Next")
  91. if nextObj then
  92. return
  93. end
  94. nextObj = CS.UnityEngine.GameObject("Next")
  95. nextObj:AddComponent(typeof(CS.UnityEngine.UI.Image))
  96. nextObj:AddComponent(typeof(CS.UnityEngine.UI.Mask))
  97. nextObj.transform:SetParent(rootPanel.transform)
  98. nextObj.transform:GetComponent("Mask").showMaskGraphic = false
  99. local rootPanelRectCom = rootPanel:GetComponent("RectTransform")
  100. local nextObjCom = nextObj:GetComponent("RectTransform")
  101. nextObjCom.anchoredPosition = CS.UnityEngine.Vector2.zero
  102. nextObjCom.sizeDelta = CS.UnityEngine.Vector2(rootPanelRectCom.sizeDelta.x, rootPanelRectCom.sizeDelta.y * 2)
  103. end
  104. local function RefreshBottomImgUI(szBottomImgPath)
  105. if not szBottomImgPath then return end
  106. local rootPanel = PageModule.rootPanel
  107. local bottomImgObj = rootPanel.transform:Find("Img_Bottom").gameObject
  108. local uiHelper = require('Base/UIHelper.lua')
  109. uiHelper:LoadSprite(bottomImgObj, szBottomImgPath, szBottomImgPath)
  110. end
  111. local function RefreshMaskShowImgUI(szMaskImgPath)
  112. if not szMaskImgPath then return end
  113. local rootPanel = PageModule.rootPanel
  114. local showImgObj = rootPanel.transform:Find("Mask/Img_MaskShow")
  115. local uiHelper = require('Base/UIHelper.lua')
  116. uiHelper:LoadSprite(showImgObj, szMaskImgPath, szMaskImgPath)
  117. end
  118. local function RefreshNextShowImgUI(szNextShowImgPath)
  119. if not szNextShowImgPath then return end
  120. local rootPanel = PageModule.rootPanel
  121. local nextImgObj = rootPanel.transform:Find("Next/Img_Next")
  122. local uiHelper = require('Base/UIHelper.lua')
  123. uiHelper:LoadSprite(nextImgObj, szNextShowImgPath, szNextShowImgPath)
  124. end
  125. local function GetMaskAndNextNormalizeInfo(effectType)
  126. local tMaskInfo = {
  127. ["pivot"] = nil,
  128. ["maskPosNormalize"] = nil,
  129. ["maskImgPosNormalize"] = nil,
  130. }
  131. local tNextInfo = {
  132. ["pivot"] = nil,
  133. ["nextPosNormalize"] = nil,
  134. ["nextImgPosNormalize"] = nil,
  135. ["nextShadowImgPosNormalize"] = nil,
  136. ["nextEulerAngles"] = nil,
  137. ["nextShadowEulerAngles"] = nil
  138. }
  139. if effectType == EffectType.LeftTop then
  140. tMaskInfo.pivot = CS.UnityEngine.Vector2(0, 1)
  141. tMaskInfo.maskPosNormalize = CS.UnityEngine.Vector3(-1, 1, 0)
  142. tMaskInfo.maskImgPosNormalize = CS.UnityEngine.Vector3(-1, 1, 0)
  143. tNextInfo.pivot = CS.UnityEngine.Vector2(1, 1)
  144. tNextInfo.nextPosNormalize = CS.UnityEngine.Vector3(-1, 1, 0)
  145. tNextInfo.nextImgPosNormalize = CS.UnityEngine.Vector3(1, 1, 0)
  146. tNextInfo.nextShadowImgPosNormalize = CS.UnityEngine.Vector3(1, 1, 0)
  147. tNextInfo.nextEulerAngles = CS.UnityEngine.Vector3(0, 0, 1)
  148. tNextInfo.nextShadowEulerAngles = CS.UnityEngine.Vector3(0, 0, -1)
  149. end
  150. if effectType == EffectType.LeftBottom then
  151. tMaskInfo.pivot = CS.UnityEngine.Vector2(0, 0)
  152. tMaskInfo.maskPosNormalize = CS.UnityEngine.Vector3(-1, -1, 0)
  153. tMaskInfo.maskImgPosNormalize = CS.UnityEngine.Vector3(-1, -1, 0)
  154. tNextInfo.pivot = CS.UnityEngine.Vector2(1, 0)
  155. tNextInfo.nextPosNormalize = CS.UnityEngine.Vector3(-1, -1, 0)
  156. tNextInfo.nextImgPosNormalize = CS.UnityEngine.Vector3(1, -1, 0)
  157. tNextInfo.nextShadowImgPosNormalize = CS.UnityEngine.Vector3(1, -1, 0)
  158. tNextInfo.nextEulerAngles = CS.UnityEngine.Vector3(0, 0, -1)
  159. tNextInfo.nextShadowEulerAngles = CS.UnityEngine.Vector3(0, 0, 1)
  160. end
  161. if effectType == EffectType.RightTop then
  162. tMaskInfo.pivot = CS.UnityEngine.Vector2(1, 1)
  163. tMaskInfo.maskPosNormalize = CS.UnityEngine.Vector3(1, 1, 0)
  164. tMaskInfo.maskImgPosNormalize = CS.UnityEngine.Vector3(1, 1, 0)
  165. tNextInfo.pivot = CS.UnityEngine.Vector2(0, 1)
  166. tNextInfo.nextPosNormalize = CS.UnityEngine.Vector3(1, 1, 0)
  167. tNextInfo.nextImgPosNormalize = CS.UnityEngine.Vector3(-1, 1, 0)
  168. tNextInfo.nextShadowImgPosNormalize = CS.UnityEngine.Vector3(-1, 1, 0)
  169. tNextInfo.nextEulerAngles = CS.UnityEngine.Vector3(0, 0, -1)
  170. tNextInfo.nextShadowEulerAngles = CS.UnityEngine.Vector3(0, 0, 1)
  171. end
  172. if effectType == EffectType.RightBottom then
  173. tMaskInfo.pivot = CS.UnityEngine.Vector2(1, 0)
  174. tMaskInfo.maskPosNormalize = CS.UnityEngine.Vector3(1, -1, 0)
  175. tMaskInfo.maskImgPosNormalize = CS.UnityEngine.Vector3(1, -1, 0)
  176. tNextInfo.pivot = CS.UnityEngine.Vector2(0, 0)
  177. tNextInfo.nextPosNormalize = CS.UnityEngine.Vector3(1, -1, 0)
  178. tNextInfo.nextImgPosNormalize = CS.UnityEngine.Vector3(-1, -1, 0)
  179. tNextInfo.nextShadowImgPosNormalize = CS.UnityEngine.Vector3(-1, -1, 0)
  180. tNextInfo.nextEulerAngles = CS.UnityEngine.Vector3(0, 0, 1)
  181. tNextInfo.nextShadowEulerAngles = CS.UnityEngine.Vector3(0, 0, -1)
  182. end
  183. return tMaskInfo, tNextInfo
  184. end
  185. local function SetMaskRectInfo(tMaskInfo)
  186. local rootPanel = PageModule.rootPanel
  187. local maskObj = rootPanel.transform:Find("Mask").gameObject
  188. local maskImgObj = maskObj.transform:Find("Img_MaskShow").gameObject
  189. local maskObjCom = maskObj.transform:GetComponent("RectTransform")
  190. local maskImgObjCom = maskImgObj.transform:GetComponent("RectTransform")
  191. local nMaskObjPosX = maskObjCom.sizeDelta.x * 0.5 - maskImgObjCom.sizeDelta.x * 0.5
  192. local nMaskObjPosY = maskObjCom.sizeDelta.y * 0.5
  193. local nMaskImgObjPosX = maskImgObjCom.sizeDelta.x
  194. local nMaskImgObjPosY = maskImgObjCom.sizeDelta.y * 0.5
  195. local maskPosNormalize = tMaskInfo.maskPosNormalize
  196. local maskImgPosNormalize = tMaskInfo.maskImgPosNormalize
  197. maskObjCom.pivot = tMaskInfo.pivot
  198. maskImgObjCom.pivot = tMaskInfo.pivot
  199. maskObjCom.anchoredPosition3D = CS.UnityEngine.Vector3(maskPosNormalize.x * nMaskObjPosX, maskPosNormalize.y * nMaskObjPosY, maskPosNormalize.z)
  200. maskImgObjCom.anchoredPosition3D = CS.UnityEngine.Vector3(maskImgPosNormalize.x * nMaskImgObjPosX, maskImgPosNormalize.y * nMaskImgObjPosY, maskImgPosNormalize.z)
  201. maskObjCom.localEulerAngles = CS.UnityEngine.Vector3(0, 0, 0)
  202. maskImgObjCom.localEulerAngles = CS.UnityEngine.Vector3(0, 0, 0)
  203. end
  204. local function SetNextRectInfo(tNextInfo)
  205. local rootPanel = PageModule.rootPanel
  206. local nextObj = rootPanel.transform:Find("Next").gameObject
  207. local nextImgObj = nextObj.transform:Find("Img_Next").gameObject
  208. local nextShadowImgObj = nextImgObj.transform:Find("Img_Shadow")
  209. local nextObjCom = nextObj.transform:GetComponent("RectTransform")
  210. local nextImgObjCom = nextImgObj.transform:GetComponent("RectTransform")
  211. local nNextObjPosX = nextObjCom.sizeDelta.x * 0.5
  212. local nNextObjPosY = nextObjCom.sizeDelta.y * 0.5 - nextImgObjCom.sizeDelta.y * 0.5
  213. local nNextImgObjPosX = nextImgObjCom.sizeDelta.x * 0.5
  214. local nNextImgObjPosY = nextImgObjCom.sizeDelta.y
  215. local nextPosNormalize = tNextInfo.nextPosNormalize
  216. local nextImgPosNormalize = tNextInfo.nextImgPosNormalize
  217. local nextEulerAngles = tNextInfo.nextEulerAngles
  218. local nextShadowEulerAngles = tNextInfo.nextShadowEulerAngles
  219. nextObjCom.pivot = tNextInfo.pivot
  220. nextImgObjCom.pivot = tNextInfo.pivot
  221. nextObjCom.anchoredPosition3D = CS.UnityEngine.Vector3(nextPosNormalize.x * nNextObjPosX, nextPosNormalize.y * nNextObjPosY, nextPosNormalize.z)
  222. nextImgObjCom.anchoredPosition3D = CS.UnityEngine.Vector3(nextImgPosNormalize.x * nNextImgObjPosX, nextImgPosNormalize.y * nNextImgObjPosY, nextImgPosNormalize.z)
  223. nextObjCom.localEulerAngles = CS.UnityEngine.Vector3(0, 0, 90 * nextEulerAngles.z)
  224. nextImgObjCom.localEulerAngles = CS.UnityEngine.Vector3(0, 0, 90 * nextEulerAngles.z)
  225. if not nextShadowImgObj then
  226. return
  227. end
  228. local nextShadowImgObjCom = nextShadowImgObj.transform:GetComponent("RectTransform")
  229. local nextShadowImgPosNormalize = tNextInfo.nextShadowImgPosNormalize
  230. local nNextShadowImgObjPosX = nextImgObjCom.sizeDelta.x * 0.5
  231. local nNextShadowImgObjPosY = nextImgObjCom.sizeDelta.y * 0.5
  232. nextShadowImgObjCom.pivot = tNextInfo.pivot
  233. nextShadowImgObjCom.localEulerAngles = CS.UnityEngine.Vector3(0, 0, 90 * nextShadowEulerAngles.z)
  234. nextShadowImgObjCom.anchoredPosition3D = CS.UnityEngine.Vector3(nextShadowImgPosNormalize.x * nNextShadowImgObjPosX, nextShadowImgPosNormalize.y * nNextShadowImgObjPosY, nextShadowImgPosNormalize.z)
  235. end
  236. local function PlayEffect(nEffectTime)
  237. if not nEffectTime or 0 == nEffectTime then return end
  238. if funPlayPageModuleEffect then require("Base/CoroutineHelper.lua"):Stop(funPlayPageModuleEffect) end
  239. local rootPanel = PageModule.rootPanel
  240. local maskObj = rootPanel.transform:Find("Mask").gameObject
  241. local maskImgObj = maskObj.transform:Find("Img_MaskShow").gameObject
  242. local nextObj = rootPanel.transform:Find("Next").gameObject
  243. local nextImgObj = nextObj.transform:Find("Img_Next").gameObject
  244. local shadowImgObj = nextImgObj.transform:Find("Img_Shadow")
  245. local maskObjCom = maskObj.transform:GetComponent("RectTransform")
  246. local maskImgObjCom = maskImgObj.transform:GetComponent("RectTransform")
  247. local nextObjCom = nextObj.transform:GetComponent("RectTransform")
  248. local nextImgObjCom = nextImgObj.transform:GetComponent("RectTransform")
  249. local shadowImgObjCom
  250. if shadowImgObj then
  251. shadowImgObjCom = shadowImgObj.transform:GetComponent("RectTransform")
  252. end
  253. funPlayPageModuleEffect = require("Base/CoroutineHelper.lua"):Start(function ()
  254. local nOffectAngle = CS.UnityEngine.Vector3(0, 0, -90 / (nEffectTime * 1000))
  255. local nCurrentTime = 0
  256. while nCurrentTime <= nEffectTime do
  257. local rotateDirection
  258. if currentEffectType == EffectType.LeftBottom
  259. or currentEffectType == EffectType.RightTop then
  260. rotateDirection = 1
  261. end
  262. if currentEffectType == EffectType.LeftTop
  263. or currentEffectType == EffectType.RightBottom then
  264. rotateDirection = -1
  265. end
  266. maskObjCom.localEulerAngles = maskObjCom.localEulerAngles - nOffectAngle * rotateDirection
  267. maskImgObjCom.localEulerAngles = maskImgObjCom.localEulerAngles + nOffectAngle * rotateDirection
  268. nextObjCom.localEulerAngles = nextObjCom.localEulerAngles - nOffectAngle * rotateDirection
  269. nextImgObjCom.localEulerAngles = nextImgObjCom.localEulerAngles - nOffectAngle * rotateDirection
  270. if shadowImgObjCom then
  271. shadowImgObjCom.localEulerAngles = shadowImgObjCom.localEulerAngles + nOffectAngle * rotateDirection
  272. end
  273. nCurrentTime = nCurrentTime + 0.001
  274. require("Base/CoroutineHelper.lua"):Wait(0.001)
  275. end
  276. end)
  277. end
  278. local function CreateUIItem()
  279. CreateBottomImgUI()
  280. CreateMaskUI()
  281. CreateMaskShowImgUI()
  282. CreateNextUI()
  283. CreateNextImgUI()
  284. end
  285. local function RefreshPageModuleUI(szShowImgPath, szBottomImgPath, szNextShowImgPath)
  286. RefreshMaskShowImgUI(szShowImgPath)
  287. RefreshBottomImgUI(szBottomImgPath)
  288. RefreshNextShowImgUI(szNextShowImgPath)
  289. end
  290. local function ChangeShadowImg(szShadowImgPath, nShadowWidth)
  291. local rootPanel = PageModule.rootPanel
  292. local shadowImgObj = rootPanel.transform:Find("Next/Img_Next/Img_Shadow")
  293. if not shadowImgObj then
  294. CreateShadowImgUI(szShadowImgPath, nShadowWidth)
  295. return
  296. end
  297. if nShadowWidth then
  298. local shadowImgObjRectCom = shadowImgObj:GetComponent("RectTransform")
  299. shadowImgObjRectCom.sizeDelta = CS.UnityEngine.Vector2(nShadowWidth, shadowImgObjRectCom.sizeDelta.y * 2)
  300. end
  301. local uiHelper = require('Base/UIHelper.lua')
  302. uiHelper:LoadSprite(shadowImgObj.gameObject, szShadowImgPath, szShadowImgPath)
  303. end
  304. local function RefreshMaskAndNextUI(effectType)
  305. local tMaskInfo, tNextInfo = GetMaskAndNextNormalizeInfo(effectType)
  306. SetMaskRectInfo(tMaskInfo)
  307. SetNextRectInfo(tNextInfo)
  308. end
  309. local function ChangeEffectType(effectType)
  310. currentEffectType = effectType
  311. RefreshMaskAndNextUI(effectType)
  312. end
  313. local function RefreshUI()
  314. CreateUIItem()
  315. RefreshMaskAndNextUI("LeftBottom")
  316. end
  317. local function RegisterEvent()
  318. local eventManager = require('Base/ZEventDispatchCenter.lua')
  319. eventManager:RegisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_EFFECT, PlayEffect)
  320. eventManager:RegisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_CHANGE_SHADOW_IMG, ChangeShadowImg)
  321. eventManager:RegisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_CHANGE_EFFENT_TYPE, ChangeEffectType)
  322. eventManager:RegisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_REFRESH_UI, RefreshPageModuleUI)
  323. end
  324. local function UnregisterEvent()
  325. local eventManager = require('Base/ZEventDispatchCenter.lua')
  326. eventManager:UnregisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_REFRESH_UI, RefreshPageModuleUI)
  327. eventManager:UnregisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_CHANGE_EFFENT_TYPE, ChangeEffectType)
  328. eventManager:UnregisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_CHANGE_SHADOW_IMG, ChangeShadowImg)
  329. eventManager:UnregisterEvent(eventManager.EventType.COMMON_UI_PAGE_MODULE_EFFECT, PlayEffect)
  330. end
  331. function PageModule.Awake(luaRoot)
  332. PageModule.luaRoot = luaRoot
  333. local canvas = CS.UnityEngine.GameObject.Find('Canvas')
  334. PageModule._rootCanvas = canvas
  335. PageModule.rootPanel = luaRoot
  336. end
  337. function PageModule.Init()
  338. RefreshUI()
  339. RegisterEvent()
  340. end
  341. function PageModule.UnInit()
  342. StopAllCoroutine()
  343. UnregisterEvent()
  344. end
  345. return PageModule