main.lua.txt 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. local Main = Main or {}
  2. print("main.lua run start ... ... ")
  3. function Main.Awake(luaRoot)
  4. print("Main.Awake() Called ~")
  5. print("luaRoot.name -> " .. luaRoot.name)
  6. end
  7. g_TestTable = {
  8. Awake = function()
  9. print("g_TestTable.Awake Called~")
  10. end,
  11. Start = function()
  12. print("g_TestTable.Start Called~")
  13. end
  14. }
  15. function Main.Start(luaRoot)
  16. print("Main.Start Called ~")
  17. print("luaRoot.name -> " .. luaRoot.name)
  18. local luaTest = CS.UnityEngine.GameObject("Lua_Test_g_TestTable")
  19. print("luaTest.name -> " .. luaTest.name)
  20. CS.SFramework.SLuaComponent.Add(luaTest, g_TestTable)
  21. print("-------------- Test require -------------")
  22. -- Test Update v1 Code
  23. local tExistedTab = require("start/existed.lua");
  24. tExistedTab.Test("this is a test info.")
  25. tExistedTab.ShowUI()
  26. -- Test Update v2 Code
  27. --[[local tExistedTab2 = require("start/existed2.lua")
  28. tExistedTab2.ShowUI()]]
  29. end
  30. function Main.OnDestroy()
  31. print("Main.OnDestroy Called ~")
  32. end
  33. print("main.lua run Finish ... ...")
  34. return Main