existed2.lua.txt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. print("existed.lua run ... ...")
  2. local ExistedTab2 = ExistedTab2 or {}
  3. function ExistedTab2.Test(info)
  4. print("ExistedTab.Test Called -> " .. info)
  5. end
  6. local function ShowUI()
  7. local gameObject = CS.UnityEngine.GameObject.Find("LogicInstance")
  8. print("gameObject.name -> " .. gameObject.name)
  9. --CS.UnityEngine.GameObject.Instantiate(gameObject)
  10. print("Create lua gameObject Finish.")
  11. local canvasStart = LoadResource("prefabs/canvas_start_v2.prefab")
  12. local uiGameObject = CS.UnityEngine.GameObject.Instantiate(canvasStart)
  13. print("Create canvasStart Finish.")
  14. --gameObject:AddComponent(typeof(CS.SUIPanelStart))
  15. --print("gameObject AddComponent Finish.")
  16. print("uiGameObject.name -> " .. uiGameObject.name)
  17. local textWelcome = uiGameObject.transform:Find("Panel_Start/Text_Welcome").gameObject
  18. print("textWelcome.name -> " .. textWelcome.name)
  19. textWelcome:GetComponent("Text").text = "Welcome to start scene.\nControl by existed2.lua"
  20. end
  21. function ExistedTab2.ShowUI()
  22. ShowUI()
  23. end
  24. return ExistedTab2