using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using CameraTools.BigZoom;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityStandardAssets.ImageEffects;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CameraTools")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("CameraTools")]
[assembly: AssemblyTitle("CameraTools")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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;
}
}
}
public enum CameraMove
{
PanToRight,
PanToLeft,
PanToUp,
PanToDown,
ZoomIn,
ZoomOut,
BigPanToRight,
BigPanToLeft,
BigZoomOut,
PanDiagonalToLeft,
PanDiagonalToRight
}
public static class CameraMoves
{
public static Dictionary<CameraMove, KeyCode> Keymap = new Dictionary<CameraMove, KeyCode>
{
{
CameraMove.PanToRight,
(KeyCode)49
},
{
CameraMove.PanToLeft,
(KeyCode)50
},
{
CameraMove.ZoomIn,
(KeyCode)51
},
{
CameraMove.ZoomOut,
(KeyCode)52
},
{
CameraMove.BigPanToRight,
(KeyCode)53
},
{
CameraMove.BigPanToLeft,
(KeyCode)54
},
{
CameraMove.BigZoomOut,
(KeyCode)55
},
{
CameraMove.PanToUp,
(KeyCode)117
},
{
CameraMove.PanToDown,
(KeyCode)105
},
{
CameraMove.PanDiagonalToLeft,
(KeyCode)111
},
{
CameraMove.PanDiagonalToRight,
(KeyCode)112
}
};
public static Dictionary<CameraMove, Action<Camera, Vector3, float>> Moves = new Dictionary<CameraMove, Action<Camera, Vector3, float>>
{
{
CameraMove.PanToRight,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * 20f, 0f, 0f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.PanToLeft,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * -20f, 0f, 0f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.ZoomIn,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3(0f, 0f, t * 10f);
}
},
{
CameraMove.ZoomOut,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3(0f, t * 6f, t * -30f);
}
},
{
CameraMove.BigPanToRight,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * 80f, 0f, -25f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.BigPanToLeft,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * -80f, 0f, -25f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.BigZoomOut,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3(0f, t * 70f, 30f);
cam.orthographic = true;
cam.orthographicSize = 10f + t * 85f;
}
},
{
CameraMove.PanToUp,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3(0f, (t - 0.5f) * 20f, 0f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.PanToDown,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * -20f, 0f, 0f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.PanDiagonalToLeft,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * 20f, (t - 0.5f) * 20f, 0f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
},
{
CameraMove.PanDiagonalToRight,
delegate(Camera cam, Vector3 target, float t)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
((Component)cam).gameObject.transform.position = target + new Vector3((t - 0.5f) * -20f, (t - 0.5f) * 20f, 0f);
((Component)cam).gameObject.transform.LookAt(new Vector3(target.x, target.y, 0f));
}
}
};
}
namespace CameraTools
{
[BepInPlugin("CameraTools", "Camera Tools", "0.0.2")]
public class CameraTools : BaseUnityPlugin
{
public const string PLUGIN_GUID = "CameraTools";
public const string PLUGIN_NAME = "Camera Tools";
public const string PLUGIN_VERSION = "0.0.2";
private void Awake()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"CameraTools 0.0.2 loaded!");
GameObject val = new GameObject("CameraTools Runner");
val.AddComponent<CameraToolsRunner>();
Object.DontDestroyOnLoad((Object)(object)val);
GameObject val2 = new GameObject("CameraTools BigZoom");
val2.AddComponent<BigZoomLoader>();
Object.DontDestroyOnLoad((Object)(object)val2);
}
}
public class CameraToolsRunner : MonoBehaviour
{
private Camera tcCamera;
private Camera cam;
private const float duration = 24f;
private float delayTime = 0f;
private float time = 0f;
private bool playing = false;
private CameraMove activeMove;
private Vector3 targetPos = Vector3.zero;
private GameObject vignette;
public void Update()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
if (playing)
{
if (time > 24f)
{
Stop();
return;
}
float arg = Mathf.SmoothStep(0f, 1f, time / 24f);
CameraMoves.Moves[activeMove](cam, targetPos, arg);
if (delayTime <= 0f)
{
time += Time.deltaTime;
}
else
{
delayTime -= Time.deltaTime;
}
return;
}
foreach (KeyValuePair<CameraMove, KeyCode> item in CameraMoves.Keymap)
{
if (Input.GetKeyDown(item.Value))
{
Play(item.Key);
return;
}
}
if (Input.GetKeyDown((KeyCode)48))
{
if ((Object)(object)vignette == (Object)null)
{
FindVignette();
}
vignette.SetActive(!vignette.activeSelf);
}
if (Input.GetKeyDown((KeyCode)57))
{
CameraBlurPlane component = ((Component)cam).GetComponent<CameraBlurPlane>();
((Behaviour)component).enabled = !((Behaviour)component).enabled;
}
if (Input.GetKeyDown((KeyCode)56))
{
delayTime = 5f;
}
if (Input.GetKeyDown((KeyCode)98))
{
BigZoomLoader component2 = GameObject.Find("CameraTools BigZoom").GetComponent<BigZoomLoader>();
component2.Load();
}
if (Input.GetKeyDown((KeyCode)110))
{
BigZoomLoader component3 = GameObject.Find("CameraTools BigZoom").GetComponent<BigZoomLoader>();
component3.Optimize();
}
}
private void FindVignette()
{
vignette = GameObject.Find("Vignette");
}
private void DisableRedGlow()
{
(from obj in Object.FindObjectsByType<Transform>((FindObjectsSortMode)0)
where ((Object)((Component)obj).gameObject).name.StartsWith("Vignette Cutout")
select obj).ToList().ForEach(delegate(Transform obj)
{
((Component)obj).gameObject.SetActive(false);
});
}
private void CreateCamera()
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
tcCamera = Camera.main;
GameObject val = Object.Instantiate<GameObject>(((Component)tcCamera).gameObject);
Object.DontDestroyOnLoad((Object)(object)val);
Object.DestroyImmediate((Object)(object)val.GetComponent<FastNoise>());
Object.DestroyImmediate((Object)(object)val.GetComponent<BloomOptimized>());
Object.DestroyImmediate((Object)(object)val.GetComponent<BrightnessEffect>());
Object.DestroyImmediate((Object)(object)val.GetComponent<Camera>());
Object.Destroy((Object)(object)val.GetComponent<CameraController>());
Object.Destroy((Object)(object)val.GetComponent<tk2dCamera>());
cam = val.AddComponent<Camera>();
cam.ResetProjectionMatrix();
cam.ResetCullingMatrix();
cam.fieldOfView = tcCamera.fieldOfView;
cam.depth = tcCamera.depth;
cam.transparencySortMode = (TransparencySortMode)3;
cam.transparencySortAxis = new Vector3(0f, 0f, 1f);
}
public void Play(CameraMove move)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
if (!playing)
{
playing = true;
time = 0f;
if ((Object)(object)cam == (Object)null)
{
CreateCamera();
}
DisableRedGlow();
((Behaviour)tcCamera).enabled = false;
((Behaviour)cam).enabled = true;
cam.backgroundColor = Color.black;
activeMove = move;
((Component)cam).gameObject.transform.position = ((Component)tcCamera).gameObject.transform.position;
((Component)cam).gameObject.transform.rotation = ((Component)tcCamera).gameObject.transform.rotation;
cam.fieldOfView = tcCamera.fieldOfView;
targetPos = ((Component)cam).gameObject.transform.position;
}
}
public void Stop()
{
if (playing)
{
playing = false;
((Behaviour)tcCamera).enabled = true;
((Behaviour)cam).enabled = false;
cam.orthographic = false;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "CameraTools";
public const string PLUGIN_NAME = "CameraTools";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace CameraTools.BigZoom
{
public class BigZoomLoader : MonoBehaviour
{
private List<string> Loaded = new List<string>();
private List<string> Moved = new List<string>();
public async void Load()
{
TransitionPoint[] points = Object.FindObjectsByType<TransitionPoint>((FindObjectsSortMode)0);
TransitionPoint[] array = points;
foreach (TransitionPoint point in array)
{
if (point.isADoor)
{
continue;
}
List<string> loaded = Loaded;
Scene scene2 = ((Component)point).gameObject.scene;
if (!loaded.Contains(((Scene)(ref scene2)).name))
{
List<string> loaded2 = Loaded;
scene2 = ((Component)point).gameObject.scene;
loaded2.Add(((Scene)(ref scene2)).name);
}
if (Loaded.Contains(point.targetScene))
{
continue;
}
Loaded.Add(point.targetScene);
AsyncOperationHandle<IList<IResourceLocation>> handle = point.targetSceneResourceHandle;
handle.WaitForCompletion();
if (!handle.IsValid())
{
continue;
}
IResourceLocation sceneLocation = handle.Result.First();
AsyncOperationHandle<SceneInstance> sceneHandle = Addressables.LoadSceneAsync(sceneLocation, (LoadSceneMode)1, true, 100);
sceneHandle.WaitForCompletion();
SceneInstance scene = sceneHandle.Result;
Vector3 pointPos = ((Component)point).gameObject.transform.position;
string pointTarget = point.entryPoint;
string pointName = ((Object)((Component)point).gameObject).name;
Object.Destroy((Object)(object)point);
await Task.Delay(300);
TransitionPoint[] newPoints = Object.FindObjectsByType<TransitionPoint>((FindObjectsSortMode)0);
TransitionPoint[] array2 = newPoints;
foreach (TransitionPoint newPoint in array2)
{
if (((Object)((Component)newPoint).gameObject).name != pointTarget || pointName != newPoint.entryPoint)
{
continue;
}
Vector3 delta = ((Component)newPoint).gameObject.transform.position - pointPos;
List<string> moved = Moved;
scene2 = ((SceneInstance)(ref scene)).Scene;
if (!moved.Contains(((Scene)(ref scene2)).name))
{
List<string> moved2 = Moved;
scene2 = ((SceneInstance)(ref scene)).Scene;
moved2.Add(((Scene)(ref scene2)).name);
scene2 = ((SceneInstance)(ref scene)).Scene;
GameObject[] rootGameObjects = ((Scene)(ref scene2)).GetRootGameObjects();
foreach (GameObject go in rootGameObjects)
{
Transform transform = go.transform;
transform.position -= delta;
}
}
break;
}
scene = default(SceneInstance);
}
MeshRenderer[] array3 = Object.FindObjectsByType<MeshRenderer>((FindObjectsSortMode)0);
foreach (MeshRenderer mr in array3)
{
((Renderer)mr).enabled = false;
}
Transform[] array4 = Object.FindObjectsByType<Transform>((FindObjectsSortMode)0);
foreach (Transform obj in array4)
{
if (((Object)((Component)obj).gameObject).name.ToLower().Contains("chunk"))
{
((Component)obj).gameObject.SetActive(false);
}
if (((Object)((Component)obj).gameObject).name.ToLower().Contains("fader"))
{
((Component)obj).gameObject.SetActive(false);
}
if (((Object)((Component)obj).gameObject).name.ToLower().Contains("black"))
{
((Component)obj).gameObject.SetActive(false);
}
if (((Object)((Component)obj).gameObject).name.ToLower().Contains("border"))
{
((Component)obj).gameObject.SetActive(false);
}
}
}
public void Optimize()
{
SpriteRenderer[] array = Object.FindObjectsByType<SpriteRenderer>((FindObjectsSortMode)0);
SpriteRenderer[] array2 = array;
foreach (SpriteRenderer val in array2)
{
if ((Object)(object)((Renderer)val).material != (Object)null)
{
((Renderer)val).material.enableInstancing = true;
}
}
}
}
}