using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sodalite.ModPanel;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("NGA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("NGA.SafehouseMP")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace NGA
{
[BepInPlugin("NGA.SafehouseMP", "SafehouseMP", "0.0.1")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
[BepInDependency("nrgill28.Atlas", "1.0.0")]
[BepInProcess("h3vr.exe")]
public class SafehouseMP : BaseUnityPlugin
{
public struct MyWristButton
{
public Action<object> onclick;
public string name;
public int priority;
public MyWristButton(string name_, int priority_, Action<object> clickAction = null)
{
onclick = clickAction;
name = name_;
priority = priority_;
}
}
[HarmonyPatch(typeof(FVRWristMenu2))]
[HarmonyPatch("Awake")]
private class WristMenuAwakeHook
{
private static void Postfix(FVRWristMenu2 __instance)
{
if ((Object)(object)__instance == (Object)null)
{
Logger.LogMessage((object)"FVRWristMenu2 is null!?");
}
Dictionary<GameObject, MyWristButton> existingButtons = new Dictionary<GameObject, MyWristButton>();
FVRWristMenuSection_Safehouse fVRWristMenuSection_Safehouse = AddWristMenuSectionAndButton(__instance, null, "Safehouse MP", existingButtons, new MyWristButton("Save-Loadout", 4, SaveLoadout));
AddWristMenuSectionAndButton(__instance, fVRWristMenuSection_Safehouse, "Safehouse MP", existingButtons, new MyWristButton("Spawn-Loadout\n(Host ONLY)", 3, DeploySafehouseLoadout));
AddWristMenuSectionAndButton(__instance, fVRWristMenuSection_Safehouse, "Safehouse MP", existingButtons, new MyWristButton("Enter-Safehouse", 2, ExtractToSafehouse));
AddWristMenuSectionAndButton(__instance, fVRWristMenuSection_Safehouse, "Safehouse MP", existingButtons, new MyWristButton("Save-Safehouse", 1, SaveSafehouseScene));
int num = 0;
foreach (GameObject item in existingButtons.Keys.OrderBy((GameObject x) => existingButtons[x].priority))
{
Text componentInChildren = ((Component)item.transform).GetComponentInChildren<Text>();
if (num == 0)
{
fVRWristMenuSection_Safehouse.TXT_SaveSafehouse = componentInChildren;
}
if (num == 1)
{
fVRWristMenuSection_Safehouse.TXT_EnterSafehouse = componentInChildren;
}
if (num == 2)
{
fVRWristMenuSection_Safehouse.TXT_SpawnLoadout = componentInChildren;
}
if (num == 3)
{
fVRWristMenuSection_Safehouse.TXT_SaveLoadout = componentInChildren;
}
num++;
}
}
}
[HarmonyPatch(typeof(FVRSceneSettings))]
[HarmonyPatch("LoadDefaultSceneRoutine")]
private class FVRSceneSettingsLoadDefaultSceneRoutineHook
{
private static void Prefix(FVRSceneSettings __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == GetSafehouseName() && extracting_to_safehouse_need_map && Object.op_Implicit((Object)(object)GM.CurrentSceneSettings) && (Object)(object)GM.CurrentSceneSettings.DefaultVaultSceneConfig != (Object)null)
{
GM.CurrentSceneSettings.DefaultVaultSceneConfig = null;
}
}
private static void Postfix(FVRSceneSettings __instance)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null)
{
Logger.LogMessage((object)"FVRSceneSettings is null!?");
}
ManualLogSource logger = Logger;
Scene activeScene = SceneManager.GetActiveScene();
logger.LogMessage((object)("Scene ID: " + ((Scene)(ref activeScene)).name));
activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == GetSafehouseName() && extracting_to_safehouse_need_map)
{
extracting_to_safehouse_need_map = false;
VaultFile val = new VaultFile();
string text = GetSafehouseName() + "_" + safehouse_persistent_filename;
if (!VaultSystem.LoadVaultFile(text, (VaultFileDisplayMode)2, ref val))
{
Logger.LogMessage((object)"WARNING: Didn't find Safehouse file.");
}
string text2 = default(string);
if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)2, val, ref text2, (Transform)null, Vector3.up))
{
Logger.LogMessage((object)"ERROR: Loading safehouse scene file failed.");
Logger.LogMessage((object)text2);
}
}
}
}
public static string safehouse_persistent_filename = "SPH3MP_Safehouse_Scene";
public static string raid_extracted_loadout_filename = "SPH3MP_Saved_Loadout";
public static string safehouse_deployment_loadout_filename = "SPH3MP_OLD_Deployment_Filename";
public static string safehouse_backup_filename = "BackUp";
public static bool extracting_to_safehouse_need_loadout = false;
public static bool extracting_to_safehouse_need_map = false;
public static ConfigEntry<int> config_safehouse_index;
public static ConfigEntry<string> config_safehouse_scene_name;
public static ConfigEntry<string> config_safehouse_scene_name_TWO;
public static ConfigEntry<string> config_safehouse_scene_name_THREE;
public static ConfigEntry<bool> config_delete_loadout_on_spawn;
public static ConfigEntry<bool> config_delete_loadout_on_save;
public static ConfigEntry<int> config_chance_to_backup;
internal static ManualLogSource Logger { get; private set; }
public void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("NGA.SafehouseMP");
SetUpConfigFields();
val.PatchAll();
Logger.LogMessage((object)"Hello, world! Sent from NGA.SafehouseMP 0.0.1");
}
public void SetUpConfigFields()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
config_safehouse_index = ((BaseUnityPlugin)this).Config.Bind<int>("House", "SceneID INDEX", 1, new ConfigDescription("Swap between 3 safehouse scene IDs you specified below. All your safehouses will be saved.", (AcceptableValueBase)new AcceptableValueIntRangeStep(1, 3, 1), new object[0]));
config_safehouse_scene_name = ((BaseUnityPlugin)this).Config.Bind<string>("House", "Safehouse Scene ID: 1", "GP_Hangar", "Examples: IndoorRange, ArizonaTargets, Grillhouse_2Story. Find more in Thunderstore. Will CRASH if you get ID wrong.");
config_safehouse_scene_name_TWO = ((BaseUnityPlugin)this).Config.Bind<string>("House", "Safehouse Scene ID: 2", "IndoorRange", "Index: 2");
config_safehouse_scene_name_THREE = ((BaseUnityPlugin)this).Config.Bind<string>("House", "Safehouse Scene ID: 3", "Grillhouse_2Story", "Index: 3");
config_delete_loadout_on_spawn = ((BaseUnityPlugin)this).Config.Bind<bool>("Saving", "Delete Saved Loadout after Spawned", true, "Whether the loadout you saved will be deleted after you press the Spawn-Loadout button.");
config_delete_loadout_on_save = ((BaseUnityPlugin)this).Config.Bind<bool>("Saving", "Clear Quickbelt after Save-Loadout", false, "Will clear everything you're wearing from your quickbelt after clicking Save-Loadout.");
config_chance_to_backup = ((BaseUnityPlugin)this).Config.Bind<int>("Saving", "Chance to perform a backup (denominator)", 2, "Creates a backup with a 1 in (denominator) chance% every time scene is saved. Default denominator of 2 means 1/2 or 50% chance.");
}
public static string GetSafehouseName()
{
List<string> list = new List<string> { config_safehouse_scene_name.Value, config_safehouse_scene_name_TWO.Value, config_safehouse_scene_name_THREE.Value };
return list[config_safehouse_index.Value - 1];
}
public static void ExtractToSafehouse(object sender)
{
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse>();
if (!fVRWristMenuSection_Safehouse.confirmedEnterSafehouse)
{
fVRWristMenuSection_Safehouse.ResetConfirm();
fVRWristMenuSection_Safehouse.confirmedEnterSafehouse = true;
fVRWristMenuSection_Safehouse.TXT_EnterSafehouse.text = "Enter-Safehouse ???";
return;
}
fVRWristMenuSection_Safehouse.ResetConfirm();
extracting_to_safehouse_need_map = true;
for (int i = 0; i < GM.CurrentSceneSettings.QuitReceivers.Count; i++)
{
GM.CurrentSceneSettings.QuitReceivers[i].BroadcastMessage("QUIT", (SendMessageOptions)1);
}
if (((AnvilCallbackBase)GM.LoadingCallback).IsCompleted)
{
CustomSceneInfo customScene = AtlasPlugin.GetCustomScene(GetSafehouseName());
if (customScene != null)
{
AtlasPlugin.LoadCustomScene(GetSafehouseName());
}
else
{
SteamVR_LoadLevel.Begin(GetSafehouseName(), false, 0.5f, 0f, 0f, 0f, 1f);
}
}
}
public static void SaveLoadout(object sender)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse>();
if (!fVRWristMenuSection_Safehouse.confirmedSaveLoadout)
{
fVRWristMenuSection_Safehouse.ResetConfirm();
fVRWristMenuSection_Safehouse.confirmedSaveLoadout = true;
fVRWristMenuSection_Safehouse.TXT_SaveLoadout.text = "Save-Loadout ???";
return;
}
fVRWristMenuSection_Safehouse.ResetConfirm();
VaultFile val2 = new VaultFile();
if (VaultSystem.FindAndScanObjectsInQuickbelt(val2))
{
if (!VaultSystem.SaveVaultFile(raid_extracted_loadout_filename, (VaultFileDisplayMode)1, val2))
{
Logger.LogMessage((object)"ERROR: Saving loadout failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else if (config_delete_loadout_on_save.Value)
{
VaultFile val3 = new VaultFile();
FVRPlayerBody val4 = Object.FindObjectOfType<FVRPlayerBody>();
Transform transform = new GameObject().transform;
transform.position = ((Component)val4).transform.position;
string text = default(string);
if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)1, val3, ref text, transform, Vector3.zero))
{
Logger.LogMessage((object)("ERROR: Couldn't spawn empty loadout w status: " + text));
}
}
}
else
{
Logger.LogMessage((object)"ERROR: Quickbelt scan failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
}
public static void SaveSafehouseScene(object sender)
{
//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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse>();
if (!fVRWristMenuSection_Safehouse.confirmedSaveSafehouse)
{
fVRWristMenuSection_Safehouse.ResetConfirm();
fVRWristMenuSection_Safehouse.confirmedSaveSafehouse = true;
fVRWristMenuSection_Safehouse.TXT_SaveSafehouse.text = "Save-Safehouse ???";
return;
}
fVRWristMenuSection_Safehouse.ResetConfirm();
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != GetSafehouseName())
{
Logger.LogMessage((object)("WARNING: Won't save since this isn't selected House: " + GetSafehouseName()));
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
return;
}
VaultFile val2 = new VaultFile();
if (VaultSystem.FindAndScanObjectsInScene(val2))
{
string text = GetSafehouseName() + "_" + safehouse_persistent_filename;
if (!VaultSystem.SaveVaultFile(text, (VaultFileDisplayMode)2, val2))
{
Logger.LogMessage((object)"ERROR: Scene Vault save failed");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
return;
}
int num = Random.Range(1, config_chance_to_backup.Value + 1);
if (num != 1)
{
return;
}
VaultFile val3 = new VaultFile();
if (!VaultSystem.FindAndScanObjectsInScene(val3))
{
return;
}
string text2 = DateTime.Now.ToString("yyyyMMdd_HHmmss");
string text3 = GetSafehouseName() + "_" + safehouse_backup_filename + "_" + text2;
if (!VaultSystem.SaveVaultFile(text3, (VaultFileDisplayMode)2, val3))
{
Logger.LogMessage((object)"ERROR: BACKUP Scene Vault save failed");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
}
else
{
Logger.LogMessage((object)"ERROR: Scene scan failed");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
}
public static void DeploySafehouseLoadout(object sender)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_0073: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse>();
if (!fVRWristMenuSection_Safehouse.confirmedSpawnLoadout)
{
fVRWristMenuSection_Safehouse.ResetConfirm();
fVRWristMenuSection_Safehouse.confirmedSpawnLoadout = true;
fVRWristMenuSection_Safehouse.TXT_SpawnLoadout.text = "Spawn-Loadout ???";
return;
}
fVRWristMenuSection_Safehouse.ResetConfirm();
FVRPlayerBody val2 = Object.FindObjectOfType<FVRPlayerBody>();
Transform transform = new GameObject().transform;
transform.position = ((Component)val2).transform.position;
VaultFile val3 = new VaultFile();
string text = default(string);
if (!VaultSystem.LoadVaultFile(raid_extracted_loadout_filename, (VaultFileDisplayMode)1, ref val3))
{
Logger.LogMessage((object)"ERROR: Loading saved loadout failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)1, val3, ref text, transform, Vector3.zero))
{
Logger.LogMessage((object)"ERROR: Spawning saved loadout failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else if (config_delete_loadout_on_spawn.Value)
{
VaultFile val4 = new VaultFile();
VaultSystem.SaveVaultFile(raid_extracted_loadout_filename, (VaultFileDisplayMode)1, val4);
}
}
public static void AddWristMenuButton(FVRWristMenuSection shMenuSection, MyWristButton new_button, Transform buttonTransform)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
((Component)buttonTransform).GetComponentInChildren<Text>().text = new_button.name;
Button component = ((Component)buttonTransform).GetComponent<Button>();
component.onClick = new ButtonClickedEvent();
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
SM.PlayGlobalUISound((GlobalUISound)0, buttonTransform.position);
new_button.onclick(component);
});
}
public static void ResizeAndReorderSection(RectTransform background, int oldButtonCount, Dictionary<GameObject, MyWristButton> existingButtons)
{
//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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_002a: 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_0042: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
Vector2 sizeDelta = background.sizeDelta;
int childCount = ((Transform)background).childCount;
RectTransform val = (RectTransform)((Transform)background).GetChild(0);
float num = val.sizeDelta.y * ((Transform)val).localScale.y;
float num2 = (sizeDelta.y - num * (float)oldButtonCount) / (float)(oldButtonCount + 2);
float num3 = num + num2;
background.sizeDelta = new Vector2(sizeDelta.x, (float)childCount * num3 + num2 * 2f);
float num4 = num3 / 2f + num2;
foreach (GameObject item in existingButtons.Keys.OrderBy((GameObject x) => existingButtons[x].priority))
{
item.transform.localPosition = new Vector3(0f, num4, 0f);
num4 += num3;
}
}
public static FVRWristMenuSection_Safehouse AddWristMenuSectionAndButton(FVRWristMenu2 instance2, FVRWristMenuSection_Safehouse menuSection, string sectionText, Dictionary<GameObject, MyWristButton> existingButtons, MyWristButton new_button)
{
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Expected O, but got Unknown
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
//IL_0049: 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_00ef: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
if ((Object)(object)menuSection == (Object)null)
{
FVRWristMenuSection val = instance2.Sections.First((FVRWristMenuSection x) => (object)((object)x).GetType() == typeof(FVRWristMenuSection_Spawn));
Transform transform = ((Component)val).transform;
FVRWristMenuSection val2 = Object.Instantiate<FVRWristMenuSection>(val, transform.position, transform.rotation, transform.parent);
GameObject gameObject = ((Component)val2).gameObject;
Object.Destroy((Object)(object)val2);
Renderer component = gameObject.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
Color color = default(Color);
((Color)(ref color))..ctor(0.3f, 0.67f, 0.3f, 1f);
component.material.color = color;
}
menuSection = gameObject.AddComponent<FVRWristMenuSection_Safehouse>();
((FVRWristMenuSection)menuSection).ButtonText = sectionText;
((FVRWristMenuSection)menuSection).Menu = instance2;
instance2.Sections.Add((FVRWristMenuSection)(object)menuSection);
instance2.RegenerateButtons();
RectTransform val3 = (RectTransform)((Component)menuSection).transform;
RectTransform val4 = (RectTransform)((Transform)val3).GetChild(0);
int childCount = ((Transform)val3).childCount;
for (int num = childCount - 1; num >= 0; num--)
{
RectTransform val5 = (RectTransform)((Transform)val3).GetChild(num);
if (!((Object)(object)val5 == (Object)(object)val4))
{
Object.DestroyImmediate((Object)(object)((Component)val5).gameObject);
}
}
existingButtons.Add(((Component)val4).gameObject, new_button);
AddWristMenuButton((FVRWristMenuSection)(object)menuSection, new_button, (Transform)(object)val4);
ResizeAndReorderSection(val3, childCount, existingButtons);
return menuSection;
}
RectTransform val6 = (RectTransform)((Component)menuSection).transform;
Transform child = ((Transform)val6).GetChild(0);
RectTransform val7 = (RectTransform)Object.Instantiate<GameObject>(((Component)child).gameObject, child.position, child.rotation, child.parent).transform;
existingButtons.Add(((Component)val7).gameObject, new_button);
AddWristMenuButton((FVRWristMenuSection)(object)menuSection, new_button, (Transform)(object)val7);
ResizeAndReorderSection(val6, ((Transform)val6).childCount - 1, existingButtons);
return menuSection;
}
}
public class FVRWristMenuSection_Safehouse : FVRWristMenuSection
{
public Text TXT_SaveLoadout;
public Text TXT_SpawnLoadout;
public Text TXT_EnterSafehouse;
public Text TXT_SaveSafehouse;
public bool confirmedSaveLoadout = false;
public bool confirmedSpawnLoadout = false;
public bool confirmedEnterSafehouse = false;
public bool confirmedSaveSafehouse = false;
public void ResetConfirm()
{
confirmedSaveLoadout = false;
confirmedSpawnLoadout = false;
confirmedEnterSafehouse = false;
confirmedSaveSafehouse = false;
TXT_SaveLoadout.text = "Save-Loadout";
TXT_SpawnLoadout.text = "Spawn-Loadout";
TXT_EnterSafehouse.text = "Enter-Safehouse";
TXT_SaveSafehouse.text = "Save-Safehouse";
}
public override void OnHide()
{
ResetConfirm();
}
}
}