Exemplo n.º 1
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         //Console.WriteLine("Active: " + scene.name);
         if (SceneUtils.isMenuScene(scene))
         {
             Plugin.Log("TweakManager isMenuScene", Plugin.LogLevel.DebugOnly);
             _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
             //var _menuMasterViewController = Resources.FindObjectsOfTypeAll<StandardLevelSelectionFlowCoordinator>().First();
             //prompt = ReflectionUtil.GetPrivateField<SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController");
         }
         else
         {
             Plugin.Log("TweakManager not in menu scene", Plugin.LogLevel.DebugOnly);
         }
     }catch (Exception e)
     {
         Plugin.Log("TweakManager scene changed error: " + e, Plugin.LogLevel.Error);
     }
 }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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);
     }
 }
        public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            Plugin.Log("IngameTimeSpentClock SceneManagerOnActiveSceneChanged: " + arg0.name + " " + scene.name, Plugin.LogLevel.DebugOnly);
            try
            {
                if (SceneUtils.isMenuScene(scene) && _IngameTimeSpentClockCanvas == null)
                {
                    Plugin.Log("Creating the IngameTimeSpentClock object... ", Plugin.LogLevel.DebugOnly);
                    _IngameTimeSpentClockCanvas = new GameObject();
                    DontDestroyOnLoad(_IngameTimeSpentClockCanvas);
                    _IngameTimeSpentClockCanvas.AddComponent <Canvas>();

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

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

                    _Text           = textGO.AddComponent <TextMeshProUGUI>();
                    _Text.name      = "IngameTimeSpentClock Text";
                    _Text.alignment = Utilites.TextAlignUtil.textAlignFromString(Settings.IngameTimeSpentClockAlignment);
                    _Text.fontSize  = _TimeSize;
                    _Text.text      = _MessageTemplate.Replace("%TIME%", "0s");

                    _IngameTimeSpentClockCanvas.SetActive(Settings.ShowIngameTimeSpentClock);
                }
            }
            catch (Exception e)
            {
                Plugin.Log("IngameTimeSpentClock error: " + e, Plugin.LogLevel.DebugOnly);
            }

            if (_IngameTimeSpentClockCanvas != null)
            {
                _IsPlayerIngame = SceneUtils.isGameScene(scene);
                if (_HideWhilePlaying)
                {
                    _IngameTimeSpentClockCanvas.SetActive(!_IsPlayerIngame);
                }

                if (SceneUtils.isGameScene(scene))
                {
                    if (_CUpdateIngameTimeSpentClock != null)
                    {
                        StopCoroutine(_CUpdateIngameTimeSpentClock);
                    }
                    _CUpdateIngameTimeSpentClock = StartCoroutine(UpdateIngameTimeSpentClock());
                }
                else if (SceneUtils.isMenuScene(scene))
                {
                    if (_CUpdateIngameTimeSpentClock != null)
                    {
                        StopCoroutine(_CUpdateIngameTimeSpentClock);
                        _CUpdateIngameTimeSpentClock = null;
                    }
                }
            }
        }
Exemplo n.º 6
0
        public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            Plugin.Log("IngameTimeSpentClock SceneManagerOnActiveSceneChanged: " + arg0.name + " " + scene.name, Plugin.LogLevel.DebugOnly);
            try
            {
                if (SceneUtils.isMenuScene(scene) && _IngameTimeSpentClockCanvas == null)
                {
                    Plugin.Log("Creating the IngameTimeSpentClock object... ", Plugin.LogLevel.DebugOnly);
                    _IngameTimeSpentClockCanvas = new GameObject();
                    DontDestroyOnLoad(_IngameTimeSpentClockCanvas);
                    _IngameTimeSpentClockCanvas.AddComponent <Canvas>();

                    _IngameTimeSpentClockCanvas.name = "IngameTimeSpentClock Canvas";
                    _IngameTimeSpentClockCanvas.transform.position = _TimePos;
                    _IngameTimeSpentClockCanvas.transform.rotation = _TimeRot;

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

                    _Text.alignment             = Utilites.TextAlignUtil.textAlignFromString(Settings.IngameTimeSpentClockAlignment);
                    _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     = _MessageTemplate.Replace("%TIME%", "0s");

                    _IngameTimeSpentClockCanvas.SetActive(Settings.ShowIngameTimeSpentClock);
                }
            }
            catch (Exception e)
            {
                Plugin.Log("IngameTimeSpentClock error: " + e, Plugin.LogLevel.DebugOnly);
            }

            if (_IngameTimeSpentClockCanvas != null)
            {
                _IsPlayerIngame = SceneUtils.isGameScene(scene);
                if (_HideWhilePlaying)
                {
                    _IngameTimeSpentClockCanvas.SetActive(!_IsPlayerIngame);
                }

                if (SceneUtils.isGameScene(scene))
                {
                    if (_CUpdateIngameTimeSpentClock != null)
                    {
                        StopCoroutine(_CUpdateIngameTimeSpentClock);
                    }
                    _CUpdateIngameTimeSpentClock = StartCoroutine(UpdateIngameTimeSpentClock());
                }
                else if (SceneUtils.isMenuScene(scene))
                {
                    if (_CUpdateIngameTimeSpentClock != null)
                    {
                        StopCoroutine(_CUpdateIngameTimeSpentClock);
                        _CUpdateIngameTimeSpentClock = null;
                    }
                }
            }
        }