Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tweaks for Beat Saber 0.13.0 #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,4 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/
BeatSaberTweaks/BeatSaberTweaks.csproj
49 changes: 29 additions & 20 deletions BeatSaberTweaks/BeatSaberTweaks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BeatSaberTweaks</RootNamespace>
<AssemblyName>BeatSaberTweaks</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand All @@ -34,55 +34,57 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BeatSaberCustomUI">
<HintPath>..\..\..\..\..\Program Files\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
<Reference Include="BeatSaberCustomUI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
</Reference>
<Reference Include="IllusionPlugin">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll</HintPath>
<Private>False</Private>
<Reference Include="BS_Utils">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BS_Utils.dll</HintPath>
</Reference>
<Reference Include="IPA.Loader">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TextMeshPro-1.0.55.2017.1.0b12">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\TextMeshPro-1.0.55.2017.1.0b12.dll</HintPath>
<Private>False</Private>
<Reference Include="Unity.TextMeshPro">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down Expand Up @@ -115,9 +117,16 @@
<Compile Include="Settings.cs" />
<Compile Include="TweakManager.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<EmbeddedResource Include="manifest.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /Y "$(TargetPath)" "F:\SteamLibrary\steamapps\common\Beat Saber\Plugins"</PostBuildEvent>
<PostBuildEvent>copy /Y "$(TargetDir)$(TargetFileName)" "C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins"</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties manifest_1json__JSONSchema="" />
</VisualStudio>
</ProjectExtensions>
</Project>
111 changes: 52 additions & 59 deletions BeatSaberTweaks/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IllusionPlugin;
using IPA;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace BeatSaberTweaks
{
public class Plugin : IPlugin
public class Plugin : IBeatSaberPlugin
{
public static string versionNumber = "4.3.1";
public static string versionNumber = "4.4.4";

public string Name => "Beat Saber Tweaks";
public string Version => versionNumber;

private bool _init = false;
private BeatmapCharacteristicSelectionViewController _characteristicViewController;
private static SoloFreePlayFlowCoordinator _soloFlowCoordinator;
private static PartyFreePlayFlowCoordinator _partyFlowCoordinator;

Expand All @@ -23,7 +24,6 @@ public class Plugin : IPlugin
public static bool party { get; private set; } = false;
public static bool saveRequested = false;

public static string _gameplayMode { get; private set; }
public enum LogLevel
{
DebugOnly = 0,
Expand All @@ -38,50 +38,8 @@ public void OnApplicationStart()

Settings.Load();
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<BeatmapCharacteristicSelectionViewController>().FirstOrDefault();
if (_characteristicViewController == null) return;

_characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent;
}

if (_soloFlowCoordinator == null)
{
_soloFlowCoordinator = Resources.FindObjectsOfTypeAll<SoloFreePlayFlowCoordinator>().FirstOrDefault();
if (_soloFlowCoordinator == null) return;
_soloDetailView = _soloFlowCoordinator.GetPrivateField<StandardLevelDetailViewController>("_levelDetailViewController");
_practiceViewController = _soloFlowCoordinator.GetPrivateField<PracticeViewController>("_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<PartyFreePlayFlowCoordinator>().FirstOrDefault();
}

if (saveRequested)
{
Settings.Save();
saveRequested = false;
}
}
}

private void _practiceViewController_didPressPlayButtonEvent()
{
Expand All @@ -95,37 +53,72 @@ private void _soloDetailView_didPressPlayButtonEvent(StandardLevelDetailViewCont
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()
{
Settings.Save();
}

public void OnLevelWasLoaded(int level)

public void OnUpdate()
{

}

public void OnLevelWasInitialized(int level)
public void OnFixedUpdate()
{
}

public void OnUpdate()
public static void Log(string input, Plugin.LogLevel logLvl)
{
if (logLvl >= LogLevel.Info || debug) Console.WriteLine("[BeatSaberTweaks]: " + input);
}

public void OnFixedUpdate()
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
{

}

public void OnSceneUnloaded(Scene scene)
{

}

public static void Log(string input, Plugin.LogLevel logLvl)
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
{
if (logLvl >= LogLevel.Info || debug) Console.WriteLine("[BeatSaberTweaks]: " + input);
if (nextScene.name == "MenuCore")
{


if (_soloFlowCoordinator == null)
{
_soloFlowCoordinator = Resources.FindObjectsOfTypeAll<SoloFreePlayFlowCoordinator>().FirstOrDefault();
if (_soloFlowCoordinator == null) return;
_soloDetailView = _soloFlowCoordinator.GetPrivateField<StandardLevelDetailViewController>("_levelDetailViewController");
_practiceViewController = _soloFlowCoordinator.GetPrivateField<PracticeViewController>("_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<PartyFreePlayFlowCoordinator>().FirstOrDefault();
}

if (saveRequested)
{
Settings.Save();
saveRequested = false;
}
}
}
}
}
4 changes: 2 additions & 2 deletions BeatSaberTweaks/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.3.1.0")]
[assembly: AssemblyFileVersion("4.3.1.0")]
[assembly: AssemblyVersion("4.5.1.0")]
[assembly: AssemblyFileVersion("4.5.1.0")]
4 changes: 2 additions & 2 deletions BeatSaberTweaks/TweakManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using VRUI;
using VRUIControls;
using TMPro;
using IllusionPlugin;
using IPA;
using CustomUI.BeatSaber;
using CustomUI.Settings;
using System.Reflection;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void Awake()

private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
{
if(arg0.name == "Menu")
if(arg0.name == "MenuCore")
CreateUI();
}

Expand Down
15 changes: 6 additions & 9 deletions BeatSaberTweaks/Tweaks/InGameClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,16 @@ public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
ClockCanvas.name = "Clock Canvas";
ClockCanvas.transform.position = timePos;
ClockCanvas.transform.rotation = timeRot;
ClockCanvas.transform.localScale = new Vector3(0.02f, 0.02f, 1.0f);
// ClockCanvas.transform.localScale = new Vector3(0.02f, 0.02f, 1.0f);

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

text = textGO.AddComponent<TextMeshProUGUI>();
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 = "";

Expand Down
14 changes: 6 additions & 8 deletions BeatSaberTweaks/Tweaks/IngameTimeSpentClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@ public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
_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 = 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");

Expand Down
2 changes: 1 addition & 1 deletion BeatSaberTweaks/Tweaks/MenuTweaks/ClickShockwave.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Text;
using IllusionPlugin;
using IPA;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
Expand Down
2 changes: 1 addition & 1 deletion BeatSaberTweaks/Tweaks/MenuTweaks/FireworksTweaks.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Text;
using IllusionPlugin;
using IPA;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
Expand Down
2 changes: 1 addition & 1 deletion BeatSaberTweaks/Tweaks/MenuTweaks/LevelsFailedTweak.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Text;
using IllusionPlugin;
using IPA;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
Expand Down
2 changes: 1 addition & 1 deletion BeatSaberTweaks/Tweaks/MusicVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IllusionPlugin;
using IPA;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
Expand Down
2 changes: 1 addition & 1 deletion BeatSaberTweaks/Tweaks/NoteHitVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IllusionPlugin;
using IPA;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
Expand Down
Loading