using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("MirrorWorld")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fa2710b47b21ecf42d8effcf3b912b6f01fc77ad")]
[assembly: AssemblyProduct("MirrorWorld")]
[assembly: AssemblyTitle("MirrorWorld")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 MirrorWorld
{
public class CameraMirrorer : MonoBehaviour
{
private Material _material;
private void Awake()
{
_material = Plugin.Instance.MirrorMaterial;
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
Graphics.Blit((Texture)(object)src, dest, _material);
}
public static void AddToCamera(Camera camera)
{
if (!((Object)(object)((Component)camera).GetComponent<CameraMirrorer>() != (Object)null))
{
((Component)camera).gameObject.AddComponent<CameraMirrorer>();
}
}
private void OnAudioFilterRead(float[] data, int channels)
{
if (channels == 2)
{
for (int i = 0; i < data.Length; i += 2)
{
float num = data[i];
data[i] = data[i + 1];
data[i + 1] = num;
}
}
}
}
[BepInPlugin("MirrorWorld", "MirrorWorld", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
public Material MirrorMaterial;
private void Awake()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "shader"));
MirrorMaterial = val.LoadAsset<Material>("MirrorMaterial");
new Harmony("MirrorWorld").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MirrorWorld is loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "MirrorWorld";
public const string PLUGIN_NAME = "MirrorWorld";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace MirrorWorld.Patches
{
[HarmonyPatch(typeof(GameplayCamera))]
internal static class GameplayCameraPatch
{
[HarmonyPrefix]
[HarmonyPatch("CalculateOrbitInput")]
private static bool CalculateOrbitInput_Prefix(float camXInput, float camYInput, GameplayCamera __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
__instance.orbitInput = __instance.CalculateNormalOrbitInput(0f - camXInput, camYInput);
return false;
}
}
[HarmonyPatch(typeof(GraffitiGame))]
internal static class GraffitiGamePatch
{
[HarmonyPrefix]
[HarmonyPatch("TargetingUpdate")]
private static void TargetingUpdate_Prefix(GraffitiGame __instance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
__instance.aim = Vector2.op_Implicit(new Vector2(0f - __instance.aim.x, __instance.aim.y));
}
[HarmonyPostfix]
[HarmonyPatch("InitVisual")]
private static void InitVisual_Postfix(GraffitiGame __instance)
{
Camera[] componentsInChildren = ((Component)((Component)__instance).transform).GetComponentsInChildren<Camera>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
CameraMirrorer.AddToCamera(componentsInChildren[i]);
}
}
[HarmonyPostfix]
[HarmonyPatch("SetState")]
private static void SetState_Postfix(GraffitiGame __instance, GraffitiGameState setState)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if ((int)setState != 0)
{
Camera[] componentsInChildren = ((Component)((Component)__instance.gSpot).transform).GetComponentsInChildren<Camera>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
CameraMirrorer.AddToCamera(componentsInChildren[i]);
}
}
}
}
[HarmonyPatch(typeof(Mapcontroller))]
internal class MapcontrollerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void Awake_Postfix(Mapcontroller __instance)
{
CameraMirrorer.AddToCamera(__instance.Camera);
}
}
[HarmonyPatch(typeof(PauseMenu))]
internal class PauseMenuPatch
{
[HarmonyPrefix]
[HarmonyPatch("UpdateMapController")]
private static bool UpdateMapController_Prefix(PauseMenu __instance)
{
Mapcontroller mapControllerInstance = __instance.mapControllerInstance;
mapControllerInstance.CameraZoom += __instance.gameInput.GetAxis(67, 0) * Time.deltaTime;
if (__instance.dragCamera || __instance.gameInput.IsPlayerControllerJoystick(0))
{
Mapcontroller mapControllerInstance2 = __instance.mapControllerInstance;
mapControllerInstance2.CameraRotateYOffset -= __instance.gameInput.GetAxis(13, 0) * 80f * Time.deltaTime;
Mapcontroller mapControllerInstance3 = __instance.mapControllerInstance;
mapControllerInstance3.CameraRotateXOffset += __instance.gameInput.GetAxis(14, 0) * 80f * Time.deltaTime;
}
return false;
}
}
[HarmonyPatch(typeof(PlayerPhoneCameras))]
internal static class PlayerPhoneCamerasPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void Awake_Postfix(PlayerPhoneCameras __instance)
{
Camera[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Camera>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
CameraMirrorer.AddToCamera(componentsInChildren[i]);
}
}
}
[HarmonyPatch(typeof(UserInputHandler))]
internal static class UserInputHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("PollInputs")]
private static void PollInputs_Postfix(ref InputBuffer inputBuffer, ref InputBuffer __result)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
inputBuffer.moveAxisX = 0f - inputBuffer.moveAxisX;
__result = inputBuffer;
}
}
[HarmonyPatch(typeof(WorldHandler))]
internal static class WorldHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("SetCurrentCamera")]
private static void SetCurrentCamera_Postfix(Camera camera)
{
CameraMirrorer.AddToCamera(camera);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}