Decompiled source of ModulSykov v1.0.2

ModulSykov.dll

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

[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 ChangeObjectOnCaliber : MonoBehaviour
{
	public enum ChangeType
	{
		DirectlySetText,
		ToggleForSpecificCalibers
	}

	public enum CaliberChecker
	{
		Mag,
		Weapon
	}

	private FVRFireArmMagazine attachedMag;

	private FVRFireArm parentFirearm;

	public CaliberChecker objectToObserveCaliber = CaliberChecker.Mag;

	public ChangeType changeType = ChangeType.DirectlySetText;

	public Text[] textsToChange;

	public FireArmRoundType[] acceptedRoundTypes;

	public string[] namesForRoundTypes;

	private void Start()
	{
		attachedMag = ((Component)this).GetComponentInParent<FVRFireArmMagazine>();
		parentFirearm = ((Component)this).GetComponentInParent<FVRFireArm>();
	}

	private void Update()
	{
		if ((Object)(object)attachedMag != (Object)null && objectToObserveCaliber == CaliberChecker.Mag)
		{
			Text[] array = textsToChange;
			foreach (Text val in array)
			{
				switch (changeType)
				{
				case ChangeType.DirectlySetText:
					val.text = ((object)(FireArmRoundType)(ref attachedMag.RoundType)).ToString();
					break;
				case ChangeType.ToggleForSpecificCalibers:
					val.text = namesForRoundTypes[CheckIfCaliberMatches()];
					break;
				}
			}
		}
		else if ((Object)(object)parentFirearm != (Object)null && objectToObserveCaliber == CaliberChecker.Weapon)
		{
			Text[] array2 = textsToChange;
			foreach (Text val2 in array2)
			{
				switch (changeType)
				{
				case ChangeType.DirectlySetText:
					val2.text = ((object)(FireArmRoundType)(ref attachedMag.RoundType)).ToString();
					break;
				case ChangeType.ToggleForSpecificCalibers:
					val2.text = namesForRoundTypes[CheckIfCaliberMatches()];
					break;
				}
			}
		}
		else
		{
			Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": ChangeObjectOnCaliber could not find a usable magazine or firearm."));
		}
	}

	public int CheckIfCaliberMatches()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Invalid comparison between I4 and Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Invalid comparison between I4 and Unknown
		for (int i = 0; i < acceptedRoundTypes.Length; i++)
		{
			if ((int)acceptedRoundTypes[i] == (int)attachedMag.RoundType && objectToObserveCaliber == CaliberChecker.Mag)
			{
				return i;
			}
			if ((int)acceptedRoundTypes[i] == (int)parentFirearm.RoundType && objectToObserveCaliber == CaliberChecker.Weapon)
			{
				return i;
			}
		}
		return 0;
	}
}
namespace JerryComponent
{
	public class control_component : MonoBehaviour
	{
		public GameObject Comp;

		public GameObject Comp2;

		public GameObject Rot;

		private void Start()
		{
		}

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (Rot.transform.localEulerAngles.x >= 45f)
			{
				Comp.SetActive(false);
				Comp2.SetActive(true);
			}
			else
			{
				Comp.SetActive(true);
				Comp2.SetActive(false);
			}
		}
	}
	public class EnableWhenSloted : MonoBehaviour
	{
		public FVRPhysicalObject mainObj;

		public GameObject objectToEnable;

		public Transform MT;

		private void Start()
		{
		}

		private void Update()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)mainObj.m_quickbeltSlot != (Object)null)
			{
				if (mainObj.m_quickbeltSlot.IsPlayer)
				{
					objectToEnable.transform.position = MT.position;
					objectToEnable.transform.eulerAngles = MT.eulerAngles;
				}
				else if (!mainObj.m_quickbeltSlot.IsPlayer)
				{
					objectToEnable.transform.localPosition = new Vector3(0f, 0f, 0f);
					objectToEnable.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				}
				objectToEnable.SetActive(true);
			}
			else if ((Object)(object)mainObj.m_quickbeltSlot == (Object)null)
			{
				objectToEnable.SetActive(false);
			}
		}
	}
	public class FollowHeadOnSloted : MonoBehaviour
	{
		public FVRPhysicalObject mainObj;

		public GameObject staticGEO;

		public GameObject movingGEO;

		private void Start()
		{
		}

		private void Update()
		{
			if ((Object)(object)mainObj.m_quickbeltSlot != (Object)null)
			{
				if (mainObj.QuickbeltSlot.IsPlayer)
				{
					staticGEO.SetActive(false);
					movingGEO.SetActive(true);
				}
				else
				{
					staticGEO.SetActive(true);
					movingGEO.SetActive(false);
				}
			}
			else if ((Object)(object)mainObj.m_quickbeltSlot == (Object)null)
			{
				staticGEO.SetActive(true);
				movingGEO.SetActive(false);
			}
		}
	}
	public class TacEarPro : MonoBehaviour
	{
		public GameObject powerswitch;

		public AudioLowPassFilter alf;

		public float alfMax = 10000f;

		public float alfMin = 200f;

		public float alfHalfMin = 400f;

		public float alfIncRate = 10f;

		public float soundvolumeNorm = 1f;

		public float soundvolumeInc = 1.5f;

		private bool isHeaded = false;

		public GameObject on;

		public GameObject off;

		public GameObject whole;

		private void OnShotFired(FVRFireArm firearm)
		{
			alf.cutoffFrequency = alfMin;
		}

		private void OnSosigGunFired(SosigWeapon sosigWeapon)
		{
			alf.cutoffFrequency = alfHalfMin;
		}

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
			GM.CurrentSceneSettings.SosiggunFiredEvent += new SosiggunFired(OnSosigGunFired);
		}

		private void OnTriggerEnter(Collider other)
		{
			if (((Object)((Component)other).gameObject).name == "HeadsetSensor")
			{
				isHeaded = true;
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (((Object)((Component)other).gameObject).name == "HeadsetSensor")
			{
				isHeaded = false;
			}
		}

		private void Update()
		{
			//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_00c4: 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)
			if (isHeaded)
			{
				whole.SetActive(true);
				if (powerswitch.transform.localEulerAngles.x >= 45f)
				{
					on.SetActive(true);
					off.SetActive(false);
					AudioListener.volume = soundvolumeInc;
					if (alf.cutoffFrequency != alfMax)
					{
						AudioLowPassFilter obj = alf;
						obj.cutoffFrequency += alfIncRate;
					}
					if (alf.cutoffFrequency > alfMax)
					{
						alf.cutoffFrequency = alfMax;
					}
				}
				if (powerswitch.transform.localEulerAngles.x < 45f)
				{
					on.SetActive(false);
					off.SetActive(true);
					AudioListener.volume = soundvolumeNorm;
				}
			}
			if (!isHeaded)
			{
				whole.SetActive(false);
				AudioListener.volume = soundvolumeNorm;
			}
		}

		private void OnDestroy()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
			GM.CurrentSceneSettings.SosiggunFiredEvent -= new SosiggunFired(OnSosigGunFired);
		}
	}
	public class enableanddisable : MonoBehaviour
	{
		public GameObject enable;

		public GameObject disable;

		private void Start()
		{
		}

		private void Update()
		{
			if (disable.activeInHierarchy)
			{
				enable.SetActive(false);
			}
			else
			{
				enable.SetActive(true);
			}
		}
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace localpcnerd.ModulSykov
{
	[BepInPlugin("localpcnerd.ModulSykov", "ModulSykov", "1.0.2")]
	[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.1")]
	public class ModulSykovPlugin : 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(), "localpcnerd.ModulSykov");
			OtherLoader.RegisterDirectLoad(BasePath, "localpcnerd.ModulSykov", "", "", "sykov", "");
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modulsykov"));
		}
	}
}
public class OBJExporter : ScriptableWizard
{
	public bool onlySelectedObjects = false;

	public bool applyPosition = true;

	public bool applyRotation = true;

	public bool applyScale = true;

	public bool generateMaterials = true;

	public bool exportTextures = true;

	public bool splitObjects = true;

	public bool autoMarkTexReadable = false;

	public bool objNameAddIdNum = false;

	private string versionString = "v2.0";

	private string lastExportFolder;

	private bool StaticBatchingEnabled()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		PlayerSettings[] array = Resources.FindObjectsOfTypeAll<PlayerSettings>();
		if (array == null)
		{
			return false;
		}
		SerializedObject val = new SerializedObject((Object[])(object)array);
		SerializedProperty val2 = val.FindProperty("m_BuildTargetBatching");
		for (int i = 0; i < val2.arraySize; i++)
		{
			SerializedProperty arrayElementAtIndex = val2.GetArrayElementAtIndex(i);
			if (arrayElementAtIndex == null)
			{
				continue;
			}
			IEnumerator enumerator = arrayElementAtIndex.GetEnumerator();
			if (enumerator == null)
			{
				continue;
			}
			while (enumerator.MoveNext())
			{
				SerializedProperty val3 = (SerializedProperty)enumerator.Current;
				if (val3 != null && val3.name == "m_StaticBatching")
				{
					return val3.boolValue;
				}
			}
		}
		return false;
	}

	private void OnWizardUpdate()
	{
		((ScriptableWizard)this).helpString = "Aaro4130's OBJ Exporter " + versionString;
	}

	private Vector3 RotateAroundPoint(Vector3 point, Vector3 pivot, Quaternion angle)
	{
		//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_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_0014: 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)
		return angle * (point - pivot) + pivot;
	}

	private Vector3 MultiplyVec3s(Vector3 v1, Vector3 v2)
	{
		//IL_002e: 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)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z);
	}

	private void OnWizardCreate()
	{
		if (StaticBatchingEnabled() && Application.isPlaying)
		{
			EditorUtility.DisplayDialog("Error", "Static batching is enabled. This will cause the export file to look like a mess, as well as be a large filesize. Disable this option, and restart the player, before continuing.", "OK");
			return;
		}
		if (autoMarkTexReadable)
		{
			int num = EditorUtility.DisplayDialogComplex("Warning", "This will convert all textures to Advanced type with the read/write option set. This is not reversible and will permanently affect your project. Continue?", "Yes", "No", "Cancel");
			if (num > 0)
			{
				return;
			}
		}
		string @string = EditorPrefs.GetString("a4_OBJExport_lastPath", "");
		string string2 = EditorPrefs.GetString("a4_OBJExport_lastFile", "unityexport.obj");
		string text = EditorUtility.SaveFilePanel("Export OBJ", @string, string2, "obj");
		if (text.Length > 0)
		{
			FileInfo fileInfo = new FileInfo(text);
			EditorPrefs.SetString("a4_OBJExport_lastFile", fileInfo.Name);
			EditorPrefs.SetString("a4_OBJExport_lastPath", fileInfo.Directory.FullName);
			Export(text);
		}
	}

	private void Export(string exportPath)
	{
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0374: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_0386: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_0498: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_04af: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0565: Unknown result type (might be due to invalid IL or missing references)
		//IL_056a: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, bool> dictionary = new Dictionary<string, bool>();
		FileInfo fileInfo = new FileInfo(exportPath);
		lastExportFolder = fileInfo.Directory.FullName;
		string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(exportPath);
		EditorUtility.DisplayProgressBar("Exporting OBJ", "Please wait.. Starting export.", 0f);
		MeshFilter[] array;
		if (onlySelectedObjects)
		{
			List<MeshFilter> list = new List<MeshFilter>();
			GameObject[] gameObjects = Selection.gameObjects;
			foreach (GameObject val in gameObjects)
			{
				MeshFilter component = val.GetComponent<MeshFilter>();
				if ((Object)(object)component != (Object)null)
				{
					list.Add(component);
				}
			}
			array = list.ToArray();
		}
		else
		{
			array = Object.FindObjectsOfType(typeof(MeshFilter)) as MeshFilter[];
		}
		if (Application.isPlaying)
		{
			MeshFilter[] array2 = array;
			foreach (MeshFilter val2 in array2)
			{
				MeshRenderer component2 = ((Component)val2).gameObject.GetComponent<MeshRenderer>();
				if ((Object)(object)component2 != (Object)null && ((Renderer)component2).isPartOfStaticBatch)
				{
					EditorUtility.ClearProgressBar();
					EditorUtility.DisplayDialog("Error", "Static batched object detected. Static batching is not compatible with this exporter. Please disable it before starting the player.", "OK");
					return;
				}
			}
		}
		StringBuilder stringBuilder = new StringBuilder();
		StringBuilder stringBuilder2 = new StringBuilder();
		stringBuilder.AppendLine("# Export of " + Application.loadedLevelName);
		stringBuilder.AppendLine("# from Aaro4130 OBJ Exporter " + versionString);
		if (generateMaterials)
		{
			stringBuilder.AppendLine("mtllib " + fileNameWithoutExtension + ".mtl");
		}
		float num = array.Length + 1;
		int num2 = 0;
		for (int k = 0; k < array.Length; k++)
		{
			string name = ((Object)((Component)array[k]).gameObject).name;
			float num3 = (float)(k + 1) / num;
			EditorUtility.DisplayProgressBar("Exporting objects... (" + Mathf.Round(num3 * 100f) + "%)", "Exporting object " + name, num3);
			MeshFilter val3 = array[k];
			MeshRenderer component3 = ((Component)array[k]).gameObject.GetComponent<MeshRenderer>();
			if (splitObjects)
			{
				string text = name;
				if (objNameAddIdNum)
				{
					text = text + "_" + k;
				}
				stringBuilder.AppendLine("g " + text);
			}
			if ((Object)(object)component3 != (Object)null && generateMaterials)
			{
				Material[] sharedMaterials = ((Renderer)component3).sharedMaterials;
				foreach (Material val4 in sharedMaterials)
				{
					if (!dictionary.ContainsKey(((Object)val4).name))
					{
						dictionary[((Object)val4).name] = true;
						stringBuilder2.Append(MaterialToString(val4));
						stringBuilder2.AppendLine();
					}
				}
			}
			Mesh sharedMesh = val3.sharedMesh;
			int num4 = (int)Mathf.Clamp(((Component)val3).gameObject.transform.lossyScale.x * ((Component)val3).gameObject.transform.lossyScale.z, -1f, 1f);
			Vector3[] vertices = sharedMesh.vertices;
			foreach (Vector3 val5 in vertices)
			{
				Vector3 val6 = val5;
				if (applyScale)
				{
					val6 = MultiplyVec3s(val6, ((Component)val3).gameObject.transform.lossyScale);
				}
				if (applyRotation)
				{
					val6 = RotateAroundPoint(val6, Vector3.zero, ((Component)val3).gameObject.transform.rotation);
				}
				if (applyPosition)
				{
					val6 += ((Component)val3).gameObject.transform.position;
				}
				val6.x *= -1f;
				stringBuilder.AppendLine("v " + val6.x + " " + val6.y + " " + val6.z);
			}
			Vector3[] normals = sharedMesh.normals;
			foreach (Vector3 val7 in normals)
			{
				Vector3 val8 = val7;
				if (applyScale)
				{
					Vector3 v = val8;
					Vector3 lossyScale = ((Component)val3).gameObject.transform.lossyScale;
					val8 = MultiplyVec3s(v, ((Vector3)(ref lossyScale)).normalized);
				}
				if (applyRotation)
				{
					val8 = RotateAroundPoint(val8, Vector3.zero, ((Component)val3).gameObject.transform.rotation);
				}
				val8.x *= -1f;
				stringBuilder.AppendLine("vn " + val8.x + " " + val8.y + " " + val8.z);
			}
			Vector2[] uv = sharedMesh.uv;
			for (int num5 = 0; num5 < uv.Length; num5++)
			{
				Vector2 val9 = uv[num5];
				stringBuilder.AppendLine("vt " + val9.x + " " + val9.y);
			}
			for (int num6 = 0; num6 < sharedMesh.subMeshCount; num6++)
			{
				if ((Object)(object)component3 != (Object)null && num6 < ((Renderer)component3).sharedMaterials.Length)
				{
					string name2 = ((Object)((Renderer)component3).sharedMaterials[num6]).name;
					stringBuilder.AppendLine("usemtl " + name2);
				}
				else
				{
					stringBuilder.AppendLine("usemtl " + name + "_sm" + num6);
				}
				int[] triangles = sharedMesh.GetTriangles(num6);
				for (int num7 = 0; num7 < triangles.Length; num7 += 3)
				{
					int index = triangles[num7] + 1 + num2;
					int index2 = triangles[num7 + 1] + 1 + num2;
					int index3 = triangles[num7 + 2] + 1 + num2;
					if (num4 < 0)
					{
						stringBuilder.AppendLine("f " + ConstructOBJString(index) + " " + ConstructOBJString(index2) + " " + ConstructOBJString(index3));
					}
					else
					{
						stringBuilder.AppendLine("f " + ConstructOBJString(index3) + " " + ConstructOBJString(index2) + " " + ConstructOBJString(index));
					}
				}
			}
			num2 += sharedMesh.vertices.Length;
		}
		File.WriteAllText(exportPath, stringBuilder.ToString());
		if (generateMaterials)
		{
			File.WriteAllText(fileInfo.Directory.FullName + "\\" + fileNameWithoutExtension + ".mtl", stringBuilder2.ToString());
		}
		EditorUtility.ClearProgressBar();
	}

	private string TryExportTexture(string propertyName, Material m)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		if (m.HasProperty(propertyName))
		{
			Texture texture = m.GetTexture(propertyName);
			if ((Object)(object)texture != (Object)null)
			{
				return ExportTexture((Texture2D)texture);
			}
		}
		return "false";
	}

	private string ExportTexture(Texture2D t)
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		try
		{
			if (autoMarkTexReadable)
			{
				string assetPath = AssetDatabase.GetAssetPath((Object)(object)t);
				AssetImporter atPath = AssetImporter.GetAtPath(assetPath);
				TextureImporter val = (TextureImporter)(object)((atPath is TextureImporter) ? atPath : null);
				if ((Object)(object)val != (Object)null)
				{
					val.textureType = (TextureImporterType)0;
					if (!val.isReadable)
					{
						val.isReadable = true;
						AssetDatabase.ImportAsset(assetPath);
						AssetDatabase.Refresh();
					}
				}
			}
			string text = lastExportFolder + "\\" + ((Object)t).name + ".png";
			Texture2D val2 = new Texture2D(((Texture)t).width, ((Texture)t).height, (TextureFormat)5, false);
			val2.SetPixels(t.GetPixels());
			File.WriteAllBytes(text, val2.EncodeToPNG());
			return text;
		}
		catch (Exception)
		{
			Debug.Log((object)("Could not export texture : " + ((Object)t).name + ". is it readable?"));
			return "null";
		}
	}

	private string ConstructOBJString(int index)
	{
		string text = index.ToString();
		return text + "/" + text + "/" + text;
	}

	private string MaterialToString(Material m)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("newmtl " + ((Object)m).name);
		if (m.HasProperty("_Color"))
		{
			stringBuilder.AppendLine("Kd " + m.color.r + " " + m.color.g + " " + m.color.b);
			if (m.color.a < 1f)
			{
				stringBuilder.AppendLine("Tr " + (1f - m.color.a));
				stringBuilder.AppendLine("d " + m.color.a);
			}
		}
		if (m.HasProperty("_SpecColor"))
		{
			Color color = m.GetColor("_SpecColor");
			stringBuilder.AppendLine("Ks " + color.r + " " + color.g + " " + color.b);
		}
		if (exportTextures)
		{
			string text = TryExportTexture("_MainTex", m);
			if (text != "false")
			{
				stringBuilder.AppendLine("map_Kd " + text);
			}
			text = TryExportTexture("_SpecMap", m);
			if (text != "false")
			{
				stringBuilder.AppendLine("map_Ks " + text);
			}
			text = TryExportTexture("_BumpMap", m);
			if (text != "false")
			{
				stringBuilder.AppendLine("map_Bump " + text);
			}
		}
		stringBuilder.AppendLine("illum 2");
		return stringBuilder.ToString();
	}

	[MenuItem("File/Export/Wavefront OBJ")]
	private static void CreateWizard()
	{
		ScriptableWizard.DisplayWizard("Export OBJ", typeof(OBJExporter), "Export");
	}
}
public class ModifyFireSelector : MonoBehaviour
{
	[Header("Fire Selector")]
	public Transform FireSelector;

	public InterpStyle interp;

	public Axis axis;

	public FireSelectorMode[] modesToSet;

	public int defaultMode;

	private Handgun hg;

	private void Start()
	{
		hg = ((Component)this).GetComponentInParent<Handgun>();
		UpdateSelector();
	}

	private void UpdateSelector()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		hg.DeCockHammer(false, false);
		hg.HasFireSelector = true;
		hg.FireSelector = FireSelector;
		hg.FireSelectorInterpStyle = interp;
		hg.FireSelectorAxis = axis;
		hg.FireSelectorModes = modesToSet;
		hg.m_fireSelectorMode = defaultMode;
	}
}
public class ModifyTriggerSafety : MonoBehaviour
{
	public Transform TriggerSafety;

	public float Pressed;

	public float Unpressed;

	public Axis axis;

	private Handgun hg;

	private void Start()
	{
		hg = ((Component)this).GetComponentInParent<Handgun>();
	}

	private void Update()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		if (hg.HasTriggerSafety)
		{
			hg.TriggerSafety = TriggerSafety;
			hg.TriggerSafetyAxis = axis;
			hg.TriggerSafetyPressed = Pressed;
			hg.TriggerSafetyUnpressed = Unpressed;
		}
	}
}
public class ModifySafety : MonoBehaviour
{
	private Handgun hg;

	public Transform safetyObject;

	public bool hasSafety;

	public bool hasSafetyControl;

	public InterpStyle interp;

	public Axis axis;

	public float safetyOff;

	public float safetyOn;

	public bool doesSafetyRequireSlideForward;

	public bool doesSafetyLockSlide;

	public bool hasMagazineSafety;

	public bool doesSafetyRequireCockedHammer;

	public bool doesSafetyEngagingDecock;

	public bool doesSafetyDisengageCockHammer;

	private void Start()
	{
		hg = ((Component)this).GetComponentInParent<Handgun>();
		UpdateSafetyValues();
	}

	public void UpdateSafetyValues()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		hg.Safety = safetyObject;
		hg.HasSafety = hasSafety;
		hg.HasSafetyControl = hasSafetyControl;
		hg.Safety_Interp = interp;
		hg.SafetyAxis = axis;
		hg.SafetyOff = safetyOff;
		hg.SafetyOn = safetyOn;
		hg.DoesSafetyRequireSlideForward = doesSafetyRequireSlideForward;
		hg.DoesSafetyLockSlide = doesSafetyLockSlide;
		hg.HasMagazineSafety = hasMagazineSafety;
		hg.DoesSafetyRequireCockedHammer = doesSafetyRequireCockedHammer;
		hg.DoesSafetyEngagingDecock = doesSafetyEngagingDecock;
		hg.DoesSafetyDisengageCockHammer = doesSafetyDisengageCockHammer;
	}
}
public class ModifySafetyOnOff : MonoBehaviour
{
	private Handgun hg;

	public float safetyOff;

	public float safetyOn;

	private void Start()
	{
		hg = ((Component)this).GetComponentInParent<Handgun>();
		UpdateSafetyValues();
	}

	public void UpdateSafetyValues()
	{
		hg.SafetyOff = safetyOff;
		hg.SafetyOn = safetyOn;
	}
}