private void ToggleSceneInternal <TScene>() where TScene : SceneView
 {
     if (!_scenesLoaded.Contains(typeof(TScene)))
     {
         CpUnityExtensions.LoadLevelAdditive <TScene>();
     }
     else
     {
         CpUnityExtensions.UnloadLevelAdditive <TScene>();
     }
 }
Exemplo n.º 2
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.º 5
0
 public override void Execute()
 {
     Rapid.Bind("Score", 0);
     CpUnityExtensions.UnloadLevelAdditive <GameOverSceneView>();
 }
Exemplo n.º 6
0
 public override void Execute(Type sceneType)
 {
     CpUnityExtensions.LoadLevelAdditive(sceneType);
 }
Exemplo n.º 7
0
 public static string GetName(this SceneView scene)
 {
     return(CpUnityExtensions.GetSceneName(scene.GetType()));
 }