using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Bossa.Cinematika; using Bossa.Cinematika.Controllers; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem; using Microsoft.CodeAnalysis; using UISystem; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using WildSkies.Camera; using WildSkies.Mediators; using WildSkies.Service; using Wildskies.UI.Hud; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("CinematicCameraToggle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Nines (Natives)")] [assembly: AssemblyFileVersion("1.0.9.0")] [assembly: AssemblyInformationalVersion("1.0.9")] [assembly: AssemblyProduct("CinematicCameraToggle")] [assembly: AssemblyTitle("CinematicCameraToggle")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CinematicCameraToggle { [BepInPlugin("CinematicCameraToggle", "CinematicCameraToggle", "1.0.9")] public class Plugin : BasePlugin { internal static ManualLogSource Log; internal static Harmony harmonyInstance; private static bool _enableCameraSwitch = true; private static CinematikaController _activeController = null; public override void Load() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = ((BasePlugin)this).Log; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("CinematicCameraToggle"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null); } public override bool Unload() { Harmony obj = harmonyInstance; if (obj != null) { obj.UnpatchSelf(); } return true; } private static void ShowNotification(string text) { if (string.IsNullOrEmpty(text)) { return; } IUIService uiService = ProjectContextInstaller.ResolveObject(); IUIService obj = uiService; if (obj == null || !obj.IsServiceReady) { return; } Action action = delegate(HudElement hudElement) { if (!((Object)(object)hudElement == (Object)null)) { uiService.HUDManager.HudElementLoaded(hudElement, (IPayload)null, (Action)null); NotificationHud val = ((Il2CppObjectBase)hudElement).Cast(); NotificationPopupObject notificationPopup = val.GetNotificationPopup(); notificationPopup._icon.sprite = notificationPopup._fallbackIcon; float durationRemaining = (notificationPopup._displayDuration = val._viewModel.PopupDisplayDuration); notificationPopup._durationRemaining = durationRemaining; notificationPopup._fadeOutSpeedModifier = val._viewModel.PopupDisplayFadeSpeedMultiplier; notificationPopup._callback = val.OnPopupExpired; ((Component)notificationPopup._shineAnimator).gameObject.SetActive(false); notificationPopup._message.text = text; val._currentNotification = notificationPopup; val._activeNotifications.Enqueue(val._currentNotification); } }; if (uiService.HUDManager._hudElementsInMemory.ContainsKey((UIHudType)14)) { action(uiService.HUDManager._hudElementsInMemory[(UIHudType)14]); } else { uiService.HUDManager.LoadHudElement((UIHudType)14, Action.op_Implicit(action)); } } [HarmonyPatch(typeof(UIInputMediator), "Update")] [HarmonyPrefix] public static void UIInputMediator_Update(UIInputMediator __instance) { //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (!__instance._ui.IsServiceReady || __instance._sceneService.AreWeLoadingOrInLobby() || __instance._ui.PanelManager.IsPanelShowing((UIPanelType)16)) { return; } if (_enableCameraSwitch && Keyboard.current.altKey.isPressed && ((ButtonControl)Keyboard.current.cKey).wasPressedThisFrame) { _enableCameraSwitch = false; InputService input = __instance._input; input._inputMode = (InputMode)(input._inputMode ^ (8 | ((((Enum)__instance._input._inputMode).HasFlag((Enum)(object)(InputMode)64) || ((Enum)__instance._input._inputMode).HasFlag((Enum)(object)(InputMode)4)) ? 2 : 0))); __instance._input.ResolveInputMode(); bool flag = ((Enum)__instance._input._inputMode).HasFlag((Enum)(object)(InputMode)8); CameraManager val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { ShowNotification("Cannot find the Dynamika Camera Manager"); } else { bool isPressed = Keyboard.current.shiftKey.isPressed; if (flag) { _activeController = val._activeController; val.SetCamera(isPressed ? Il2CppType.Of() : Il2CppType.Of(), false); } else { val.SetCamera(((Object)_activeController).GetIl2CppType(), false); _activeController = null; } ShowNotification("Switched to " + ((!flag) ? "Dynamika" : (isPressed ? "Spectator" : "Cinematic")) + " camera"); __instance._hudHidden = flag; __instance._ui.HUDManager.HudCanvasGroup.alpha = ((!__instance._hudHidden) ? 1 : 0); } } if (!__instance._ui.PanelManager.IsPanelShowing((UIPanelType)16) && (Object)(object)_activeController != (Object)null && (int)__instance._input._inputMode != 8) { __instance._input._priorityInput = (InputMode)8; __instance._input.ResolveInputMode(); } if (!_enableCameraSwitch && (!Keyboard.current.altKey.isPressed || !((ButtonControl)Keyboard.current.cKey).isPressed)) { _enableCameraSwitch = true; if (!((Enum)__instance._input._inputMode).HasFlag((Enum)(object)(InputMode)8)) { __instance._input.SetDefaultPriorityInput(); __instance._input.ResolveInputMode(); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "CinematicCameraToggle"; public const string PLUGIN_NAME = "CinematicCameraToggle"; public const string PLUGIN_VERSION = "1.0.9"; } }