-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from legoandmars/note-layer
2.2.0 update
- Loading branch information
Showing
25 changed files
with
777 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using HarmonyLib; | ||
using System.Reflection; | ||
|
||
namespace CustomNotes.HarmonyPatches | ||
{ | ||
/// <summary> | ||
/// Apply and remove all of our Harmony patches through this class | ||
/// </summary> | ||
public class CustomNotesPatches | ||
{ | ||
private static Harmony instance; | ||
|
||
public static bool IsPatched { get; private set; } | ||
public const string InstanceId = "com.legoandmars.beatsaber.customnotes"; | ||
|
||
internal static void ApplyHarmonyPatches() | ||
{ | ||
if (!IsPatched) | ||
{ | ||
if (instance == null) | ||
{ | ||
instance = new Harmony(InstanceId); | ||
} | ||
|
||
instance.PatchAll(Assembly.GetExecutingAssembly()); | ||
IsPatched = true; | ||
} | ||
} | ||
|
||
internal static void RemoveHarmonyPatches() | ||
{ | ||
if (instance != null && IsPatched) | ||
{ | ||
instance.UnpatchAll(InstanceId); | ||
IsPatched = false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using CustomNotes.Utilities; | ||
using HarmonyLib; | ||
using IPA.Loader; | ||
using System; | ||
using System.Reflection; | ||
using UnityEngine; | ||
|
||
namespace CustomNotes.HarmonyPatches | ||
{ | ||
[HarmonyPatch] | ||
internal class CameraPlusPatch | ||
{ | ||
private static MethodBase TargetMethod() | ||
{ | ||
PluginMetadata cameraPlus = PluginManager.GetPluginFromId("CameraPlus"); | ||
// Patch should only trigger if CameraPlus is installed and a pre-layerfix version | ||
if (cameraPlus != null && cameraPlus.Assembly.GetName().Version <= new Version("4.7.2")) { | ||
return cameraPlus.Assembly.GetType("CameraPlus.CameraPlusBehaviour").GetMethod("SetCullingMask", BindingFlags.Instance | BindingFlags.NonPublic); | ||
} else return null; | ||
} | ||
|
||
private static void Postfix(ref Camera ____cam) | ||
{ | ||
LayerUtils.SetCamera(____cam, LayerUtils.CameraView.ThirdPerson); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.