diff --git a/BeatSaberTweaks/BeatSaberTweaks.csproj b/BeatSaberTweaks/BeatSaberTweaks.csproj
index 4af389b..ac79ca3 100644
--- a/BeatSaberTweaks/BeatSaberTweaks.csproj
+++ b/BeatSaberTweaks/BeatSaberTweaks.csproj
@@ -34,11 +34,14 @@
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll
False
+
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll
+
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll
False
@@ -48,35 +51,35 @@
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\TextMeshPro-1.0.55.2017.1.0b12.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\TextMeshPro-1.0.55.2017.1.0b12.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AudioModule.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AudioModule.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.JSONSerializeModule.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.JSONSerializeModule.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UI.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UI.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll
False
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIModule.dll
+ ..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIModule.dll
False
@@ -88,7 +91,8 @@
-
+
+
@@ -102,4 +106,7 @@
+
+ copy /Y "$(TargetPath)" "F:\SteamLibrary\steamapps\common\Beat Saber\Plugins"
+
\ No newline at end of file
diff --git a/BeatSaberTweaks/Plugin.cs b/BeatSaberTweaks/Plugin.cs
index 9850dde..8ad29ad 100644
--- a/BeatSaberTweaks/Plugin.cs
+++ b/BeatSaberTweaks/Plugin.cs
@@ -2,19 +2,35 @@
using System.Collections.Generic;
using System.Linq;
using IllusionPlugin;
-
+using UnityEngine;
namespace BeatSaberTweaks
{
public class Plugin : IPlugin
{
public string Name => "Beat Saber Tweaks";
#if NewUI
- public string Version => "3.4";
+ public string Version => "4.0";
#else
public string Version => "3.3.2";
#endif
private bool _init = false;
+ private BeatmapCharacteristicSelectionViewController _characteristicViewController;
+ private static SoloFreePlayFlowCoordinator _soloFlowCoordinator;
+ private static PartyFreePlayFlowCoordinator _partyFlowCoordinator;
+
+ private static PracticeViewController _practiceViewController;
+ private static StandardLevelDetailViewController _soloDetailView;
+ private static bool debug = true;
+ public static bool party { get; private set; } = false;
+
+ public static string _gameplayMode { get; private set; }
+ public enum LogLevel
+ {
+ DebugOnly = 0,
+ Info = 1,
+ Error = 2
+ }
public void OnApplicationStart()
{
@@ -22,8 +38,68 @@ public void OnApplicationStart()
_init = true;
Settings.Load();
- SettingsUI.OnLoad();
+ //SettingsUI.OnLoad();
TweakManager.OnLoad();
+ UnityEngine.SceneManagement.SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
+ }
+
+ private void SceneManager_activeSceneChanged(UnityEngine.SceneManagement.Scene arg0, UnityEngine.SceneManagement.Scene arg1)
+ {
+ if(arg1.name == "Menu")
+ {
+ if (_characteristicViewController == null)
+ {
+ _characteristicViewController = Resources.FindObjectsOfTypeAll().FirstOrDefault();
+ if (_characteristicViewController == null) return;
+
+ _characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent;
+ }
+
+ if (_soloFlowCoordinator == null)
+ {
+ _soloFlowCoordinator = Resources.FindObjectsOfTypeAll().FirstOrDefault();
+ if (_soloFlowCoordinator == null) return;
+ _soloDetailView = _soloFlowCoordinator.GetPrivateField("_levelDetailViewController");
+ _practiceViewController = _soloFlowCoordinator.GetPrivateField("_practiceViewController");
+ if (_soloDetailView != null)
+ _soloDetailView.didPressPlayButtonEvent += _soloDetailView_didPressPlayButtonEvent;
+ else
+ Log("Detail View Null", Plugin.LogLevel.Info);
+ if (_practiceViewController != null)
+ _practiceViewController.didPressPlayButtonEvent += _practiceViewController_didPressPlayButtonEvent;
+ else
+ Log("Practice View Null", Plugin.LogLevel.Info);
+
+ }
+
+ if (_partyFlowCoordinator == null)
+ {
+ _partyFlowCoordinator = Resources.FindObjectsOfTypeAll().FirstOrDefault();
+ }
+
+
+ }
+ }
+
+ private void _practiceViewController_didPressPlayButtonEvent()
+ {
+ Log("Play Button Press ", Plugin.LogLevel.Info);
+ party = _partyFlowCoordinator.isActivated;
+ Log(party.ToString(), Plugin.LogLevel.Info);
+ }
+
+ private void _soloDetailView_didPressPlayButtonEvent(StandardLevelDetailViewController obj)
+ {
+ Log("Play Button Press " , Plugin.LogLevel.Info);
+ party = _partyFlowCoordinator.isActivated;
+ Log(party.ToString(), Plugin.LogLevel.Info);
+ }
+
+
+
+ private void _characteristicViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController arg1, BeatmapCharacteristicSO arg2)
+ {
+ _gameplayMode = arg2.characteristicName;
}
public void OnApplicationQuit()
@@ -46,5 +122,10 @@ public void OnUpdate()
public void OnFixedUpdate()
{
}
+
+ public static void Log(string input, Plugin.LogLevel logLvl)
+ {
+ if (logLvl >= LogLevel.Info || debug) Console.WriteLine("[! ! ! ! Beat Saber Tweaks ! ! ! !]: " + input);
+ }
}
}
diff --git a/BeatSaberTweaks/TweakManager.cs b/BeatSaberTweaks/TweakManager.cs
index 2081065..930c927 100644
--- a/BeatSaberTweaks/TweakManager.cs
+++ b/BeatSaberTweaks/TweakManager.cs
@@ -10,10 +10,8 @@
using VRUIControls;
using TMPro;
using IllusionPlugin;
-
-#if NewUI
-using BeatSaberUI;
-#endif
+using CustomUI.BeatSaber;
+using CustomUI.Settings;
namespace BeatSaberTweaks
{
@@ -23,8 +21,6 @@ public class TweakManager : MonoBehaviour
MainMenuViewController _mainMenuViewController = null;
SimpleDialogPromptViewController prompt = null;
- static MainGameSceneSetupData _mainGameSceneSetupData = null;
-
float carTime = 0;
public static void OnLoad()
@@ -42,7 +38,7 @@ public void Awake()
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
DontDestroyOnLoad(gameObject);
- Console.WriteLine("Tweak Manager started.");
+ Plugin.Log("Tweak Manager started.", Plugin.LogLevel.DebugOnly);
MoveEnergyBar.OnLoad(transform);
ScoreMover.OnLoad(transform);
@@ -60,11 +56,16 @@ public void Awake()
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
{
- //Console.WriteLine("Loaded: " + arg0.name);
+ if(arg0.name == "Menu")
+ CreateUI();
}
public void Update()
{
+ /*
+ * TODO
+ * This is to enable the flying cars easteregg.
+ * Is this even still in the game?
if (SettingsUI.isMenuScene(SceneManager.GetActiveScene()))
{
if (_mainMenuViewController.childViewController == null &&
@@ -85,8 +86,12 @@ public void Update()
carTime = 0;
}
}
+ */
}
+ /*
+ * TODO
+ * More flyingcars stuff
private void CarEvent(SimpleDialogPromptViewController viewController, bool ok)
{
viewController.didFinishEvent -= CarEvent;
@@ -97,20 +102,17 @@ private void CarEvent(SimpleDialogPromptViewController viewController, bool ok)
FlyingCar.startflyingCars = ok;
viewController.DismissModalViewController(null, false);
}
+ */
public static bool IsPartyMode()
{
- if (_mainGameSceneSetupData == null)
- {
- _mainGameSceneSetupData = Resources.FindObjectsOfTypeAll().FirstOrDefault();
- }
-
- if (_mainGameSceneSetupData == null)
- {
+ Plugin.Log(Plugin.party.ToString(), Plugin.LogLevel.Info);
+ if (Plugin.party)
+ return true;
+ else
return false;
- }
- return _mainGameSceneSetupData.gameplayMode == GameplayMode.PartyStandard;
+
}
public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
@@ -118,22 +120,26 @@ public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
try
{
//Console.WriteLine("Active: " + scene.name);
- if (SettingsUI.isMenuScene(scene))
+ if (SceneUtils.isMenuScene(scene))
{
+ Plugin.Log("TweakManager isMenuScene", Plugin.LogLevel.DebugOnly);
_mainMenuViewController = Resources.FindObjectsOfTypeAll().First();
- var _menuMasterViewController = Resources.FindObjectsOfTypeAll().First();
- prompt = ReflectionUtil.GetPrivateField(_menuMasterViewController, "_simpleDialogPromptViewController");
-
- CreateUI();
+ //var _menuMasterViewController = Resources.FindObjectsOfTypeAll().First();
+ //prompt = ReflectionUtil.GetPrivateField(_menuMasterViewController, "_simpleDialogPromptViewController");
+ }
+ else
+ {
+ Plugin.Log("TweakManager not in menu scene", Plugin.LogLevel.DebugOnly);
}
}catch (Exception e)
{
- Console.WriteLine("Tweaks (Manager) done fucked up: " + e);
+ Plugin.Log("TweakManager scene changed error: " + e, Plugin.LogLevel.Error);
}
}
private void CreateUI()
{
+ Plugin.Log("TweakManager creating the BSTweaks UI", Plugin.LogLevel.DebugOnly);
var subMenu2 = SettingsUI.CreateSubMenu("Interface Tweaks");
var energyBar = subMenu2.AddBool("Move Energy Bar");
@@ -290,6 +296,7 @@ private void Warning_didFinishEvent(SimpleDialogPromptViewController viewControl
}
*/
+ /*
private void Prompt_didFinishEvent(SimpleDialogPromptViewController viewController, bool ok)
{
viewController.didFinishEvent -= Prompt_didFinishEvent;
@@ -307,5 +314,6 @@ private void Prompt_didFinishEvent(SimpleDialogPromptViewController viewControll
}
viewController.DismissModalViewController(null, false);
}
+ */
}
}
diff --git a/BeatSaberTweaks/Tweaks/InGameClock.cs b/BeatSaberTweaks/Tweaks/InGameClock.cs
index 07139ca..aa3e888 100644
--- a/BeatSaberTweaks/Tweaks/InGameClock.cs
+++ b/BeatSaberTweaks/Tweaks/InGameClock.cs
@@ -27,6 +27,7 @@ public class InGameClock : MonoBehaviour
public static void OnLoad(Transform parent)
{
if (Instance != null) return;
+ Plugin.Log("Creating InGameClock.", Plugin.LogLevel.DebugOnly);
new GameObject("In Game Time").AddComponent().transform.parent = parent;
}
@@ -34,6 +35,7 @@ public void Awake()
{
if (Instance == null)
{
+ Plugin.Log("InGameClock awake.", Plugin.LogLevel.DebugOnly);
Instance = this;
SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
DontDestroyOnLoad(gameObject);
@@ -49,10 +51,12 @@ public void Awake()
public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
{
+ Plugin.Log("InGameClock SceneManagerOnActiveSceneChanged: " + arg0.name + " " + scene.name, Plugin.LogLevel.DebugOnly);
try
{
- if (SettingsUI.isMenuScene(scene) && ClockCanvas == null)
+ if (SceneUtils.isMenuScene(scene) && ClockCanvas == null)
{
+ Plugin.Log("Creating the clock object... ", Plugin.LogLevel.DebugOnly);
ClockCanvas = new GameObject();
DontDestroyOnLoad(ClockCanvas);
ClockCanvas.AddComponent