示例#1
0
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            if (scene.buildIndex > 0)
            {
                if (FirstFetch)
                {
                    Console.WriteLine("Launching coroutine to grab original sabers!");
                    SharedCoroutineStarter.instance.StartCoroutine(PreloadDefaultSabers());
                    Console.WriteLine("Launched!");
                }
            }

            if (scene.name == "GameCore")
            {
                LoadNewSaber(_currentSaberPath);
                SaberScript.LoadAssets();
            }

            if (scene.name == "Menu")
            {
                if (_currentSaber != null)
                {
                    _currentSaber.Unload(true);
                }
                CustomSaberUI.OnLoad();
            }
        }
示例#2
0
 public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
 {
     if (nextScene.name == "GameCore")
     {
         SaberScript.Load();
     }
 }
示例#3
0
 private void OnGameSceneLoaded()
 {
     if (BS_Utils.Plugin.LevelData.Mode != BS_Utils.Gameplay.Mode.Multiplayer)
     {
         SaberScript.Load();
     }
 }
示例#4
0
        public void OnUpdate()
        {
            if (_currentSaber == null)
            {
                return;
            }
            if (Input.GetKeyDown(KeyCode.Space))
            {
                RetrieveCustomSabers();
                if (_saberPaths.Count == 1)
                {
                    return;
                }
                var oldIndex = _saberPaths.IndexOf(_currentSaberPath);
                if (oldIndex >= _saberPaths.Count - 1)
                {
                    oldIndex = -1;
                }

                var newSaber = _saberPaths[oldIndex + 1];
                LoadNewSaber(newSaber);
                if (SceneManager.GetActiveScene().buildIndex != 4)
                {
                    return;
                }
                SaberScript.LoadAssets();
            }
            else if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.LeftAlt))
            {
                RetrieveCustomSabers();
                if (_saberPaths.Count == 1)
                {
                    return;
                }
                var oldIndex = _saberPaths.IndexOf(_currentSaberPath);
                if (oldIndex <= 0)
                {
                    oldIndex = _saberPaths.Count - 1;
                }

                var newSaber = _saberPaths[oldIndex - 1];
                LoadNewSaber(newSaber);
                if (SceneManager.GetActiveScene().buildIndex != 4)
                {
                    return;
                }
                SaberScript.LoadAssets();
            }
        }
示例#5
0
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            if (scene.name == "NiceEnvironment" || scene.name == "DefaultEnvironment" || scene.name == "BigMirrorEnvironment" || scene.name == "TriangleEnvironment")
            {
                LoadNewSaber(_currentSaberPath);
                SaberScript.LoadAssets();
            }

            if (scene.name == "Menu")
            {
                if (_currentSaber != null)
                {
                    _currentSaber.Unload(true);
                }
                CustomSaberUI.OnLoad();
            }
        }
示例#6
0
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            if (scene.name == "StandardLevel")
            {
                LoadNewSaber(_currentSaberPath);
                SaberScript.LoadAssets();
            }

            if (scene.name == "Menu")
            {
                if (_currentSaber != null)
                {
                    _currentSaber.Unload(true);
                }
                CustomSaberUI.OnLoad();
            }
        }
        public static void LoadAssets()
        {
            if (CustomSaber == null)
            {
                Console.WriteLine("SABER ASSET BUNDLE DOESNT EXIST");
            }
            if (Instance != null)
            {
                Destroy(Instance._leftSaber);
                Destroy(Instance._rightSaber);
                Destroy(Instance._saberRoot);
                Destroy(Instance.gameObject);
            }
            var loader = new GameObject("Saber Loader");

            Instance = loader.AddComponent <SaberScript>();
        }
示例#8
0
        public static void LoadAssets()
        {
            if (CustomSaber == null && Plugin._currentSaberName != "Default Sabers")
            {
                Logger.Log("SABER ASSET BUNDLE DOESNT EXIST", LogLevel.Warning);
            }

            if (Instance != null)
            {
                Destroy(Instance._leftSaber);
                Destroy(Instance._rightSaber);
                Destroy(Instance._saberRoot);
                Destroy(Instance.gameObject);
            }

            var loader = new GameObject("Saber Loader");

            Instance = loader.AddComponent <SaberScript>();
        }
示例#9
0
        public void OnActiveSceneChanged(Scene from, Scene to)
        {
            //if (scene.buildIndex > 0)
            //{
            //    if (FirstFetch)
            //    {
            //        //Logger.Log("Launching coroutine to grab original sabers!", LogLevel.Debug);
            //        //SharedCoroutineStarter.instance.StartCoroutine(PreloadDefaultSabers());
            //        //Logger.Log("Launched!", LogLevel.Debug);
            //    }
            //}

            if (to.name == "GameCore")
            {
                LoadNewSaber(_currentSaberName);
                SaberScript.LoadAssets();
            }

            if (to.name == "MenuCore")
            {
                CustomSaberUI.OnLoad();
            }
        }
示例#10
0
 private void OnGameSceneLoaded()
 {
     SaberScript.Load();
 }