DemoAll.lua.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. local DemoAll = {}
  2. local function OnClickBtnUINavigitor()
  3. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoUINavigator.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  4. end
  5. local function OnClickBtnProgressor()
  6. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoProgressor.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  7. end
  8. local function OnClickBtnRemoteReturn()
  9. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoRemoteReturn.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  10. end
  11. local function OnClickBtnToast()
  12. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoToast.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  13. end
  14. local function OnClickBtnMenu()
  15. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoMenu.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  16. end
  17. local function OnClickBtnPage()
  18. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoPage.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  19. end
  20. local function OnClickBtnPagePoster()
  21. require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoPagePoster.lua", "CommonUtils/DemoLuaScripts/DemoAll.lua")
  22. end
  23. local function RegisterTouchEvent()
  24. local rootPanel = DemoAll.rootPanel
  25. local uiHelper = require('Base/UIHelper.lua')
  26. uiHelper:AddClickEvent(rootPanel, "Btn_UINavigitor", OnClickBtnUINavigitor)
  27. uiHelper:AddClickEvent(rootPanel, "Btn_Progressor", OnClickBtnProgressor)
  28. uiHelper:AddClickEvent(rootPanel, "Btn_RemoteReturn", OnClickBtnRemoteReturn)
  29. uiHelper:AddClickEvent(rootPanel, "Btn_Toast", OnClickBtnToast)
  30. uiHelper:AddClickEvent(rootPanel, "Btn_Menu", OnClickBtnMenu)
  31. uiHelper:AddClickEvent(rootPanel, "Btn_Page", OnClickBtnPage)
  32. uiHelper:AddClickEvent(rootPanel, "Btn_PagePoster", OnClickBtnPagePoster)
  33. end
  34. function DemoAll.Awake(luaRoot)
  35. DemoAll.luaRoot = luaRoot
  36. local canvas = CS.UnityEngine.GameObject.Find('Canvas')
  37. DemoAll._rootCanvas = canvas
  38. local prefabAllDemo = LoadResource('CommonUtils/Prefabs/Demo/ZDemoAllPanel.prefab')
  39. local rootPanel = CS.UnityEngine.GameObject.Instantiate(prefabAllDemo, canvas.transform)
  40. DemoAll.rootPanel = rootPanel
  41. end
  42. function DemoAll.Start()
  43. RegisterTouchEvent()
  44. end
  45. function DemoAll.OnDestroy()
  46. CS.UnityEngine.GameObject.Destroy(DemoAll.rootPanel)
  47. end
  48. return DemoAll