Exemplo n.º 1
0
 public override void Execute(Type sceneType)
 {
     CpUnityExtensions.UnloadLevelAdditive(sceneType, operation =>
     {
         var contextName = CpUnityExtensions.GetSceneName(sceneType);
         if (Rapid.Contexts.FindContext(contextName, out var context, out _))
         {
             Debug.LogWarning(string.Format("Scene <{0}> is being destroyed while its context still exists with <{1}> bindings and <{2}> views.",
                                            contextName, context.BindingCount, context.ViewCount));
         }
     });
        public override void OnSceneLoaded(SceneView sceneView)
        {
            base.OnSceneLoaded(sceneView);
            _scenesLoaded.Add(sceneView.GetType());

            var sceneName = CpUnityExtensions.GetSceneName(sceneView.GetType());
            var text      = textRoot.AddChild(textPrefab);

            text.name = sceneName;
            text.text = sceneName;
        }
 public void OnSceneUnloaded(Type sceneType)
 {
     if (_scenesLoaded.Contains(sceneType))
     {
         _scenesLoaded.Remove(sceneType);
         var child = textRoot.Find(CpUnityExtensions.GetSceneName(sceneType));
         if (child != null)
         {
             Destroy(child.gameObject);
         }
     }
 }
Exemplo n.º 4
0
 public static string GetName(this SceneView scene)
 {
     return(CpUnityExtensions.GetSceneName(scene.GetType()));
 }