using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TooManySuits;
using TooManySuits.Helper;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TooManySuitsInWorldButtons")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod which adds in world buttons to TooManySuits allowing it to work in VR")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+4a20373b5de8ca2c3db3a7b49e9986976109a0e9")]
[assembly: AssemblyProduct("TooManySuitsInWorldButtons")]
[assembly: AssemblyTitle("TooManySuitsInWorldButtons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace TooManySuitsInWorldButtons
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "TooManySuitsInWorldButtons";
public const string PLUGIN_NAME = "TooManySuitsInWorldButtons";
public const string PLUGIN_VERSION = "1.0.1";
}
}
namespace RT0405.TooManySuitsInWorldButtons
{
[BepInPlugin("RT0405.TooManySuitsInWorldButtons", "TooManySuitsInWorldButtons", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class TooManySuitsInWorldButtons : BaseUnityPlugin
{
public const string PLUGIN_GUID = "RT0405.TooManySuitsInWorldButtons";
public const string PLUGIN_NAME = "TooManySuitsInWorldButtons";
public const string PLUGIN_VERSION = "1.0.2";
private static Transform suitPanelTransform;
private static bool recreateButtons;
private static Transform leftButton;
private static Transform rightButton;
private static readonly Sprite emptySprite = Sprite.Create(new Rect(0f, 0f, 1f, 1f), Vector2.zero, 1f);
public void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RT0405.TooManySuitsInWorldButtons loading...");
Harmony.CreateAndPatchAll(typeof(TooManySuitsInWorldButtons), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RT0405.TooManySuitsInWorldButtons loaded!");
}
[HarmonyPatch(typeof(PluginLoader), "Update")]
[HarmonyPostfix]
public static void Update(PluginLoader __instance)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00a0: 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)
//IL_00b5: 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)
if (recreateButtons)
{
recreateButtons = false;
leftButton = ((Component)CreateTrigger(isRight: false, __instance)).transform;
rightButton = ((Component)CreateTrigger(isRight: true, __instance)).transform;
}
if ((Object)(object)suitPanelTransform != (Object)null && (Object)(object)leftButton != (Object)null)
{
Vector3 position = suitPanelTransform.position;
Quaternion rotation = suitPanelTransform.rotation;
((Component)leftButton).transform.SetPositionAndRotation(position + rotation * new Vector3(-0.9f, 0f, 0f), rotation);
((Component)rightButton).transform.SetPositionAndRotation(position + rotation * new Vector3(0.9f, 0f, 0f), rotation);
bool activeInHierarchy = ((Component)suitPanelTransform).gameObject.activeInHierarchy;
((Component)leftButton).gameObject.SetActive(activeInHierarchy);
((Component)rightButton).gameObject.SetActive(activeInHierarchy);
}
}
[HarmonyPatch(typeof(Hooks), "HookStartGame")]
[HarmonyPostfix]
private static void HookStartGame()
{
if ((Object)(object)leftButton != (Object)null)
{
Object.Destroy((Object)(object)leftButton);
}
if ((Object)(object)rightButton != (Object)null)
{
Object.Destroy((Object)(object)rightButton);
}
leftButton = (rightButton = null);
suitPanelTransform = ((Component)Hooks.SuitPanel.GetComponentInChildren<Canvas>()).transform;
recreateButtons = true;
}
private static InteractTrigger CreateTrigger(bool isRight, PluginLoader plugin)
{
//IL_0055: 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_00c6: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
InteractTrigger component = new GameObject(isRight ? "RightSuitCycleButton" : "LeftSuitCycleButton", new Type[3]
{
typeof(NetworkObject),
typeof(InteractTrigger),
typeof(BoxCollider)
}).GetComponent<InteractTrigger>();
((Component)component).gameObject.tag = "InteractTrigger";
((Component)component).gameObject.layer = LayerMask.NameToLayer("InteractableObject");
component.interactable = true;
component.oneHandedItemAllowed = true;
component.holdInteraction = false;
component.hoverTip = (isRight ? "Cycle Suits Right" : "Cycle Suits Left");
component.interactCooldown = false;
component.onInteract = new InteractEvent();
component.onInteractEarly = new InteractEvent();
component.onCancelAnimation = new InteractEvent();
component.onStopInteract = new InteractEvent();
component.holdingInteractEvent = new InteractEventFloat();
((UnityEvent<PlayerControllerB>)(object)component.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate(PlayerControllerB a)
{
//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)
//IL_001e: 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)
if (!((Object)(object)a != (Object)(object)LocalPlayer.localPlayer))
{
if (isRight)
{
plugin.MoveRightAction(default(CallbackContext));
}
else
{
plugin.MoveLeftAction(default(CallbackContext));
}
}
});
component.hoverIcon = emptySprite;
((Component)component).GetComponent<BoxCollider>().size = new Vector3(0.8f, 0.2f, 0.8f);
ScanNodeProperties component2 = new GameObject("Scan Node", new Type[2]
{
typeof(BoxCollider),
typeof(ScanNodeProperties)
}).GetComponent<ScanNodeProperties>();
((Component)component2).transform.parent = ((Component)component).transform;
((Component)component2).transform.localPosition = Vector3.zero;
((Component)component2).gameObject.layer = LayerMask.NameToLayer("ScanNode");
component2.headerText = component.hoverTip;
component2.requiresLineOfSight = true;
component2.minRange = 1;
component2.maxRange = 8;
((Component)component2).GetComponent<BoxCollider>().size = new Vector3(0.1f, 0.1f, 0.1f);
return component;
}
}
}