using System;
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 OpenScripts2;
using OtherLoader;
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]
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class DeferredNightVisionEffect : MonoBehaviour
{
[SerializeField]
[Tooltip("The main color of the NV effect")]
public Color m_NVColor = new Color(0f, 1f, 0.1724138f, 0f);
[SerializeField]
[Tooltip("The color that the NV effect will 'bleach' towards (white = default)")]
public Color m_TargetBleachColor = new Color(1f, 1f, 1f, 0f);
[Range(0f, 0.1f)]
[Tooltip("How much base lighting does the NV effect pick up")]
public float m_baseLightingContribution = 0.025f;
[Range(0f, 128f)]
[Tooltip("The higher this value, the more bright areas will get 'bleached out'")]
public float m_LightSensitivityMultiplier = 100f;
private Material m_Material;
private Shader m_Shader;
[Tooltip("Do we want to apply a vignette to the edges of the screen?")]
public bool useVignetting = true;
public Shader NightVisionShader => m_Shader;
private void DestroyMaterial(Material mat)
{
if (Object.op_Implicit((Object)(object)mat))
{
Object.DestroyImmediate((Object)(object)mat);
mat = null;
}
}
private void CreateMaterials()
{
if ((Object)(object)m_Shader == (Object)null)
{
m_Shader = Shader.Find("Custom/DeferredNightVisionShader");
}
if ((Object)(object)m_Material == (Object)null && (Object)(object)m_Shader != (Object)null && m_Shader.isSupported)
{
m_Material = CreateMaterial(m_Shader);
}
}
private Material CreateMaterial(Shader shader)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)shader))
{
return null;
}
Material val = new Material(shader);
((Object)val).hideFlags = (HideFlags)61;
return val;
}
private void OnDisable()
{
DestroyMaterial(m_Material);
m_Material = null;
m_Shader = null;
}
[ContextMenu("UpdateShaderValues")]
public void UpdateShaderValues()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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)
if (!((Object)(object)m_Material == (Object)null))
{
m_Material.SetVector("_NVColor", Color.op_Implicit(m_NVColor));
m_Material.SetVector("_TargetWhiteColor", Color.op_Implicit(m_TargetBleachColor));
m_Material.SetFloat("_BaseLightingContribution", m_baseLightingContribution);
m_Material.SetFloat("_LightSensitivityMultiplier", m_LightSensitivityMultiplier);
m_Material.shaderKeywords = null;
if (useVignetting)
{
Shader.EnableKeyword("USE_VIGNETTE");
}
else
{
Shader.DisableKeyword("USE_VIGNETTE");
}
}
}
private void OnEnable()
{
CreateMaterials();
UpdateShaderValues();
}
public void ReloadShaders()
{
OnDisable();
}
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
UpdateShaderValues();
CreateMaterials();
Graphics.Blit((Texture)(object)source, destination, m_Material);
}
}
namespace NGA
{
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class DeferredNightVisionEffect2 : MonoBehaviour
{
[SerializeField]
[Tooltip("The main color of the NV effect")]
public Color m_NVColor = new Color(0f, 1f, 0.1724138f, 0f);
[SerializeField]
[Tooltip("The color that the NV effect will 'bleach' towards (white = default)")]
public Color m_TargetBleachColor = new Color(1f, 1f, 1f, 0f);
[Range(0f, 0.1f)]
[Tooltip("How much base lighting does the NV effect pick up")]
public float m_baseLightingContribution = 0.025f;
[Range(0f, 128f)]
[Tooltip("The higher this value, the more bright areas will get 'bleached out'")]
public float m_LightSensitivityMultiplier = 100f;
private Material m_Material;
private Shader m_Shader;
[Tooltip("Do we want to apply a vignette to the edges of the screen?")]
public bool useVignetting = true;
public Shader NightVisionShader => m_Shader;
private void DestroyMaterial(Material mat)
{
if (Object.op_Implicit((Object)(object)mat))
{
Object.DestroyImmediate((Object)(object)mat);
mat = null;
}
}
private void CreateMaterials()
{
if ((Object)(object)m_Shader == (Object)null)
{
m_Shader = Shader.Find("Custom/DeferredNightVisionShader");
}
if ((Object)(object)m_Material == (Object)null && (Object)(object)m_Shader != (Object)null && m_Shader.isSupported)
{
m_Material = CreateMaterial(m_Shader);
}
}
private Material CreateMaterial(Shader shader)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)shader))
{
return null;
}
Material val = new Material(shader);
((Object)val).hideFlags = (HideFlags)61;
return val;
}
private void OnDisable()
{
DestroyMaterial(m_Material);
m_Material = null;
m_Shader = null;
}
[ContextMenu("UpdateShaderValues")]
public void UpdateShaderValues()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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)
if (!((Object)(object)m_Material == (Object)null))
{
m_Material.SetVector("_NVColor", Color.op_Implicit(m_NVColor));
m_Material.SetVector("_TargetWhiteColor", Color.op_Implicit(m_TargetBleachColor));
m_Material.SetFloat("_BaseLightingContribution", m_baseLightingContribution);
m_Material.SetFloat("_LightSensitivityMultiplier", m_LightSensitivityMultiplier);
m_Material.shaderKeywords = null;
if (useVignetting)
{
Shader.EnableKeyword("USE_VIGNETTE");
}
else
{
Shader.DisableKeyword("USE_VIGNETTE");
}
}
}
private void OnEnable()
{
CreateMaterials();
UpdateShaderValues();
}
public void ReloadShaders()
{
OnDisable();
}
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
UpdateShaderValues();
CreateMaterials();
Graphics.Blit((Texture)(object)source, destination, m_Material);
}
}
}
namespace NGA.AdjustableQbSlots
{
[BepInPlugin("NGA.AdjustableQbSlots", "AdjustableQbSlots", "0.1.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class AdjustableQbSlotsPlugin : 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(), "NGA.AdjustableQbSlots");
OtherLoader.RegisterDirectLoad(BasePath, "NGA.AdjustableQbSlots", "cityrobo-OpenScripts2-2.6.1", "", "molleqslot,molleqslotright,molleqslotgunright,molleqslotgunleft,molleqslotmag,molleqslotbp", "");
}
}
}
namespace NGA
{
public class HeadTracked : MonoBehaviour
{
public bool isTriggerPressed = false;
public Transform marriedObj = null;
public FVRPhysicalObject ThisObj = null;
public void FixedUpdate()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)marriedObj == (Object)null)
{
FVRPlayerBody val = Object.FindObjectOfType<FVRPlayerBody>();
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.Head))
{
marriedObj = val.Head;
}
}
if ((Object)(object)marriedObj != (Object)null)
{
((Component)ThisObj).transform.position = ((Component)marriedObj).transform.position;
((Component)ThisObj).transform.rotation = ((Component)marriedObj).transform.rotation;
}
}
private void OnTriggerStay(Collider other)
{
FVRViveHand component = ((Component)other).GetComponent<FVRViveHand>();
if (!((Object)(object)component != (Object)null))
{
return;
}
Console.WriteLine("Collided with FVRViveHand: " + ((Object)component).name);
if (component.Input.TriggerDown && !isTriggerPressed)
{
Console.WriteLine("Pressed trigger");
isTriggerPressed = true;
Transform val = ((Component)this).transform.Find("Geo");
if ((Object)(object)val != (Object)null)
{
((Component)val).gameObject.SetActive(!((Component)val).gameObject.activeSelf);
}
else
{
Console.WriteLine("Child component named 'Geo' not found.");
}
}
}
private void OnTriggerExit(Collider other)
{
FVRViveHand component = ((Component)other).GetComponent<FVRViveHand>();
if ((Object)(object)component != (Object)null)
{
Debug.Log((object)("Exited trigger zone with FVRViveHand: " + ((Object)component).name));
Console.WriteLine("Depressed trigger");
isTriggerPressed = false;
}
}
}
public class InputManipulator : FVRFireArmAttachmentInterface
{
public enum EDegreesOfFreedom
{
Linear,
Planar,
Spacial
}
[Serializable]
public class MovementMode
{
public string ModeText;
public EDegreesOfFreedom DegreesOfFreedom;
public Axis LimitingAxis;
}
[Header("Moving FireArm Attachment Interface Config")]
[Tooltip("One degree means linear movement, two degrees means movement on a plane, three degrees free spacial movement.")]
public EDegreesOfFreedom DegreesOfFreedom;
public Axis LimitingAxis;
public Vector2 XLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public Vector2 YLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public Vector2 ZLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public bool OverridesDisableOnHoverOfMount;
[Tooltip("Something placed on this mount will disabled the hover on disable piece again.")]
public FVRFireArmAttachmentMount OverrideDisableOverrideMount;
[Tooltip("This transforms position will be vaulted as well")]
public Transform SecondaryPiece;
public bool CanRotate;
public float RotationStep = 45f;
public bool CanSwitchModes;
public Text ModeDisplay;
public MovementMode[] MovementModes;
private int _currentMode;
private Vector3 _lastPos;
private Vector3 _lastHandPos;
private Vector3 _startPos;
private Vector3 _lowerLimit;
private Vector3 _upperLimit;
[HideInInspector]
public GameObject DisableOnHover;
[HideInInspector]
public GameObject EnableOnHover;
public const string POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Position";
public const string ROTATION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Rotation";
public const string SECONDARY_POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Secondary Position";
public InputManipulator()
{
//IL_000b: 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_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)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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)
//IL_0059: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00ac: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
MovementMode[] array = new MovementMode[4];
MovementMode val = new MovementMode();
val.ModeText = "All";
val.DegreesOfFreedom = (EDegreesOfFreedom)2;
val.LimitingAxis = (Axis)0;
array[0] = val;
val = new MovementMode();
val.ModeText = "X Limited";
val.DegreesOfFreedom = (EDegreesOfFreedom)1;
val.LimitingAxis = (Axis)0;
array[1] = val;
val = new MovementMode();
val.ModeText = "Y Limited";
val.DegreesOfFreedom = (EDegreesOfFreedom)1;
val.LimitingAxis = (Axis)1;
array[2] = val;
val = new MovementMode();
val.ModeText = "Z Limited";
val.DegreesOfFreedom = (EDegreesOfFreedom)1;
val.LimitingAxis = (Axis)2;
array[3] = val;
MovementModes = (MovementMode[])(object)array;
((FVRFireArmAttachmentInterface)this)..ctor();
}
public override void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArmAttachmentInterface)this).Awake();
_lowerLimit = new Vector3(XLimits.x, YLimits.x, ZLimits.x);
_upperLimit = new Vector3(XLimits.y, YLimits.y, ZLimits.y);
_startPos = ((Component)((AnvilAsset)((FVRPhysicalObject)base.Attachment).ObjectWrapper).GetGameObject().GetComponent<FVRFireArmAttachment>().AttachmentInterface).transform.localPosition;
if ((Object)(object)ModeDisplay != (Object)null)
{
ModeDisplay.text = MovementModes[_currentMode].ModeText;
}
}
public override void OnAttach()
{
((FVRFireArmAttachmentInterface)this).OnAttach();
if (OverridesDisableOnHoverOfMount && base.Attachment.curMount.HasHoverDisablePiece)
{
FVRPhysicalObject myObject = base.Attachment.curMount.MyObject;
CustomOpenScripts2Attachment val = (CustomOpenScripts2Attachment)(object)((myObject is CustomOpenScripts2Attachment) ? myObject : null);
if ((Object)(object)val != (Object)null)
{
FVRFireArmAttachmentInterface attachmentInterface = ((FVRFireArmAttachment)val).AttachmentInterface;
MovingFireArmAttachmentInterface val2 = (MovingFireArmAttachmentInterface)(object)((attachmentInterface is MovingFireArmAttachmentInterface) ? attachmentInterface : null);
if ((Object)(object)val2 != (Object)null)
{
DisableOnHover = val2.DisableOnHover;
val2.DisableOnHover = null;
GameObject disableOnHover = DisableOnHover;
if (!((Object)(object)disableOnHover == (Object)null))
{
disableOnHover.SetActive(true);
}
goto IL_00e1;
}
}
DisableOnHover = base.Attachment.curMount.DisableOnHover;
base.Attachment.curMount.DisableOnHover = null;
GameObject disableOnHover2 = DisableOnHover;
if ((Object)(object)disableOnHover2 != (Object)null)
{
disableOnHover2.SetActive(true);
}
}
goto IL_00e1;
IL_00e1:
if (!OverridesDisableOnHoverOfMount || !base.Attachment.curMount.HasHoverEnablePiece)
{
return;
}
FVRPhysicalObject myObject2 = base.Attachment.curMount.MyObject;
CustomOpenScripts2Attachment val3 = (CustomOpenScripts2Attachment)(object)((myObject2 is CustomOpenScripts2Attachment) ? myObject2 : null);
if ((Object)(object)val3 != (Object)null)
{
FVRFireArmAttachmentInterface attachmentInterface2 = ((FVRFireArmAttachment)val3).AttachmentInterface;
MovingFireArmAttachmentInterface val4 = (MovingFireArmAttachmentInterface)(object)((attachmentInterface2 is MovingFireArmAttachmentInterface) ? attachmentInterface2 : null);
if ((Object)(object)val4 != (Object)null)
{
EnableOnHover = val4.EnableOnHover;
val4.EnableOnHover = null;
GameObject enableOnHover = EnableOnHover;
if (!((Object)(object)enableOnHover == (Object)null))
{
enableOnHover.SetActive(false);
}
return;
}
}
EnableOnHover = base.Attachment.curMount.EnableOnHover;
base.Attachment.curMount.EnableOnHover = null;
GameObject enableOnHover2 = EnableOnHover;
if (!((Object)(object)enableOnHover2 == (Object)null))
{
enableOnHover2.SetActive(false);
}
}
public override void OnDetach()
{
FVRPhysicalObject myObject = base.Attachment.curMount.MyObject;
CustomOpenScripts2Attachment val = (CustomOpenScripts2Attachment)(object)((myObject is CustomOpenScripts2Attachment) ? myObject : null);
if ((Object)(object)val != (Object)null)
{
FVRFireArmAttachmentInterface attachmentInterface = ((FVRFireArmAttachment)val).AttachmentInterface;
MovingFireArmAttachmentInterface val2 = (MovingFireArmAttachmentInterface)(object)((attachmentInterface is MovingFireArmAttachmentInterface) ? attachmentInterface : null);
if ((Object)(object)val2 != (Object)null)
{
val2.DisableOnHover = DisableOnHover;
val2.EnableOnHover = EnableOnHover;
goto IL_0087;
}
}
base.Attachment.curMount.DisableOnHover = DisableOnHover;
base.Attachment.curMount.EnableOnHover = EnableOnHover;
goto IL_0087;
IL_0087:
DisableOnHover = null;
EnableOnHover = null;
((FVRFireArmAttachmentInterface)this).OnDetach();
}
public override void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
if (!OverridesDisableOnHoverOfMount || !((Object)(object)OverrideDisableOverrideMount != (Object)null))
{
return;
}
if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
{
GameObject disableOnHover = DisableOnHover;
if ((Object)(object)disableOnHover != (Object)null)
{
disableOnHover.SetActive(false);
}
}
else
{
GameObject disableOnHover2 = DisableOnHover;
if ((Object)(object)disableOnHover2 != (Object)null)
{
disableOnHover2.SetActive(true);
}
}
if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
{
GameObject enableOnHover = EnableOnHover;
if (!((Object)(object)enableOnHover == (Object)null))
{
enableOnHover.SetActive(true);
}
}
else
{
GameObject enableOnHover2 = EnableOnHover;
if (!((Object)(object)enableOnHover2 == (Object)null))
{
enableOnHover2.SetActive(false);
}
}
}
public override void BeginInteraction(FVRViveHand hand)
{
//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_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)
((FVRInteractiveObject)this).BeginInteraction(hand);
_lastPos = ((Component)this).transform.position;
_lastHandPos = hand.Input.FilteredPos;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0008: 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_0011: 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_002a: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Invalid comparison between Unknown and I4
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Invalid comparison between Unknown and I4
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
Vector3 zero = Vector3.zero;
((Vector3)(ref zero))..ctor((float)(((int)LimitingAxis == 0) ? 1 : 0), (float)(((int)LimitingAxis == 1) ? 1 : 0), (float)(((int)LimitingAxis == 2) ? 1 : 0));
if (hand.Input.TriggerFloat > 0f)
{
Vector3 val = (hand.Input.FilteredPos - _lastHandPos) * hand.Input.TriggerFloat;
Vector3 val2 = (((Component)this).transform.position - _lastPos) * hand.Input.TriggerFloat;
Vector3 newPosRaw = ((Component)this).transform.position + val - val2;
EDegreesOfFreedom degreesOfFreedom = DegreesOfFreedom;
if ((int)degreesOfFreedom != 0)
{
if ((int)degreesOfFreedom != 1)
{
if ((int)degreesOfFreedom == 2)
{
ThreeDegreesOfFreedom(newPosRaw);
}
}
else
{
TwoDegreesOfFreedom(newPosRaw);
}
}
else
{
OneDegreeOfFreedom(newPosRaw);
}
}
else if (OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.up))
{
((Component)this).transform.localPosition = _startPos;
}
else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.left))
{
Console.WriteLine("Rotation Axis: " + zero);
((Component)this).transform.Rotate(zero * RotationStep);
}
else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.right))
{
Console.WriteLine("Rotation Axis: " + zero);
((Component)this).transform.Rotate(-zero * RotationStep);
}
else if (CanSwitchModes && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.down))
{
SwitchMode();
}
_lastPos = ((Component)this).transform.position;
_lastHandPos = hand.Input.FilteredPos;
}
private void OneDegreeOfFreedom(Vector3 newPosRaw)
{
//IL_0087: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
Vector3 localPosition;
if (CanSwitchModes)
{
Vector3 val = UnityEngineExtensions.ApproximateInfiniteComponent(UnityEngineExtensions.GetCombinedAxisVector(_lowerLimit, LimitingAxis, ((Component)this).transform.localPosition), 100f);
Vector3 val2 = UnityEngineExtensions.ApproximateInfiniteComponent(UnityEngineExtensions.GetCombinedAxisVector(_upperLimit, LimitingAxis, ((Component)this).transform.localPosition), 100f);
localPosition = ((FVRInteractiveObject)this).GetClosestValidPoint(val, val2, ((Component)this).transform.parent.InverseTransformPoint(newPosRaw));
}
else
{
localPosition = UnityEngineExtensions.Clamp(UnityEngineExtensions.GetAxisVector(((Component)this).transform.parent.InverseTransformPoint(newPosRaw), LimitingAxis), _lowerLimit, _upperLimit);
}
((Component)this).transform.localPosition = localPosition;
}
private void TwoDegreesOfFreedom(Vector3 newPosRaw)
{
//IL_0047: 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)
//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)
//IL_0058: 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_0014: 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)
//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)
//IL_0034: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((!CanSwitchModes) ? UnityEngineExtensions.RemoveAxisValue(((Component)this).transform.parent.InverseTransformPoint(newPosRaw), LimitingAxis) : UnityEngineExtensions.ProjectOnPlaneThroughPoint(newPosRaw, ((Component)this).transform.position, UnityEngineExtensions.GetLocalDirAxis(((Component)this).transform.parent, LimitingAxis)));
Vector3 val2 = UnityEngineExtensions.Clamp(((Component)this).transform.parent.InverseTransformPoint(val), _lowerLimit, _upperLimit);
((Component)this).transform.localPosition = UnityEngineExtensions.ModifyAxisValue(val2, LimitingAxis, UnityEngineExtensions.GetAxisValue(_startPos, LimitingAxis));
}
private void ThreeDegreesOfFreedom(Vector3 newPosRaw)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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)
((Component)this).transform.localPosition = UnityEngineExtensions.Clamp(((Component)this).transform.parent.InverseTransformPoint(newPosRaw), _lowerLimit, _upperLimit);
}
[ContextMenu("Copy existing Interface's values")]
public void CopyAttachment()
{
FVRFireArmAttachmentInterface[] components = ((Component)this).GetComponents<FVRFireArmAttachmentInterface>();
FVRFireArmAttachmentInterface val = components.Single((FVRFireArmAttachmentInterface c) => (Object)(object)c != (Object)(object)this);
val.Attachment.AttachmentInterface = (FVRFireArmAttachmentInterface)(object)this;
UniversalCopy.CopyComponent<FVRFireArmAttachmentInterface>((Component)(object)this, val);
}
private void SwitchMode()
{
//IL_0056: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
_currentMode = (_currentMode + 1) % MovementModes.Length;
if ((Object)(object)ModeDisplay != (Object)null)
{
ModeDisplay.text = MovementModes[_currentMode].ModeText;
}
DegreesOfFreedom = MovementModes[_currentMode].DegreesOfFreedom;
LimitingAxis = MovementModes[_currentMode].LimitingAxis;
}
}
public class RailEnumerator : MonoBehaviour
{
public bool executedUpdate = false;
public int enumToSet = 159;
private void Start()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
FVRFireArmAttachment component = ((Component)this).GetComponent<FVRFireArmAttachment>();
component.Type = (FVRFireArmAttachementMountType)enumToSet;
}
private void Update()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected I4, but got Unknown
if (!executedUpdate)
{
FVRFireArmAttachment component = ((Component)this).GetComponent<FVRFireArmAttachment>();
Debug.Log((object)string.Concat("Mount type ", component.Type, " int ", (int)component.Type));
executedUpdate = true;
}
}
}
}