Decompiled source of SVD Dragunov v1.0.0

SVD_Dragunov.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite.Api;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public class BipodAThon : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
namespace MeatKit
{
	[ExecuteInEditMode]
	public class AdvancedIconCamera : MonoBehaviour
	{
		[Header("Hover over variables to show additional tooltips.")]
		[Tooltip("Use this to trigger the capture of an icon IN PLAYMODE ONLY!")]
		public KeyCode iconCaptureKey;

		[Tooltip("Use this checkbox like a button to trigger the capture of an icon (Editor or Playmode).")]
		public bool iconCaptureButton;

		[Tooltip("Path to icons folder (without \"Assets\" in the beginning).")]
		public string path = "Icons";

		[Tooltip("Name of the generated Icon without a file extension (no \".png\" required).")]
		public string iconName = "ExampleIcon";

		[Tooltip("The depth texture mode of the camera. Some effects will require either DepthNormals or Depth to work correctly")]
		public DepthTextureMode CameraDepthMode = (DepthTextureMode)2;

		[Tooltip("Material that determines the post effect of the image")]
		public List<Material> effectMaterials = new List<Material>();

		[Tooltip("The background image that will be applied in areas with full transparency")]
		public Texture2D background;

		[Tooltip("Current object to take an Icon of.")]
		public GameObject ObjectToIconize;

		[Tooltip("Use this list instead if you wanna make icons in bulk automatically.")]
		public GameObject[] ObjectsToIconize;

		[Tooltip("Scene objects to stay active during image creation.")]
		public GameObject[] SceneObjectsToStayActive;

		[Tooltip("Size added to actual object size. Adds padding at the edges of the icon.")]
		public float Oversize = 0.001f;

		[Tooltip("Distance the camera will be placed at from the object. Only used in orthographic camera mode to make sure no camera clipping happens.")]
		public float OrthographicCameraDistance = 2f;

		[Tooltip("If checked, it will move to the object before taking a picture.")]
		public bool MoveToObject = true;

		[HideInInspector]
		public RenderTexture renderTexture;

		private Camera _camera;

		private Dictionary<GameObject, bool> rootGameObjects;

		private GameObject _temp = null;

		private GameObject _currentObject = null;

		private Vector3 _targetPos;

		private int _currentPicture = 0;

		private int _lastPicture = -1;

		private bool _takingPictures = false;

		private bool _takingSinglePicture = false;

		private Dictionary<byte[], string> _pictures;

		public Camera thisCamera
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_camera))
				{
					_camera = ((Component)this).gameObject.GetComponent<Camera>();
				}
				return _camera;
			}
		}

		private void Update()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(iconCaptureKey))
			{
				CaptureAndSave();
			}
		}

		private void OnPreRender()
		{
			if (_takingPictures)
			{
				Debug.Log((object)"Say Cheese!");
				Debug.Log((object)("ObjectToIconize: " + ((Object)ObjectToIconize).name));
			}
			if (_takingSinglePicture)
			{
				Debug.Log((object)"Say Cheese!");
			}
		}

		private void OnPostRender()
		{
			if (_takingPictures)
			{
				_currentPicture++;
				_takingPictures = false;
			}
			if (_takingSinglePicture)
			{
				UnhideOtherSceneObjects();
				_takingSinglePicture = false;
			}
		}

		private void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			if ((Object)(object)renderTexture != (Object)null)
			{
				RenderTexture.ReleaseTemporary(renderTexture);
			}
			if (effectMaterials.Count > 1)
			{
				List<RenderTexture> list = new List<RenderTexture>();
				for (int i = 0; i < effectMaterials.Count; i++)
				{
					RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 24, (RenderTextureFormat)0, (RenderTextureReadWrite)2);
					if (i == 0)
					{
						Graphics.Blit((Texture)(object)source, temporary, effectMaterials[i]);
					}
					else if (i == effectMaterials.Count - 1)
					{
						Graphics.Blit((Texture)(object)list.Last(), destination, effectMaterials[i]);
					}
					else
					{
						Graphics.Blit((Texture)(object)list.Last(), temporary, effectMaterials[i]);
					}
					list.Add(temporary);
				}
				for (int j = 0; j < list.Count; j++)
				{
					RenderTexture.ReleaseTemporary(list[j]);
				}
			}
			else if (effectMaterials.Count == 1)
			{
				Graphics.Blit((Texture)(object)source, destination, effectMaterials[0]);
			}
			else
			{
				Graphics.Blit((Texture)(object)source, destination);
			}
			renderTexture = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 24, (RenderTextureFormat)0, (RenderTextureReadWrite)2);
			Graphics.Blit((Texture)(object)destination, renderTexture);
		}

		public Sprite CaptureAndSave()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected O, but got Unknown
			HideOtherSceneObjects();
			_takingSinglePicture = true;
			RenderTexture.active = renderTexture;
			Texture2D val = new Texture2D(((Texture)renderTexture).width, ((Texture)renderTexture).height);
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)renderTexture).width, (float)((Texture)renderTexture).height), 0, 0);
			val.Apply();
			val = FlipTexture(val);
			if ((Object)(object)background != (Object)null)
			{
				val = AddBackground(val, background);
			}
			byte[] bytes = val.EncodeToPNG();
			string text;
			string text2;
			if ((Object)(object)ObjectToIconize != (Object)null)
			{
				text = Application.dataPath + "/" + path + "/" + ((Object)ObjectToIconize).name + "_icon.png";
				text2 = "Assets/" + path + "/" + ((Object)ObjectToIconize).name + "_icon.png";
			}
			else
			{
				text = Application.dataPath + "/" + path + "/" + iconName + ".png";
				text2 = "Assets/" + path + "/" + iconName + ".png";
			}
			File.WriteAllBytes(text, bytes);
			AssetDatabase.ImportAsset(text2, (ImportAssetOptions)1);
			TextureImporter val2 = (TextureImporter)AssetImporter.GetAtPath(text2);
			val2.isReadable = true;
			val2.textureType = (TextureImporterType)8;
			val2.spriteImportMode = (SpriteImportMode)1;
			val2.alphaSource = (TextureImporterAlphaSource)1;
			val2.alphaIsTransparency = true;
			val2.mipmapEnabled = false;
			val2.wrapMode = (TextureWrapMode)1;
			EditorUtility.SetDirty((Object)(object)val2);
			((AssetImporter)val2).SaveAndReimport();
			AssetDatabase.Refresh();
			return AssetDatabase.LoadAssetAtPath<Sprite>(text2);
		}

		private void Capture()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			_takingPictures = true;
			RenderTexture.active = renderTexture;
			Texture2D val = new Texture2D(((Texture)renderTexture).width, ((Texture)renderTexture).height);
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)renderTexture).width, (float)((Texture)renderTexture).height), 0, 0);
			val.Apply();
			val = FlipTexture(val);
			if ((Object)(object)background != (Object)null)
			{
				val = AddBackground(val, background);
			}
			byte[] key = val.EncodeToPNG();
			_pictures.Add(key, ((Object)_currentObject).name);
		}

		private void SaveFile(byte[] bytes, string fileName)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			string text = Application.dataPath + "/" + path + "/" + fileName + "_icon.png";
			string text2 = "Assets/" + path + "/" + fileName + "_icon.png";
			File.WriteAllBytes(text, bytes);
			AssetDatabase.ImportAsset(text2, (ImportAssetOptions)1);
			TextureImporter val = (TextureImporter)AssetImporter.GetAtPath(text2);
			val.isReadable = true;
			val.textureType = (TextureImporterType)8;
			val.spriteImportMode = (SpriteImportMode)1;
			val.alphaSource = (TextureImporterAlphaSource)1;
			val.alphaIsTransparency = true;
			val.mipmapEnabled = false;
			val.wrapMode = (TextureWrapMode)1;
			EditorUtility.SetDirty((Object)(object)val);
			((AssetImporter)val).SaveAndReimport();
			AssetDatabase.Refresh();
		}

		public void Capture(GameObject objectToIconize)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			_temp = ObjectToIconize;
			_currentObject = objectToIconize;
			_targetPos = Vector3.zero;
			EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)new CallbackFunction(TakePictureOfObject));
		}

		private void TakePictureOfObject()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)this).transform.position != _targetPos)
			{
				HideOtherSceneObjects(_currentObject);
				if (MoveToObject)
				{
					GoToObject(_currentObject);
				}
				else
				{
					_targetPos = ((Component)this).transform.position;
				}
			}
			else if (((Component)this).transform.position == _targetPos)
			{
				Capture();
				EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)new CallbackFunction(TakePictureOfObject));
			}
		}

		public Texture2D FlipTexture(Texture2D original)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(((Texture)original).width, ((Texture)original).height);
			int width = ((Texture)original).width;
			int height = ((Texture)original).height;
			for (int i = 0; i < width; i++)
			{
				for (int j = 0; j < height; j++)
				{
					val.SetPixel(i, height - j - 1, original.GetPixel(i, j));
				}
			}
			val.Apply();
			return val;
		}

		public Texture2D AddBackground(Texture2D original, Texture2D background)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(((Texture)original).width, ((Texture)original).height);
			int width = ((Texture)original).width;
			int height = ((Texture)original).height;
			int width2 = ((Texture)background).width;
			int height2 = ((Texture)background).height;
			for (int i = 0; i < width; i++)
			{
				for (int j = 0; j < height; j++)
				{
					Color pixel = original.GetPixel(i, j);
					if (pixel.a == 0f)
					{
						int num = (int)Remap(i, 0f, width, 0f, width2);
						int num2 = (int)Remap(j, 0f, height, 0f, height2);
						val.SetPixel(i, j, background.GetPixel(num, num2));
					}
					else
					{
						val.SetPixel(i, j, pixel);
					}
				}
			}
			val.Apply();
			return val;
		}

		public float Remap(float value, float from1, float to1, float from2, float to2)
		{
			return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
		}

		public void GoToObject(GameObject goToObject = null)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ObjectToIconize == (Object)null && (Object)(object)goToObject == (Object)null)
			{
				return;
			}
			if ((Object)(object)goToObject == (Object)null)
			{
				goToObject = ObjectToIconize;
			}
			Bounds bounds = goToObject.GetBounds();
			((Component)thisCamera).transform.position = ((Bounds)(ref bounds)).center - ((Component)thisCamera).transform.forward * OrthographicCameraDistance;
			float num3;
			if (thisCamera.orthographic)
			{
				Vector3 extents = ((Bounds)(ref bounds)).extents;
				extents.x *= Mathf.Clamp01(Mathf.Abs(Mathf.Cos(((Component)_camera).transform.eulerAngles.y * ((float)Math.PI / 180f))) + Mathf.Abs(Mathf.Sin(((Component)_camera).transform.eulerAngles.x * ((float)Math.PI / 180f))));
				extents.y *= Mathf.Clamp01(Mathf.Abs(Mathf.Cos(((Component)_camera).transform.eulerAngles.x * ((float)Math.PI / 180f))));
				extents.z *= Mathf.Clamp01(Mathf.Abs(Mathf.Sin(((Component)_camera).transform.eulerAngles.y * ((float)Math.PI / 180f))) + Mathf.Abs(Mathf.Sin(((Component)_camera).transform.eulerAngles.x * ((float)Math.PI / 180f))));
				int highestComponentIndex = extents.GetHighestComponentIndex();
				float num = ((Vector3)(ref extents))[highestComponentIndex];
				Vector3 val = thisCamera.WorldToViewportPoint(((Bounds)(ref bounds)).min);
				int num2 = 0;
				if (1f - val.y > val.x)
				{
					num2 = 1;
				}
				do
				{
					thisCamera.orthographicSize *= (float)num2 + ((Vector3)(ref val))[num2] * Mathf.Pow(-1f, (float)num2);
					val = thisCamera.WorldToViewportPoint(((Bounds)(ref bounds)).min);
				}
				while (Mathf.Abs(1f - ((float)num2 + ((Vector3)(ref val))[num2] * Mathf.Pow(-1f, (float)num2))) > 0.001f);
				Camera obj = thisCamera;
				obj.orthographicSize += Oversize;
				num3 = OrthographicCameraDistance;
			}
			else
			{
				float fieldOfView = thisCamera.fieldOfView;
				Vector3 extents2 = ((Bounds)(ref bounds)).extents;
				float num4 = ((Vector3)(ref extents2)).magnitude + Oversize;
				num3 = num4 / Mathf.Tan(fieldOfView * ((float)Math.PI / 180f) / 2f);
			}
			((Component)thisCamera).transform.position = ((Bounds)(ref bounds)).center - ((Component)thisCamera).transform.forward * num3;
			_targetPos = ((Component)thisCamera).transform.position;
		}

		public void HideOtherSceneObjects(GameObject currentObject = null)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (rootGameObjects == null)
			{
				rootGameObjects = new Dictionary<GameObject, bool>();
			}
			if ((Object)(object)ObjectToIconize == (Object)null && (Object)(object)currentObject == (Object)null)
			{
				return;
			}
			if ((Object)(object)currentObject == (Object)null)
			{
				currentObject = ObjectToIconize;
			}
			Scene scene = currentObject.scene;
			GameObject[] array = ((Scene)(ref scene)).GetRootGameObjects();
			rootGameObjects.Clear();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (!((Object)(object)val == (Object)(object)currentObject) && !((Object)(object)val == (Object)(object)((Component)this).gameObject) && !SceneObjectsToStayActive.Contains(val))
				{
					rootGameObjects.Add(val, val.activeSelf);
					val.SetActive(false);
				}
			}
		}

		public void UnhideOtherSceneObjects()
		{
			if (rootGameObjects == null)
			{
				return;
			}
			foreach (KeyValuePair<GameObject, bool> rootGameObject in rootGameObjects)
			{
				rootGameObject.Key.SetActive(rootGameObject.Value);
			}
		}

		public void TakeSinglePicture()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			if ((Object)(object)ObjectToIconize != (Object)null)
			{
				if (_pictures == null)
				{
					_pictures = new Dictionary<byte[], string>();
				}
				_pictures.Clear();
				EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)new CallbackFunction(TakeSinglePictureCoroutine));
				Capture(ObjectToIconize);
			}
			else
			{
				CaptureAndSave();
			}
		}

		private void TakeSinglePictureCoroutine()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			if (_pictures.Count <= 0)
			{
				return;
			}
			UnhideOtherSceneObjects();
			foreach (KeyValuePair<byte[], string> picture in _pictures)
			{
				SaveFile(picture.Key, picture.Value);
			}
			EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)new CallbackFunction(TakeSinglePictureCoroutine));
		}

		public void TakeMultiplePictures()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			_currentPicture = 0;
			_lastPicture = -1;
			if (_pictures == null)
			{
				_pictures = new Dictionary<byte[], string>();
			}
			_pictures.Clear();
			EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)new CallbackFunction(TakeMultiplePicturesCoroutine));
		}

		public void TakeMultiplePictures(GameObject[] objectsToTakePicturesOf)
		{
			ObjectsToIconize = objectsToTakePicturesOf;
			TakeMultiplePictures();
		}

		private void TakeMultiplePicturesCoroutine()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			if (_currentPicture >= ObjectsToIconize.Length)
			{
				UnhideOtherSceneObjects();
				foreach (KeyValuePair<byte[], string> picture in _pictures)
				{
					SaveFile(picture.Key, picture.Value);
				}
				_currentPicture = 0;
				EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)new CallbackFunction(TakeMultiplePicturesCoroutine));
			}
			else if (_currentPicture != _lastPicture)
			{
				UnhideOtherSceneObjects();
				Capture(ObjectsToIconize[_currentPicture]);
				_lastPicture = _currentPicture;
			}
		}
	}
	public static class UnityEngineExtentions
	{
		public static Bounds GetBounds(this GameObject gameObject)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = gameObject.transform.position;
			Bounds result = default(Bounds);
			((Bounds)(ref result))..ctor(position, Vector3.zero);
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
				if (val.enabled && ((Component)val).gameObject.activeInHierarchy && (!((Object)(object)component != (Object)null) || !((Object)(object)component.sharedMesh == (Object)null)))
				{
					((Bounds)(ref result)).Encapsulate(val.bounds);
				}
			}
			return result;
		}

		public static int GetHighestComponentIndex(this Vector3 vector)
		{
			float num = float.MinValue;
			int result = 1;
			for (int i = 0; i < 3; i++)
			{
				if (Mathf.Abs(((Vector3)(ref vector))[i]) > num)
				{
					result = i;
					num = Mathf.Abs(((Vector3)(ref vector))[i]);
				}
			}
			return result;
		}

		public static Vector3 Abs(this Vector3 vector)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = vector;
			for (int i = 0; i < 3; i++)
			{
				((Vector3)(ref result))[i] = Mathf.Abs(((Vector3)(ref result))[i]);
			}
			return result;
		}
	}
}
namespace NotWolfie.Maxwell
{
	public class GameObjectToggleOnInteract : FVRInteractiveObject
	{
		[Header("GameObjectToggleOnInteract Config")]
		public GameObject ToggleGameObject;

		public GameObject InvertedToggleGameObject;

		public GameObject InvertedToggleGameObject2;

		public GameObject InvertedToggleGameObject3;

		private bool _isToggled = false;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			_isToggled = !_isToggled;
			ToggleGameObject.SetActive(_isToggled);
			InvertedToggleGameObject.SetActive(!_isToggled);
			InvertedToggleGameObject2.SetActive(!_isToggled);
			InvertedToggleGameObject3.SetActive(!_isToggled);
		}
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace NotWolfie.SVD_Dragunov
{
	[BepInPlugin("NotWolfie.SVD_Dragunov", "SVD_Dragunov", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
	[BepInDependency("nrgill28.Sodalite", "1.4.2")]
	public class SVD_DragunovPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "NotWolfie.SVD_Dragunov");
			OtherLoader.RegisterDirectLoad(BasePath, "NotWolfie.SVD_Dragunov", "", "", "svd", "");
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_svd_dragunov"));
		}
	}
}