Exemple #1
0
 private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         if (SceneUtils.isMenuScene(scene))
         {
             StartCoroutine(WaitForLoad());
         }
     }
     catch (Exception e)
     {
         Plugin.Log("Tweaks (FireworksTweaks) messed up: " + e, Plugin.LogLevel.Error);
     }
 }
Exemple #2
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);
                }
            }
        }
Exemple #3
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);
                }
            }
        }
Exemple #4
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);
     }
 }
        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);
            }
        }