您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

51 行
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using SUISS.Core;
  4. using SUISS.Scheduling;
  5. using SUISSEngine;
  6. using UnityEngine;
  7. public class CIGFirst : MonoBehaviour
  8. {
  9. protected void Awake()
  10. {
  11. if (string.IsNullOrEmpty(this._currentSceneName))
  12. {
  13. UnityEngine.Debug.LogError("[CIGFirst] Please define the current scene name!");
  14. }
  15. if (!ServiceLocator.WasRegistered<IScheduler>())
  16. {
  17. ServiceLocator.RegistorServiceObject<IScheduler>(new UnityScheduler());
  18. }
  19. Singleton<CIGSettings>.Instance.SwitchLanguage(Singleton<CIGSettings>.Instance.CultureIdentifier);
  20. Screen.sleepTimeout = -1;
  21. if ((this.persistentManagerPrefabs != null && !CIGFirst._persistentManagerPrefabsLoaded.ContainsKey(this._currentSceneName)) || !CIGFirst._persistentManagerPrefabsLoaded[this._currentSceneName])
  22. {
  23. foreach (GameObject gameObject in this.persistentManagerPrefabs)
  24. {
  25. if (gameObject != null)
  26. {
  27. UnityEngine.Object @object = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  28. if (@object.name.Contains("Clone"))
  29. {
  30. @object.name = gameObject.name;
  31. }
  32. }
  33. else
  34. {
  35. UnityEngine.Debug.LogWarning("Null prefab in CIGFirst");
  36. }
  37. }
  38. CIGFirst._persistentManagerPrefabsLoaded[this._currentSceneName] = true;
  39. }
  40. StorageController.Initialize();
  41. }
  42. [SerializeField]
  43. private string _currentSceneName;
  44. public GameObject[] persistentManagerPrefabs;
  45. private static Dictionary<string, bool> _persistentManagerPrefabsLoaded = new Dictionary<string, bool>();
  46. }