AppLauncher.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using Mono;
  4. using Mono.UI.Core;
  5. using UnityEngine;
  6. using UnityEngine.SceneManagement;
  7. public class AppLauncher : MonoBehaviour
  8. {
  9. private bool _isStart;
  10. void Start()
  11. {
  12. DontDestroyOnLoad(this);
  13. GameObject prefab = Resources.Load<GameObject>("Canvas");
  14. GameObject _gameObject = GameObject.Instantiate(prefab);
  15. UIManager.Instance.SetUIRoot(_gameObject);
  16. ConfigComponent.Instance.Preload();
  17. _isStart = true;
  18. _timer = 0;
  19. // SceneManager.LoadScene("main");
  20. TimeComponent.Instance.AddTimer(10, () => { UIManager.Instance.LoadAndOpenPanel<StartPanel>(UIManager.UILayer.Middle); });
  21. UIManager.Instance.PlayBGM("title");
  22. }
  23. private float _timer;
  24. // Update is called once per frame
  25. // void Update()
  26. // {
  27. // if (_isStart)
  28. // {
  29. // _timer += Time.deltaTime;
  30. // if (_timer >= 15)
  31. // {
  32. // UIManager.Instance.LoadAndOpenPanel<StartPanel>(UIManager.UILayer.Middle);
  33. // _isStart = false;
  34. // _timer = 0;
  35. // }
  36. // }
  37. // }
  38. }