|
- using System;
- using System.Collections.Generic;
- using SUISS.Core;
- using SUISS.Scheduling;
- using SUISSEngine;
- using UnityEngine;
-
- public class CIGFirst : MonoBehaviour
- {
- protected void Awake()
- {
- if (string.IsNullOrEmpty(this._currentSceneName))
- {
- UnityEngine.Debug.LogError("[CIGFirst] Please define the current scene name!");
- }
- if (!ServiceLocator.WasRegistered<IScheduler>())
- {
- ServiceLocator.RegistorServiceObject<IScheduler>(new UnityScheduler());
- }
- Singleton<CIGSettings>.Instance.SwitchLanguage(Singleton<CIGSettings>.Instance.CultureIdentifier);
- Screen.sleepTimeout = -1;
- if ((this.persistentManagerPrefabs != null && !CIGFirst._persistentManagerPrefabsLoaded.ContainsKey(this._currentSceneName)) || !CIGFirst._persistentManagerPrefabsLoaded[this._currentSceneName])
- {
- foreach (GameObject gameObject in this.persistentManagerPrefabs)
- {
- if (gameObject != null)
- {
- UnityEngine.Object @object = UnityEngine.Object.Instantiate<GameObject>(gameObject);
- if (@object.name.Contains("Clone"))
- {
- @object.name = gameObject.name;
- }
- }
- else
- {
- UnityEngine.Debug.LogWarning("Null prefab in CIGFirst");
- }
- }
- CIGFirst._persistentManagerPrefabsLoaded[this._currentSceneName] = true;
- }
- StorageController.Initialize();
- }
-
- [SerializeField]
- private string _currentSceneName;
-
- public GameObject[] persistentManagerPrefabs;
-
- private static Dictionary<string, bool> _persistentManagerPrefabsLoaded = new Dictionary<string, bool>();
- }
|