Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kylemc1413 committed Mar 15, 2019
1 parent ce19404 commit c3074c6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 44 deletions.
1 change: 0 additions & 1 deletion Beat Saber Utils/Beat Saber Utils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Gameplay\Gamemode.cs" />
<Compile Include="Gameplay\HarmonyPatches\BeatmapCharacteristicSelectionViewControllerDidActivate.cs" />
<Compile Include="Gameplay\HarmonyPatches\BeatmapCharacteristicSelectionViewControllerDidDeActivate.cs" />
<Compile Include="Gameplay\HarmonyPatches\BlahBlahGrabTheLevelData.cs" />
<Compile Include="Gameplay\HarmonyPatches\ResultsViewControllerSetDataToUI.cs" />
Expand Down
14 changes: 11 additions & 3 deletions Beat Saber Utils/Gameplay/Gamemode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace BS_Utils.Gameplay
{
public class Gamemode
{
internal static BeatmapCharacteristicSelectionViewController CharacteristicSelectionViewController;
internal static BeatmapCharacteristicSegmentedControlController CharacteristicSelectionViewController;
internal static SoloFreePlayFlowCoordinator SoloFreePlayFlowCoordinator;
internal static PartyFreePlayFlowCoordinator PartyFreePlayFlowCoordinator;
internal static MainMenuViewController MainMenuViewController;
Expand All @@ -26,6 +26,14 @@ public static void Init()
MainMenuViewController = Resources.FindObjectsOfTypeAll<MainMenuViewController>().FirstOrDefault();
if (MainMenuViewController == null) return;
MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent;

if (CharacteristicSelectionViewController == null)
{
CharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll<BeatmapCharacteristicSegmentedControlController>().FirstOrDefault();
if (CharacteristicSelectionViewController != null)
CharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent;
}

}
}

Expand All @@ -37,9 +45,9 @@ private static void MainMenuViewController_didFinishEvent(MainMenuViewController
IsPartyActive = false;
}

internal static void CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController arg1, BeatmapCharacteristicSO arg2)
internal static void CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSegmentedControlController arg1, BeatmapCharacteristicSO arg2)
{
Utilities.Logger.Log(arg2.characteristicName);
// Utilities.Logger.Log("Prev: " + GameMode + " New: " + arg2.characteristicName);
GameMode = arg2.characteristicName;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
using CustomUI.BeatSaber;
namespace BS_Utils.Gameplay.Harmony_Patches
{
[HarmonyPatch(typeof(BeatmapCharacteristicSelectionViewController),
new Type[] { typeof(VRUI.VRUIViewController.DeactivationType) })]
[HarmonyPatch("DidDeactivate", MethodType.Normal)]
[HarmonyPatch(typeof(BeatmapCharacteristicSegmentedControlController),
new Type[] {
typeof(IDifficultyBeatmapSet[]),
typeof(BeatmapCharacteristicSO)
})]

[HarmonyPatch("SetData", MethodType.Normal)]

class BeatmapCharacteristicSelectionViewControllerDidDeactivate
{
static void Postfix(BeatmapCharacteristicSelectionViewController __instance, VRUI.VRUIViewController.DeactivationType deactivationType)
static void Postfix(BeatmapCharacteristicSegmentedControlController __instance, IDifficultyBeatmapSet[] difficultyBeatmapSets, BeatmapCharacteristicSO selectedBeatmapCharacteristic)
{
if (deactivationType == VRUI.VRUIViewController.DeactivationType.RemovedFromHierarchy)
Gamemode.ResetGameMode();

Gamemode.CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent(__instance, __instance.selectedBeatmapCharacteristic);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Beat Saber Utils/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace BS_Utils
public class Plugin : IPlugin
{
public string Name => "Beat Saber Utils";
public string Version => "1.2.0";
public string Version => "1.2.1";
internal static bool patched = false;
internal static HarmonyInstance harmony;
public static Gameplay.LevelData LevelData = new Gameplay.LevelData();
Expand Down
4 changes: 2 additions & 2 deletions Beat Saber Utils/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("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]

0 comments on commit c3074c6

Please sign in to comment.