示例#1
0
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            try
            {
                if (SceneUtils.isGameScene(scene))
                {
                    var pauseMenuManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().First();
                    if (pauseMenuManager != null)
                    {
                        var continueButton = ReflectionUtil.GetPrivateField <Button>(pauseMenuManager, "_continueButton");

                        var decrementButton = Instantiate(continueButton, continueButton.transform.parent);
                        decrementButton.onClick.AddListener(decrementVolume_Click);
                        decrementButton.SetButtonText("Volume--");

                        var incrementButton = Instantiate(continueButton, continueButton.transform.parent);
                        incrementButton.onClick.AddListener(incrementVolume_Click);
                        incrementButton.SetButtonText("Volume++");

                        continueButton.onClick.AddListener(continueButton_clicked);
                    }
                    StartCoroutine(WaitForLoad());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Tweaks (NoteVolume) done f****d up: " + e);
            }
        }
示例#2
0
 public static void UpdateMusicVolume()
 {
     Plugin.Log("Updating music volume", Plugin.LogLevel.DebugOnly);
     if (audioSource != null && SceneUtils.isGameScene(SceneManager.GetActiveScene()))
     {
         float newVolume = Settings.MusicVolume;
         audioSource.volume = newVolume;
         Plugin.Log("Setting music volume to " + newVolume, Plugin.LogLevel.DebugOnly);
     }
 }
示例#3
0
 private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         if (SceneUtils.isGameScene(scene))
         {
             StartCoroutine(WaitForLoad());
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Tweaks Music Volume error: " + e);
     }
 }
示例#4
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         if (Settings.MoveEnergyBar && SceneUtils.isGameScene(scene))
         {
             StartCoroutine(WaitForLoad());
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Tweaks (EnergyBar) done f****d up: " + e);
     }
 }
示例#5
0
        public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            Plugin.Log("TimeSpentClock SceneManagerOnActiveSceneChanged: " + arg0.name + " " + scene.name, Plugin.LogLevel.DebugOnly);
            try
            {
                if (SceneUtils.isMenuScene(scene) && _TimeSpentClockCanvas == null)
                {
                    Plugin.Log("Creating the TimeSpentClock object... ", Plugin.LogLevel.DebugOnly);
                    _TimeSpentClockCanvas = new GameObject();
                    DontDestroyOnLoad(_TimeSpentClockCanvas);
                    _TimeSpentClockCanvas.AddComponent <Canvas>();

                    _TimeSpentClockCanvas.name = "TimeSpentClock Canvas";
                    _TimeSpentClockCanvas.transform.position   = _TimePos;
                    _TimeSpentClockCanvas.transform.rotation   = _TimeRot;
                    _TimeSpentClockCanvas.transform.localScale = new Vector3(0.02f, 0.02f, 1.0f);

                    var textGO = new GameObject();
                    textGO.transform.SetParent(_TimeSpentClockCanvas.transform);
                    textGO.transform.localPosition = Vector3.zero;
                    textGO.transform.localRotation = Quaternion.identity;
                    textGO.transform.localScale    = Vector3.one;

                    _Text           = textGO.AddComponent <TextMeshProUGUI>();
                    _Text.name      = "TimeSpentClock Text";
                    _Text.alignment = Utilites.TextAlignUtil.textAlignFromString(Settings.TimeSpentClockAlignment);
                    _Text.fontSize  = _TimeSize;
                    _Text.text      = "";

                    _CUpdateTimeSpentClock = StartCoroutine(UpdateTimeSpentClock());

                    _TimeSpentClockCanvas.SetActive(Settings.ShowTimeSpentClock);
                }
            }
            catch (Exception e)
            {
                Plugin.Log("TimeSpentClock error: " + e, Plugin.LogLevel.DebugOnly);
            }

            if (_TimeSpentClockCanvas != null)
            {
                _IsPlayerIngame = SceneUtils.isGameScene(scene);
                if (_HideWhilePlaying)
                {
                    _TimeSpentClockCanvas.SetActive(!_IsPlayerIngame);
                }
            }
        }
示例#6
0
        public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            Plugin.Log("TimeSpentClock SceneManagerOnActiveSceneChanged: " + arg0.name + " " + scene.name, Plugin.LogLevel.DebugOnly);
            try
            {
                if (SceneUtils.isMenuScene(scene) && _TimeSpentClockCanvas == null)
                {
                    Plugin.Log("Creating the TimeSpentClock object... ", Plugin.LogLevel.DebugOnly);
                    _TimeSpentClockCanvas = new GameObject();
                    DontDestroyOnLoad(_TimeSpentClockCanvas);
                    _TimeSpentClockCanvas.AddComponent <Canvas>();

                    _TimeSpentClockCanvas.name = "TimeSpentClock Canvas";
                    _TimeSpentClockCanvas.transform.position = _TimePos;
                    _TimeSpentClockCanvas.transform.rotation = _TimeRot;

                    _Text      = CustomUI.BeatSaber.BeatSaberUI.CreateText(_TimeSpentClockCanvas.transform as RectTransform, "Clock Text", new Vector2(0, 0.05f));
                    _Text.name = "TimeSpentClock Text";

                    _Text.alignment             = Utilites.TextAlignUtil.textAlignFromString(Settings.TimeSpentClockAlignment);
                    _Text.color                 = Color.white;
                    _Text.transform.localScale *= .02f;
                    _Text.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1f);
                    _Text.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1f);
                    _Text.fontSize = _TimeSize;
                    _Text.text     = "";

                    _CUpdateTimeSpentClock = StartCoroutine(UpdateTimeSpentClock());

                    _TimeSpentClockCanvas.SetActive(Settings.ShowTimeSpentClock);
                }
            }
            catch (Exception e)
            {
                Plugin.Log("TimeSpentClock error: " + e, Plugin.LogLevel.DebugOnly);
            }

            if (_TimeSpentClockCanvas != null)
            {
                _IsPlayerIngame = SceneUtils.isGameScene(scene);
                if (_HideWhilePlaying)
                {
                    _TimeSpentClockCanvas.SetActive(!_IsPlayerIngame);
                }
            }
        }
示例#7
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         if (SceneUtils.isGameScene(scene))
         {
             if (TweakManager.IsPartyMode() && (Settings.OverrideJumpSpeed || Settings.OneColour || Settings.NoArrows || Settings.RemoveBombs))
             {
                 Plugin.Log("Party Mode Active", Plugin.LogLevel.Info);
                 StartCoroutine(WaitForLoad());
             }
             else
             {
                 Plugin.Log("Party Mode Not Active", Plugin.LogLevel.Info);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Tweaks (SongDataModifer) done f****d up: " + e);
     }
 }
示例#8
0
        public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            Plugin.Log("InGameClock SceneManagerOnActiveSceneChanged: " + arg0.name + " " + scene.name, Plugin.LogLevel.DebugOnly);
            try
            {
                if (SceneUtils.isMenuScene(scene) && ClockCanvas == null)
                {
                    Plugin.Log("Creating the clock object... ", Plugin.LogLevel.DebugOnly);
                    ClockCanvas = new GameObject();
                    DontDestroyOnLoad(ClockCanvas);
                    ClockCanvas.AddComponent <Canvas>();

                    ClockCanvas.name = "Clock Canvas";
                    ClockCanvas.transform.position = timePos;
                    ClockCanvas.transform.rotation = timeRot;
                    //         ClockCanvas.transform.localScale = new Vector3(0.02f, 0.02f, 1.0f);

                    text      = CustomUI.BeatSaber.BeatSaberUI.CreateText(ClockCanvas.transform as RectTransform, "Clock Text", new Vector2(0, 0.3f));
                    text.name = "Clock Text";

                    text.alignment             = Utilites.TextAlignUtil.textAlignFromString(Settings.ClockAlignment);
                    text.color                 = Color.white;
                    text.transform.localScale *= .02f;
                    text.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1f);
                    text.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1f);
                    text.fontSize = timeSize;
                    text.text     = "";

                    UpdateClock();

                    ClockCanvas.SetActive(Settings.ShowClock);
                }
                _IsPlayerIngame = SceneUtils.isGameScene(scene);
            }
            catch (Exception e)
            {
                Plugin.Log("InGameClock error: " + e, Plugin.LogLevel.DebugOnly);
            }
        }
示例#9
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         if (scene.name == "Menu")
         {
             if (model == null)
             {
                 model  = Resources.FindObjectsOfTypeAll <MainSettingsModel>().FirstOrDefault();
                 rumble = model.controllersRumbleEnabled;
             }
             model.controllersRumbleEnabled = rumble;
         }
         if (SceneUtils.isGameScene(scene) && Settings.OneColour && TweakManager.IsPartyMode())
         {
             StartCoroutine(WaitForLoad());
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Tweaks (OneColour) done f****d up: " + e);
     }
 }