forked from Pespiri/CameraPlus
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Snow
committed
Mar 9, 2021
1 parent
953a050
commit b0449ac
Showing
5 changed files
with
97 additions
and
17 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
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,45 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using HarmonyLib; | ||
using LogLevel = IPA.Logging.Logger.Level; | ||
|
||
namespace CameraPlus.HarmonyPatches | ||
{ | ||
[HarmonyPatch] | ||
class LevelDataPatch | ||
{ | ||
public static IDifficultyBeatmap difficultyBeatmap; | ||
public static bool is360Level = false; | ||
public static bool isModdedMap = false; | ||
public static bool isWallMap = false; | ||
|
||
static SpawnRotationProcessor spawnRotationProcessor = new SpawnRotationProcessor(); | ||
|
||
static void Prefix(IDifficultyBeatmap difficultyBeatmap) | ||
{ | ||
#if DEBUG | ||
Logger.Log("Got level data!",LogLevel.Notice); | ||
#endif | ||
LevelDataPatch.difficultyBeatmap = difficultyBeatmap; | ||
|
||
is360Level = difficultyBeatmap.beatmapData.beatmapEventsData.Any( | ||
x => x.type.IsRotationEvent() && spawnRotationProcessor.RotationForEventValue(x.value) != 0f | ||
); | ||
} | ||
|
||
internal static void Reset() | ||
{ | ||
is360Level = isModdedMap = isWallMap = false; | ||
difficultyBeatmap = null; | ||
} | ||
|
||
[HarmonyTargetMethods] | ||
static IEnumerable<MethodBase> TargetMethods() | ||
{ | ||
foreach (var t in new Type[] { typeof(StandardLevelScenesTransitionSetupDataSO), typeof(MissionLevelScenesTransitionSetupDataSO), typeof(MultiplayerLevelScenesTransitionSetupDataSO) }) | ||
yield return t.GetMethod("Init", BindingFlags.Instance | BindingFlags.Public); | ||
} | ||
} | ||
} |
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