Example #1
0
        public SceneData GetScene(string sceneName)
        {
            InternalSceneData scene          = _sceneLoader.Collection.GetScene(sceneName);
            SceneData         sceneConverted = _marshaller.Unmarshall(scene);

            return(sceneConverted);
        }
Example #2
0
        //=============================================================================//
        //============ Lifecycle Methods
        //=============================================================================//
        #region Lifecycle Methods

        /// <summary>
        /// Unity's Awake lifecycle
        /// Will initialize all member's variables and always add the scene containing SceneLoader as the first scene (this one will not be delete in any case)
        /// </summary>
        private void Awake()
        {
            _currentProcess = null;
            _collection     = new SceneCollection();

            InternalSceneData loaderScene = new InternalSceneData(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name, true, false, true, "MainSceneBundle", true);

            SceneLoaderEvents.TriggerOnSceneLoadedInternal(loaderScene);
        }
Example #3
0
        internal override SceneLoaderRequestResult Inspection(SceneCollection collection, bool forceNotSuppressible)
        {
            InternalSceneData lastScene   = collection.GetLastScene();
            bool lastSceneNotSuppressible = lastScene != null && forceNotSuppressible == false && lastScene.IsSuppressible == false;

            return
                ((lastSceneNotSuppressible) ?
                 (SceneLoaderConstants.REQUEST_RESULTS[SceneLoaderReturnType.LoadRejectedUnloadLastSceneNotSuppressible]) :
                 (SceneLoaderConstants.REQUEST_RESULTS[SceneLoaderReturnType.Accepted]));
        }
        internal override SceneLoaderRequestResult Inspection(SceneCollection collection, bool forceNotSuppressible)
        {
            InternalSceneData        lastScene = collection.GetLastScene();
            string                   lastSceneBundleIdentifier = lastScene?.BundleIdentifier;
            List <InternalSceneData> bundleScenes = collection.GetAllScenesAtBundle(lastSceneBundleIdentifier, _includeMains);
            bool scenesNotSuppressible            = bundleScenes?.Find(scene => scene.IsSuppressible == false) != null;

            return
                ((forceNotSuppressible == false && scenesNotSuppressible) ?
                 (SceneLoaderConstants.REQUEST_RESULTS[SceneLoaderReturnType.LoadRejectedUnloadBundleNotSuppressible]) :
                 (SceneLoaderConstants.REQUEST_RESULTS[SceneLoaderReturnType.Accepted]));
        }
Example #5
0
        public List <InternalSceneData> GetScenesUntilMarked()
        {
            List <InternalSceneData> scenes = new List <InternalSceneData>();

            for (int i = _scenes.Count - 1; i >= 0; i--)
            {
                InternalSceneData scene = _scenes[i];
                if (scene.IsMarked || scene.IsMainScene)
                {
                    break;
                }

                scenes.Add(scene);
            }

            return(scenes);
        }
Example #6
0
 internal static void TriggerOnSceneUnloadedInternal(InternalSceneData sceneData)
 {
     _onSceneUnloadedInternal?.Invoke(sceneData);
 }
 //=============================================================================//
 //============ Lifecycle Methods
 //=============================================================================//
 #region Lifecycle Methods
 public InternalSceneRequestLoad(InternalSceneData sceneData) :
     base(sceneData)
 {
 }
Example #8
0
        public SceneData GetLastScene()
        {
            InternalSceneData scene = _sceneLoader.Collection.GetLastScene();

            return(_marshaller.Unmarshall(scene));
        }
Example #9
0
 private void OnSceneUnloaded(InternalSceneData sceneData)
 {
     FreeBundleIdentifierNumericIfExists(sceneData.BundleIdentifier);
     _scenes.RemoveAll(scene => scene.SceneName == sceneData.SceneName);
 }
Example #10
0
        //=============================================================================//
        //============ Private / Protected Methods
        //=============================================================================//
        #region Private / Protected Methods

        private void OnSceneLoaded(InternalSceneData sceneData)
        {
            _scenes.Add(sceneData);
        }
Example #11
0
 //=============================================================================//
 //============ Lifecycle Methods
 //=============================================================================//
 #region Lifecycle Methods
 protected InternalSceneRequest(InternalSceneData sceneData)
 {
     _sceneData = sceneData;
 }