using System;
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 BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
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]
public class AdvanceLaserSightComponent : LaserLightAttachment
{
public Transform KnobMesh;
public Vector3 RotationAxis = Vector3.up;
public List<float> CustomRotationAngles;
public GameObject ControlledGameObject;
public bool[] GameObjectEnableFlags;
public AudioEvent SettingSwapSound;
private int previousSettingsIndex = -1;
private void Start()
{
UpdateKnobRotationAndGameObject();
}
private void Update()
{
UpdateKnobRotationAndGameObject();
}
private void UpdateKnobRotationAndGameObject()
{
//IL_0070: 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)
if ((Object)(object)KnobMesh != (Object)null && base.Settings.Count > 0 && CustomRotationAngles.Count == base.Settings.Count && GameObjectEnableFlags.Length == base.Settings.Count)
{
float num = CustomRotationAngles[base.SettingsIndex];
KnobMesh.localEulerAngles = RotationAxis * num;
UpdateControlledGameObject(base.SettingsIndex);
if (base.SettingsIndex != previousSettingsIndex)
{
PlaySettingSwapSound();
previousSettingsIndex = base.SettingsIndex;
}
}
}
private void UpdateControlledGameObject(int settingIndex)
{
if ((Object)(object)ControlledGameObject != (Object)null)
{
ControlledGameObject.SetActive(GameObjectEnableFlags[settingIndex]);
}
}
private void PlaySettingSwapSound()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
if (SettingSwapSound != null && SettingSwapSound.Clips.Count > 0)
{
AudioClip val = SettingSwapSound.Clips[Random.Range(0, SettingSwapSound.Clips.Count)];
AudioSource.PlayClipAtPoint(val, ((Component)this).transform.position, Random.Range(SettingSwapSound.VolumeRange.x, SettingSwapSound.VolumeRange.y));
}
}
}
public class DiceFaceDetector : MonoBehaviour
{
public ParticleSystem effect;
public Transform faceOneMarker;
public float checkThreshold = 0.9f;
public float cooldownTime = 2f;
private float lastTriggerTime = 0f;
private void Update()
{
//IL_0039: 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)
if (!((Object)(object)faceOneMarker == (Object)null) && !(Time.time - lastTriggerTime < cooldownTime) && Vector3.Dot(faceOneMarker.up, Vector3.up) > checkThreshold)
{
TriggerEffect();
}
}
private void TriggerEffect()
{
if ((Object)(object)effect != (Object)null)
{
effect.Play();
lastTriggerTime = Time.time;
}
}
}
public class QBScaler : MonoBehaviour
{
public FVRQuickBeltSlot slot;
public float scaleMultiplier = 0.5f;
private Transform currentObj;
private Vector3 originalScale;
private Rigidbody[] secondaryRigidbodies;
private bool[] originalKinematicStates;
private void Update()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: 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_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)slot == (Object)null || (Object)(object)slot.CurObject == (Object)null)
{
if ((Object)(object)currentObj != (Object)null)
{
currentObj.localScale = originalScale;
RestoreRigidbodies();
currentObj = null;
}
}
else
{
if (!((Object)(object)currentObj != (Object)(object)((Component)slot.CurObject).transform))
{
return;
}
if ((Object)(object)currentObj != (Object)null)
{
currentObj.localScale = originalScale;
RestoreRigidbodies();
}
currentObj = ((Component)slot.CurObject).transform;
originalScale = currentObj.localScale;
Rigidbody component = ((Component)currentObj).GetComponent<Rigidbody>();
Rigidbody[] componentsInChildren = ((Component)currentObj).GetComponentsInChildren<Rigidbody>();
int num = 0;
for (int i = 0; i < componentsInChildren.Length; i++)
{
if ((Object)(object)componentsInChildren[i] != (Object)(object)component)
{
num++;
}
}
secondaryRigidbodies = (Rigidbody[])(object)new Rigidbody[num];
originalKinematicStates = new bool[num];
int num2 = 0;
for (int j = 0; j < componentsInChildren.Length; j++)
{
if (!((Object)(object)componentsInChildren[j] == (Object)(object)component))
{
secondaryRigidbodies[num2] = componentsInChildren[j];
originalKinematicStates[num2] = componentsInChildren[j].isKinematic;
componentsInChildren[j].isKinematic = true;
num2++;
}
}
currentObj.localScale = originalScale * scaleMultiplier;
}
}
private void RestoreRigidbodies()
{
if (secondaryRigidbodies == null)
{
return;
}
for (int i = 0; i < secondaryRigidbodies.Length; i++)
{
if ((Object)(object)secondaryRigidbodies[i] != (Object)null)
{
secondaryRigidbodies[i].isKinematic = originalKinematicStates[i];
}
}
secondaryRigidbodies = null;
originalKinematicStates = null;
}
}
public class OpenBoltAltHandle : FVRInteractiveObject
{
public enum HandleRot
{
Down,
Mid,
Up
}
public enum HandleState
{
Forward,
Mid,
Rear
}
[Header("References")]
public OpenBoltReceiver Receiver;
public OpenBoltReceiverBolt Bolt;
[Header("Linear Travel")]
public Transform Point_Fore;
public Transform Point_Rear;
public float ForwardSpeed = 1.5f;
[Header("Rotation / Tilt")]
public Transform BoltHandleRoot;
public Transform BoltHandle;
public float MinRot = 0f;
public float MaxRot = 90f;
public float UnlockThreshold = 65f;
public float LockThreshold = 5f;
public float RotateSnapSpeed = 270f;
public HandleRot CurRot = HandleRot.Down;
public HandleRot LastRot = HandleRot.Down;
public HandleState CurState = HandleState.Forward;
public HandleState LastState = HandleState.Forward;
private float m_boltZ_forward;
private float m_boltZ_rear;
private float m_currentHandleZ;
private float m_rotAngle;
private bool m_hasReleasedBolt;
protected void Awake()
{
//IL_000e: 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_0027: 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_0040: 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)
((FVRInteractiveObject)this).Awake();
m_boltZ_forward = Point_Fore.localPosition.z;
m_boltZ_rear = Point_Rear.localPosition.z;
m_currentHandleZ = BoltHandleRoot.localPosition.z;
m_rotAngle = MinRot;
m_hasReleasedBolt = true;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_002e: 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)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_0055: 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_0067: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).UpdateInteraction(hand);
UpdateRotationFromHand(hand);
if (CurRot == HandleRot.Up || CurState != 0)
{
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Fore.position, Point_Rear.position, ((HandInput)(ref hand.Input)).Pos);
BoltHandleRoot.position = closestValidPoint;
m_currentHandleZ = BoltHandleRoot.localPosition.z;
}
UpdateHandleState();
UpdateRotState();
if (CurState != 0)
{
float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_currentHandleZ);
Bolt.ChargingHandleHeld(num);
}
else if (CurRot != 0)
{
Bolt.ChargingHandleHeld(0f);
}
if (CurState == HandleState.Forward && CurRot == HandleRot.Down)
{
if (!m_hasReleasedBolt)
{
Bolt.ChargingHandleReleased();
m_hasReleasedBolt = true;
}
}
else
{
m_hasReleasedBolt = false;
}
HandleRotAudioEvents();
HandleStateAudioEvents();
LastRot = CurRot;
LastState = CurState;
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
}
protected void FVRUpdate()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (((FVRInteractiveObject)this).IsHeld)
{
return;
}
if (Mathf.Abs(m_currentHandleZ - m_boltZ_forward) > 0.001f)
{
m_currentHandleZ = Mathf.MoveTowards(m_currentHandleZ, m_boltZ_forward, Time.deltaTime * ForwardSpeed);
BoltHandleRoot.localPosition = new Vector3(BoltHandleRoot.localPosition.x, BoltHandleRoot.localPosition.y, m_currentHandleZ);
if (CurState != 0)
{
float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_currentHandleZ);
Bolt.ChargingHandleHeld(num);
}
}
if ((CurState == HandleState.Forward || CurState == HandleState.Mid) && m_rotAngle > MinRot + 0.5f)
{
m_rotAngle = Mathf.MoveTowards(m_rotAngle, MinRot, Time.deltaTime * RotateSnapSpeed);
BoltHandle.localEulerAngles = new Vector3(0f, 0f, m_rotAngle);
}
UpdateHandleState();
UpdateRotState();
if (CurState == HandleState.Forward && CurRot == HandleRot.Down && !m_hasReleasedBolt)
{
Bolt.ChargingHandleReleased();
m_hasReleasedBolt = true;
}
HandleStateAudioEvents();
HandleRotAudioEvents();
LastRot = CurRot;
LastState = CurState;
}
private void UpdateRotationFromHand(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002e: 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_0036: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_004f: 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)
//IL_005a: 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_009b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((HandInput)(ref hand.Input)).Pos - BoltHandle.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, BoltHandleRoot.forward);
val = ((Vector3)(ref val2)).normalized;
Vector3 right = BoltHandleRoot.right;
float num = Mathf.Atan2(Vector3.Dot(BoltHandleRoot.forward, Vector3.Cross(right, val)), Vector3.Dot(right, val)) * 57.29578f;
m_rotAngle = Mathf.Clamp(num, MinRot, MaxRot);
BoltHandle.localEulerAngles = new Vector3(0f, 0f, m_rotAngle);
}
private void UpdateRotState()
{
if (m_rotAngle >= UnlockThreshold)
{
CurRot = HandleRot.Up;
}
else if (m_rotAngle <= MinRot + LockThreshold)
{
CurRot = HandleRot.Down;
}
else
{
CurRot = HandleRot.Mid;
}
}
private void UpdateHandleState()
{
if (Mathf.Abs(m_currentHandleZ - m_boltZ_forward) < 0.005f)
{
CurState = HandleState.Forward;
}
else if (Mathf.Abs(m_currentHandleZ - m_boltZ_rear) < 0.005f)
{
CurState = HandleState.Rear;
}
else
{
CurState = HandleState.Mid;
}
}
private void HandleRotAudioEvents()
{
if (!((Object)(object)Receiver == (Object)null))
{
if (CurRot == HandleRot.Up && LastRot != HandleRot.Up)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)12, 1f);
}
else if (CurRot == HandleRot.Down && LastRot != 0)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)13, 1f);
}
}
}
private void HandleStateAudioEvents()
{
if (!((Object)(object)Receiver == (Object)null))
{
if (CurState == HandleState.Rear && LastState != HandleState.Rear)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
else if (CurState == HandleState.Forward && LastState != 0)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
}
}
}
[RequireComponent(typeof(Collider))]
public class GasRegulator : FVRInteractiveObject
{
private enum BoltType
{
None,
Open,
Closed
}
[Serializable]
public class RegulatorSetting
{
public string SettingName;
[Header("Visual")]
public float SelectorPosition;
[Header("Bolt Params")]
public float ForwardSpeed;
public float RearwardSpeed;
public float SpringStiffness;
}
[Header("Firearm Reference")]
public FVRFireArm Firearm;
public GameObject BoltObject;
[Header("Regulator Settings")]
public RegulatorSetting[] Settings;
private int _index = 0;
[Header("Visual")]
public Transform RegulatorGeo;
public Axis Axis;
public InterpStyle InterpStyle;
[Header("Audio")]
public AudioEvent AudEvent_Switch;
[Header("UI")]
public GameObject TextRoot;
public Text TextField;
public float TextDisplayDuration = 2f;
private BoltType _boltType = BoltType.None;
private OpenBoltReceiverBolt _openBolt;
private ClosedBolt _closedBolt;
private bool _textVisible = false;
private float _textTimer = 0f;
public override void Awake()
{
((FVRInteractiveObject)this).Awake();
if ((Object)(object)BoltObject != (Object)null)
{
_openBolt = BoltObject.GetComponent<OpenBoltReceiverBolt>();
_closedBolt = BoltObject.GetComponent<ClosedBolt>();
if ((Object)(object)_openBolt != (Object)null)
{
_boltType = BoltType.Open;
}
else if ((Object)(object)_closedBolt != (Object)null)
{
_boltType = BoltType.Closed;
}
else
{
Debug.LogWarning((object)"[GasRegulator] BoltObject has no OpenBoltReceiverBolt or ClosedBolt component.", (Object)(object)this);
}
}
else
{
Debug.LogWarning((object)"[GasRegulator] No BoltObject assigned.", (Object)(object)this);
}
if ((Object)(object)TextRoot != (Object)null)
{
TextRoot.SetActive(false);
}
if (Settings != null && Settings.Length > 0)
{
ApplySetting(0);
}
}
public override void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
if (!_textVisible)
{
return;
}
_textTimer -= Time.deltaTime;
if (_textTimer <= 0f)
{
_textVisible = false;
if ((Object)(object)TextRoot != (Object)null)
{
TextRoot.SetActive(false);
}
}
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
if (Settings != null && Settings.Length != 0)
{
_index++;
if (_index >= Settings.Length)
{
_index = 0;
}
ApplySetting(_index);
if ((Object)(object)Firearm != (Object)null)
{
Firearm.PlayAudioAsHandling(AudEvent_Switch, ((Component)this).transform.position);
}
ShowText(Settings[_index].SettingName);
}
}
private void ApplySetting(int i)
{
//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)
RegulatorSetting regulatorSetting = Settings[i];
if ((Object)(object)RegulatorGeo != (Object)null && (Object)(object)Firearm != (Object)null)
{
((FVRPhysicalObject)Firearm).SetAnimatedComponent(RegulatorGeo, regulatorSetting.SelectorPosition, InterpStyle, Axis);
}
switch (_boltType)
{
case BoltType.Open:
_openBolt.BoltSpeed_Forward = regulatorSetting.ForwardSpeed;
_openBolt.BoltSpeed_Rearward = regulatorSetting.RearwardSpeed;
_openBolt.BoltSpringStiffness = regulatorSetting.SpringStiffness;
break;
case BoltType.Closed:
_closedBolt.Speed_Forward = regulatorSetting.ForwardSpeed;
_closedBolt.Speed_Rearward = regulatorSetting.RearwardSpeed;
_closedBolt.SpringStiffness = regulatorSetting.SpringStiffness;
break;
}
}
private void ShowText(string settingName)
{
if (!((Object)(object)TextRoot == (Object)null))
{
if ((Object)(object)TextField != (Object)null)
{
TextField.text = settingName;
}
TextRoot.SetActive(true);
_textVisible = true;
_textTimer = TextDisplayDuration;
}
}
}
namespace Volks.MTS3_Rekord;
[BepInPlugin("Volks.MTS3_Rekord", "MTS3_Rekord", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class MTS3_RekordPlugin : 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(), "Volks.MTS3_Rekord");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.MTS3_Rekord", "", "", "mts3_rekord", "");
}
}
public class AdvanceMagazineAudioProfile : MonoBehaviour
{
[Header("References")]
[Tooltip("Auto-populated from this GameObject if left empty.")]
public FVRFireArmMagazine Magazine;
[Header("Audio — Empty Magazine")]
[Tooltip("Profile used for MagazineIn / MagazineOut when the magazine is empty.")]
public FVRFirearmMagazineAudioSet EmptyProfile;
private FVRFirearmMagazineAudioSet _originalProfileOverride;
private bool _originalUsesOverrideInOut;
private bool _wasEmpty;
private void Start()
{
if ((Object)(object)Magazine == (Object)null)
{
Magazine = ((Component)this).GetComponent<FVRFireArmMagazine>();
}
if ((Object)(object)Magazine == (Object)null)
{
Debug.LogWarning((object)"[AdvanceMagazineAudioProfile] No FVRFireArmMagazine found on this GameObject.", (Object)(object)this);
((Behaviour)this).enabled = false;
return;
}
_originalProfileOverride = Magazine.ProfileOverride;
_originalUsesOverrideInOut = Magazine.UsesOverrideInOut;
_wasEmpty = !Magazine.HasARound();
ApplyProfile(_wasEmpty);
}
private void Update()
{
if (!((Object)(object)Magazine == (Object)null))
{
bool flag = !Magazine.HasARound();
if (flag != _wasEmpty)
{
_wasEmpty = flag;
ApplyProfile(flag);
}
}
}
private void ApplyProfile(bool isEmpty)
{
if (isEmpty && (Object)(object)EmptyProfile != (Object)null)
{
Magazine.UsesOverrideInOut = true;
Magazine.ProfileOverride = EmptyProfile;
}
else
{
Magazine.UsesOverrideInOut = _originalUsesOverrideInOut;
Magazine.ProfileOverride = _originalProfileOverride;
}
}
}
public class BoltReleaseChargingHandle : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public ClosedBoltHandle Handle;
public float LaunchSpeed = 5f;
[Tooltip("If true, the handle stays at Rear until bolt release is pressed again. If false, it returns forward when pulled back manually.")]
public bool HandleReturnsManually = false;
private bool m_wasLocked;
private void Start()
{
if ((Object)(object)Weapon == (Object)null || (Object)(object)Handle == (Object)null)
{
Debug.LogWarning((object)"[BoltReleaseChargingHandle] Weapon or Handle reference is missing.", (Object)(object)this);
((Behaviour)this).enabled = false;
}
else
{
m_wasLocked = Weapon.Bolt.IsBoltLocked();
}
}
private void Update()
{
//IL_005f: 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_0040: Invalid comparison between Unknown and I4
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Invalid comparison between Unknown and I4
bool flag = Weapon.Bolt.IsBoltLocked();
if (m_wasLocked && !flag && Weapon.HasBoltReleaseButton && (int)Handle.CurPos == 4)
{
Handle.Speed_Forward = LaunchSpeed;
}
if ((int)Handle.CurPos == 0 && Handle.Speed_Forward > 0f)
{
Handle.Speed_Forward = 0f;
}
if (!HandleReturnsManually && !flag && !((FVRInteractiveObject)Handle).IsHeld && (int)Handle.CurPos == 4 && Handle.Speed_Forward == 0f)
{
Handle.Speed_Forward = LaunchSpeed;
}
m_wasLocked = flag;
}
}
public class PartRecoilImpulse : MonoBehaviour
{
public enum ImpulseMode
{
Rotation,
Translation
}
public enum ImpulseAxis
{
X,
Y,
Z
}
[Serializable]
public class RecoilPart
{
public Transform Piece;
public ImpulseMode Mode = ImpulseMode.Rotation;
public ImpulseAxis Axis = ImpulseAxis.X;
public Vector2 Range = new Vector2(0f, 45f);
public float ReturnSpeed = 5f;
public float ImpulseStrength = 1f;
[NonSerialized]
public float CurrentLerp = 0f;
}
[Header("Parts")]
public List<RecoilPart> Parts = new List<RecoilPart>();
private FVRFireArm m_firearm;
private void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
private void OnDestroy()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if ((Object)(object)GM.CurrentSceneSettings != (Object)null)
{
GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
}
}
private void Start()
{
m_firearm = ((Component)this).GetComponentInParent<FVRFireArm>();
if ((Object)(object)m_firearm == (Object)null)
{
Debug.LogWarning((object)"[PartRecoilImpulse] No FVRFireArm found in parent hierarchy.", (Object)(object)this);
}
for (int i = 0; i < Parts.Count; i++)
{
ApplyToPart(Parts[i]);
}
}
private void OnShotFired(FVRFireArm firearm)
{
if (!((Object)(object)firearm != (Object)(object)m_firearm))
{
for (int i = 0; i < Parts.Count; i++)
{
Parts[i].CurrentLerp = Mathf.Clamp01(Parts[i].ImpulseStrength);
ApplyToPart(Parts[i]);
}
}
}
private void Update()
{
for (int i = 0; i < Parts.Count; i++)
{
RecoilPart recoilPart = Parts[i];
if (recoilPart.CurrentLerp > 0f)
{
recoilPart.CurrentLerp = Mathf.MoveTowards(recoilPart.CurrentLerp, 0f, Time.deltaTime * recoilPart.ReturnSpeed);
ApplyToPart(recoilPart);
}
}
}
private void ApplyToPart(RecoilPart part)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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)
if ((Object)(object)part.Piece == (Object)null)
{
return;
}
float num = Mathf.Lerp(part.Range.x, part.Range.y, part.CurrentLerp);
if (part.Mode == ImpulseMode.Rotation)
{
Vector3 localEulerAngles = part.Piece.localEulerAngles;
if (part.Axis == ImpulseAxis.X)
{
localEulerAngles.x = num;
}
else if (part.Axis == ImpulseAxis.Y)
{
localEulerAngles.y = num;
}
else
{
localEulerAngles.z = num;
}
part.Piece.localEulerAngles = localEulerAngles;
}
else
{
Vector3 localPosition = part.Piece.localPosition;
if (part.Axis == ImpulseAxis.X)
{
localPosition.x = num;
}
else if (part.Axis == ImpulseAxis.Y)
{
localPosition.y = num;
}
else
{
localPosition.z = num;
}
part.Piece.localPosition = localPosition;
}
}
}
public class SecondaryMagPos : MonoBehaviour
{
[Header("References")]
public FVRFireArm FireArm;
public FVRFireArmReloadTriggerWell TriggerWell;
[Header("Mount Override")]
public Transform MountPos;
public Transform EjectPos;
private Transform m_defaultMountPos;
private Transform m_defaultEjectPos;
private Vector3 m_defaultMountLocalPos;
private Quaternion m_defaultMountLocalRot;
private Vector3 m_defaultEjectLocalPos;
private Quaternion m_defaultEjectLocalRot;
private bool m_initialized = false;
private bool m_overrideActive = false;
private FVRFireArmMagazine m_pendingMag;
private int m_pendingStableFrames;
private const int kStableFramesRequired = 2;
private FVRFireArmMagazine m_appliedMag;
private void Start()
{
//IL_0095: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)FireArm == (Object)null || (Object)(object)TriggerWell == (Object)null)
{
((Behaviour)this).enabled = false;
return;
}
if ((Object)(object)MountPos == (Object)null)
{
((Behaviour)this).enabled = false;
return;
}
m_defaultMountPos = FireArm.MagazineMountPos;
m_defaultEjectPos = FireArm.MagazineEjectPos;
if ((Object)(object)m_defaultMountPos == (Object)null)
{
((Behaviour)this).enabled = false;
return;
}
m_defaultMountLocalPos = m_defaultMountPos.localPosition;
m_defaultMountLocalRot = m_defaultMountPos.localRotation;
if ((Object)(object)m_defaultEjectPos != (Object)null)
{
m_defaultEjectLocalPos = m_defaultEjectPos.localPosition;
m_defaultEjectLocalRot = m_defaultEjectPos.localRotation;
}
m_initialized = true;
m_pendingMag = null;
m_pendingStableFrames = 0;
m_appliedMag = null;
}
private void Update()
{
//IL_00b1: 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_00b6: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
if (!m_initialized)
{
return;
}
FVRFireArmMagazine magazine = FireArm.Magazine;
if ((Object)(object)magazine == (Object)(object)m_pendingMag)
{
if (m_pendingStableFrames < 2)
{
m_pendingStableFrames++;
}
}
else
{
m_pendingMag = magazine;
m_pendingStableFrames = 0;
}
if (m_pendingStableFrames < 2 || (Object)(object)m_pendingMag == (Object)(object)m_appliedMag)
{
return;
}
FireArmMagazineType val = ((!TriggerWell.UsesTypeOverride) ? FireArm.MagazineType : TriggerWell.TypeOverride);
if ((Object)(object)m_pendingMag != (Object)null && m_pendingMag.MagazineType == val)
{
m_overrideActive = true;
m_appliedMag = m_pendingMag;
return;
}
if (m_overrideActive)
{
m_overrideActive = false;
RestoreDefaults();
}
m_appliedMag = null;
}
private void LateUpdate()
{
//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_0077: 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)
if (m_initialized && m_overrideActive)
{
m_defaultMountPos.position = MountPos.position;
m_defaultMountPos.rotation = MountPos.rotation;
if ((Object)(object)m_defaultEjectPos != (Object)null && (Object)(object)EjectPos != (Object)null)
{
m_defaultEjectPos.position = EjectPos.position;
m_defaultEjectPos.rotation = EjectPos.rotation;
}
}
}
private void RestoreDefaults()
{
//IL_0008: 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_003c: 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)
m_defaultMountPos.localPosition = m_defaultMountLocalPos;
m_defaultMountPos.localRotation = m_defaultMountLocalRot;
if ((Object)(object)m_defaultEjectPos != (Object)null)
{
m_defaultEjectPos.localPosition = m_defaultEjectLocalPos;
m_defaultEjectPos.localRotation = m_defaultEjectLocalRot;
}
}
private void OnDisable()
{
if (m_initialized)
{
RestoreDefaults();
}
}
private void OnDestroy()
{
if (m_initialized)
{
RestoreDefaults();
}
}
}
public class SimpleCompass : MonoBehaviour
{
[Header("Target")]
[Tooltip("Assign Forward Z for North Facing, I think.")]
public Transform Target;
[Header("Text Version")]
public Text CompassText;
[Header("Image Version")]
[Tooltip("The arrow that will be rotated to indicate which direction.")]
public RectTransform CompassImage;
private void Update()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Target == (Object)null))
{
Vector3 forward = Target.forward;
forward.y = 0f;
((Vector3)(ref forward)).Normalize();
float num = Mathf.Atan2(forward.x, forward.z) * 57.29578f;
if (num < 0f)
{
num += 360f;
}
if ((Object)(object)CompassText != (Object)null)
{
CompassText.text = GetCardinalLabel(num) + " " + Mathf.RoundToInt(num) + "°";
}
if ((Object)(object)CompassImage != (Object)null)
{
((Transform)CompassImage).localEulerAngles = new Vector3(0f, 0f, num);
}
}
}
private string GetCardinalLabel(float angle)
{
if (angle < 22.5f || angle >= 337.5f)
{
return "N";
}
if (angle < 67.5f)
{
return "NE";
}
if (angle < 112.5f)
{
return "E";
}
if (angle < 157.5f)
{
return "SE";
}
if (angle < 202.5f)
{
return "S";
}
if (angle < 247.5f)
{
return "SW";
}
if (angle < 292.5f)
{
return "W";
}
return "NW";
}
}
public class InvertClosedBolt : MonoBehaviour
{
public Transform OptionalLockPointOverride;
private void Start()
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
ClosedBolt component = ((Component)this).GetComponent<ClosedBolt>();
if ((Object)(object)component == (Object)null)
{
Debug.LogWarning((object)"[InvertClosedBolt] No ClosedBolt component found on this GameObject.");
return;
}
Transform point_Bolt_Forward = component.Point_Bolt_Forward;
component.Point_Bolt_Forward = component.Point_Bolt_Rear;
component.Point_Bolt_Rear = point_Bolt_Forward;
if ((Object)(object)OptionalLockPointOverride != (Object)null)
{
component.Point_Bolt_LockPoint = OptionalLockPointOverride;
}
SetPrivateFloat(component, "m_boltZ_forward", LocalZ(component.Point_Bolt_Forward));
SetPrivateFloat(component, "m_boltZ_rear", LocalZ(component.Point_Bolt_Rear));
SetPrivateFloat(component, "m_boltZ_lock", LocalZ(component.Point_Bolt_LockPoint));
SetPrivateFloat(component, "m_boltZ_current", ((Component)component).transform.localPosition.z);
if (component.UsesAKSafetyLock && (Object)(object)component.Point_Bolt_SafetyLock != (Object)null)
{
SetPrivateFloat(component, "m_boltZ_safetylock", LocalZ(component.Point_Bolt_SafetyLock));
}
component.SnapToRear();
component.UpdateBolt();
}
private static float LocalZ(Transform t)
{
//IL_000e: 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)
return (!((Object)(object)t != (Object)null)) ? 0f : t.localPosition.z;
}
private static void SetPrivateFloat(ClosedBolt cb, string name, float value)
{
typeof(ClosedBolt).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(cb, value);
}
}
public class MagazineStock : MonoBehaviour
{
[Header("References")]
public FVRFireArm Weapon;
public int SecondarySlotIndex = 0;
public Transform Point_Stock;
[Header("Objects to disable when stocked")]
public GameObject[] ObjectsToDisableWhenStocked;
private bool _wasStocked;
private void Update()
{
SecondaryMagazineSlot val = Weapon.SecondaryMagazineSlots[SecondarySlotIndex];
if ((Object)(object)val.Magazine != (Object)null && (Object)(object)((FVRInteractiveObject)val.Magazine).m_hand != (Object)null)
{
Weapon.EjectSecondaryMagFromSlot(SecondarySlotIndex, true);
}
bool flag = (Object)(object)val.Magazine != (Object)null;
if (flag == _wasStocked)
{
return;
}
_wasStocked = flag;
if (flag)
{
Weapon.StockPos = Point_Stock;
Weapon.HasActiveShoulderStock = true;
}
else
{
Weapon.StockPos = null;
Weapon.HasActiveShoulderStock = false;
}
for (int i = 0; i < ObjectsToDisableWhenStocked.Length; i++)
{
if ((Object)(object)ObjectsToDisableWhenStocked[i] != (Object)null)
{
ObjectsToDisableWhenStocked[i].SetActive(!flag);
}
}
}
}
public class RifleToggleLock : MonoBehaviour
{
public ClosedBolt ClosedBolt;
public Transform BarrelSlide;
public Transform BarrelSlideForward;
public Transform BarrelSlideLockPoint;
public Transform TogglePiece1;
public Transform TogglePiece2;
public Transform TogglePiece3;
public Vector2 RotSet1 = new Vector2(0f, -86f);
public Vector2 RotSet2 = new Vector2(0f, 132.864f);
public Vector2 PosSet1 = new Vector2(0.02199817f, -0.02124f);
public float Height = 0.03527606f;
[Header("Motion Curves")]
[Tooltip("Drives BarrelSlide and TogglePiece1.")]
public AnimationCurve MotionCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
[Tooltip("Drives TogglePiece2 independently.")]
public AnimationCurve MotionCurvePiece2 = AnimationCurve.Linear(0f, 0f, 1f, 1f);
[Tooltip("Drives TogglePiece3 independently.")]
public AnimationCurve MotionCurvePiece3 = AnimationCurve.Linear(0f, 0f, 1f, 1f);
[Header("Debug")]
public bool DebugOverride = false;
[Range(0f, 1f)]
public float DebugLerp = 0f;
private void Update()
{
//IL_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
float num = ((!DebugOverride) ? (1f - ClosedBolt.GetBoltLerpBetweenRearAndFore()) : DebugLerp);
float num2 = MotionCurve.Evaluate(num);
float num3 = MotionCurvePiece2.Evaluate(num);
float num4 = MotionCurvePiece3.Evaluate(num);
BarrelSlide.localPosition = Vector3.Lerp(BarrelSlideForward.localPosition, BarrelSlideLockPoint.localPosition, num2);
float num5 = Mathf.Lerp(RotSet1.x, RotSet1.y, num2);
float num6 = Mathf.Lerp(RotSet2.x, RotSet2.y, num3);
float num7 = Mathf.Lerp(PosSet1.x, PosSet1.y, num4);
TogglePiece1.localEulerAngles = new Vector3(num5, 0f, 0f);
TogglePiece2.localEulerAngles = new Vector3(num6, 0f, 0f);
TogglePiece3.localPosition = new Vector3(0f, Height, num7);
}
}
internal class AutoReleaseOnMagLoad : MonoBehaviour
{
private FVRFireArm weapon;
private Handgun handgun;
private bool wasLoaded;
public void Start()
{
weapon = ((Component)this).GetComponent<FVRFireArm>();
if (!((Object)(object)weapon == (Object)null) && weapon is Handgun)
{
ref Handgun reference = ref handgun;
FVRFireArm obj = weapon;
reference = (Handgun)(object)((obj is Handgun) ? obj : null);
}
}
public void FixedUpdate()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Invalid comparison between Unknown and I4
if ((Object)(object)handgun != (Object)null)
{
if ((Object)(object)weapon.Magazine != (Object)null)
{
if (weapon.Magazine.HasARound())
{
if ((int)handgun.Slide.CurPos >= 2 && !wasLoaded)
{
handgun.Slide.ImpartFiringImpulse();
wasLoaded = true;
}
}
else
{
wasLoaded = false;
}
}
else
{
wasLoaded = false;
}
}
else
{
wasLoaded = false;
}
}
}
[RequireComponent(typeof(Collider))]
public class HandgunSlideControl : FVRInteractiveObject
{
[Serializable]
public class SlideControlSetting
{
public string SettingName;
[Header("Visual")]
public float SelectorPosition;
[Header("Slide Params")]
public float ForwardSpeed;
public float RearwardSpeed;
public float HeldSpeed;
public float SpringStiffness;
}
[Header("References")]
public Handgun Handgun;
public HandgunSlide Slide;
[Header("Settings")]
public SlideControlSetting[] Settings;
private int _index = 0;
[Header("Visual")]
public Transform ControlGeo;
public Axis Axis;
public InterpStyle InterpStyle;
[Header("Audio")]
public AudioEvent AudEvent_Switch;
[Header("UI")]
public GameObject TextRoot;
public TextMesh TextField;
public float TextDisplayDuration = 2f;
private bool _textVisible = false;
private float _textTimer = 0f;
public override void Awake()
{
((FVRInteractiveObject)this).Awake();
if ((Object)(object)Slide == (Object)null)
{
Debug.LogWarning((object)"[HandgunSlideControl] No HandgunSlide assigned.", (Object)(object)this);
}
if ((Object)(object)TextRoot != (Object)null)
{
TextRoot.SetActive(false);
}
if (Settings != null && Settings.Length > 0)
{
ApplySetting(0);
}
}
public override void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
if (!_textVisible)
{
return;
}
_textTimer -= Time.deltaTime;
if (_textTimer <= 0f)
{
_textVisible = false;
if ((Object)(object)TextRoot != (Object)null)
{
TextRoot.SetActive(false);
}
}
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
if (Settings != null && Settings.Length != 0)
{
_index++;
if (_index >= Settings.Length)
{
_index = 0;
}
ApplySetting(_index);
if ((Object)(object)Handgun != (Object)null)
{
((FVRFireArm)Handgun).PlayAudioAsHandling(AudEvent_Switch, ((Component)this).transform.position);
}
ShowText(Settings[_index].SettingName);
}
}
private void ApplySetting(int i)
{
//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)
SlideControlSetting slideControlSetting = Settings[i];
if ((Object)(object)ControlGeo != (Object)null && (Object)(object)Handgun != (Object)null)
{
((FVRPhysicalObject)Handgun).SetAnimatedComponent(ControlGeo, slideControlSetting.SelectorPosition, InterpStyle, Axis);
}
if (!((Object)(object)Slide == (Object)null))
{
Slide.Speed_Forward = slideControlSetting.ForwardSpeed;
Slide.Speed_Rearward = slideControlSetting.RearwardSpeed;
Slide.Speed_Held = slideControlSetting.HeldSpeed;
Slide.SpringStiffness = slideControlSetting.SpringStiffness;
}
}
private void ShowText(string settingName)
{
if (!((Object)(object)TextRoot == (Object)null))
{
if ((Object)(object)TextField != (Object)null)
{
TextField.text = settingName;
}
TextRoot.SetActive(true);
_textVisible = true;
_textTimer = TextDisplayDuration;
}
}
}
public class StreamlineDecocker : MonoBehaviour
{
public enum EStreamlineInputType
{
AXButton,
BYButton
}
public enum EInputType
{
TouchpadUp,
TouchpadDown,
TouchpadLeft,
TouchpadRight
}
[Header("Manual Handgun Decocker")]
public Handgun Handgun;
[Header("Streamlined Controls Input")]
public EStreamlineInputType StreamlineInputType;
[Header("Classic Controls Input")]
public EInputType InputType;
[Tooltip("Use this if you wanna use the safety as it is configured on the handgun itself.")]
public bool UsesHandgunSafetyObjectInstead = false;
[Header("Standalone decocker object.")]
public Transform Decocker;
public Axis DecockerAxis;
public InterpStyle DecockerInterpStyle;
public float DecockerReleased;
public float DecockerPressed;
private bool _wasDecocked = false;
public void Update()
{
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_00aa: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Handgun == (Object)null)
{
return;
}
FVRViveHand hand = ((FVRInteractiveObject)Handgun).m_hand;
if ((Object)(object)hand != (Object)null && CorrectInput(hand))
{
if (!_wasDecocked)
{
Handgun.DeCockHammer(true, true);
if (!UsesHandgunSafetyObjectInstead)
{
((FVRPhysicalObject)Handgun).SetAnimatedComponent(Decocker, DecockerPressed, DecockerInterpStyle, DecockerAxis);
}
else
{
((FVRPhysicalObject)Handgun).SetAnimatedComponent(Handgun.Safety, Handgun.SafetyOn, Handgun.Safety_Interp, Handgun.SafetyAxis);
}
_wasDecocked = true;
}
}
else if (_wasDecocked)
{
if (!UsesHandgunSafetyObjectInstead)
{
((FVRPhysicalObject)Handgun).SetAnimatedComponent(Decocker, DecockerReleased, DecockerInterpStyle, DecockerAxis);
}
else
{
((FVRPhysicalObject)Handgun).SetAnimatedComponent(Handgun.Safety, Handgun.SafetyOff, Handgun.Safety_Interp, Handgun.SafetyAxis);
}
_wasDecocked = false;
}
}
private bool CorrectInput(FVRViveHand hand)
{
//IL_0071: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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)
if (hand.IsInStreamlinedMode)
{
return StreamlineInputType switch
{
EStreamlineInputType.AXButton => hand.Input.AXButtonPressed,
EStreamlineInputType.BYButton => hand.Input.BYButtonDown,
_ => false,
};
}
Vector2 dir;
switch (InputType)
{
case EInputType.TouchpadUp:
dir = Vector2.up;
break;
case EInputType.TouchpadDown:
dir = Vector2.down;
break;
case EInputType.TouchpadLeft:
dir = Vector2.left;
break;
case EInputType.TouchpadRight:
dir = Vector2.right;
break;
default:
return false;
}
return TouchpadDirPressed(hand, dir);
}
private bool TouchpadDirPressed(FVRViveHand hand, Vector2 dir)
{
//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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (((Vector2)(ref touchpadAxes)).magnitude <= 0.2f)
{
return false;
}
float num = Vector2.Angle(touchpadAxes, dir);
if (num > 45f)
{
return false;
}
if (hand.Input.TouchpadDown || hand.Input.TouchpadPressed)
{
return true;
}
return false;
}
}