using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LoadoutPresets")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Template Mod")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+aa7258c8fc043eca3f5bf34d8c6087f3cb106c75")]
[assembly: AssemblyProduct("LoadoutPresets")]
[assembly: AssemblyTitle("LoadoutPresets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.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 LoadoutPresets
{
[BepInPlugin("ZeusesNeckMeat_LoadoutPresets", "LoadoutPresets", "0.1.2")]
public class LoadoutPresets : BasePlugin
{
private const string _MODNAME = "LoadoutPresets";
private const string _AUTHOR = "ZeusesNeckMeat";
private const string _GUID = "ZeusesNeckMeat_LoadoutPresets";
private const string _VERSION = "0.1.2";
private static ManualLogSource _logger;
private static string _LoadoutPresetsFolder;
private static GameObject _loadoutMenuPanel;
private static Transform _loadoutListContainer;
private static GameObject _saveDialogPanel;
private static TMP_InputField _loadoutNameInput;
private static GameObject _loadoutButton;
private static Button _referenceButton;
public LoadoutPresets()
{
_logger = ((BasePlugin)this).Log;
}
public override void Load()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_00ba: 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_0096: Expected O, but got Unknown
ManualLogSource logger = _logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("LoadoutPresets");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.1.2");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" by ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ZeusesNeckMeat");
}
logger.LogInfo(val);
_LoadoutPresetsFolder = Path.Combine(Paths.ConfigPath, "LoadoutPresets");
if (!Directory.Exists(_LoadoutPresetsFolder))
{
Directory.CreateDirectory(_LoadoutPresetsFolder);
ManualLogSource logger2 = _logger;
val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Created LoadoutPresets folder at: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(_LoadoutPresetsFolder);
}
logger2.LogInfo(val);
}
new Harmony("ZeusesNeckMeat_LoadoutPresets").PatchAll();
SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)SceneManager_sceneLoaded);
}
private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
ManualLogSource logger = _logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Scene loaded: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Scene)(ref scene)).name);
}
logger.LogInfo(val);
if (((Scene)(ref scene)).name != "MainMenu")
{
return;
}
GameObject val2 = ((IEnumerable<GameObject>)((Scene)(ref scene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "UI"));
if (!Object.op_Implicit((Object)(object)val2))
{
_logger.LogError((object)"UI root object not found!");
return;
}
Transform val3 = val2.transform.Find("Tabs/Menu/Content/Main/ExtraButtons");
if (!Object.op_Implicit((Object)(object)val3))
{
_logger.LogError((object)"ExtraButtons ui component not found!");
return;
}
if (Object.op_Implicit((Object)(object)val3.Find("B_LoadoutPresets")))
{
_logger.LogInfo((object)"LoadoutPresets button already exists, skipping creation");
return;
}
Transform val4 = val3.Find("B_Settings");
if (!Object.op_Implicit((Object)(object)val4))
{
_logger.LogError((object)"Settings button not found!");
return;
}
Button component = ((Component)val4).GetComponent<Button>();
CreateLoadoutButton(val3, component);
}
private void CreateLoadoutButton(Transform parentTransform, Button settingsButton)
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0094: 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_00ac: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
_logger.LogInfo((object)"Creating LoadoutPresets button...");
_referenceButton = settingsButton;
RectTransform component = ((Component)settingsButton).GetComponent<RectTransform>();
Image component2 = ((Component)settingsButton).GetComponent<Image>();
TextMeshProUGUI componentInChildren = ((Component)settingsButton).GetComponentInChildren<TextMeshProUGUI>();
((Component)settingsButton).transform.Find("Icon");
((Component)settingsButton).transform.Find("DisabledOverlay");
int siblingIndex = ((Component)settingsButton).transform.GetSiblingIndex();
_loadoutButton = new GameObject("B_LoadoutPresets");
_loadoutButton.transform.SetParent(parentTransform, false);
_loadoutButton.transform.SetSiblingIndex(siblingIndex);
RectTransform obj = _loadoutButton.AddComponent<RectTransform>();
obj.sizeDelta = component.sizeDelta;
obj.anchorMin = component.anchorMin;
obj.anchorMax = component.anchorMax;
obj.pivot = component.pivot;
Image val = _loadoutButton.AddComponent<Image>();
if (Object.op_Implicit((Object)(object)component2))
{
val.sprite = component2.sprite;
((Graphic)val).color = ((Graphic)component2).color;
val.type = component2.type;
}
Button obj2 = _loadoutButton.AddComponent<Button>();
((Selectable)obj2).colors = ((Selectable)settingsButton).colors;
((Selectable)obj2).transition = ((Selectable)settingsButton).transition;
((Selectable)obj2).targetGraphic = (Graphic)(object)val;
((UnityEvent)obj2.onClick).AddListener(UnityAction.op_Implicit((Action)OnLoadoutPresetsButtonClicked));
if (Object.op_Implicit((Object)(object)componentInChildren))
{
GameObject val2 = new GameObject("T_Text");
val2.transform.SetParent(_loadoutButton.transform, false);
RectTransform obj3 = val2.AddComponent<RectTransform>();
RectTransform component3 = ((Component)componentInChildren).GetComponent<RectTransform>();
obj3.anchorMin = component3.anchorMin;
obj3.anchorMax = component3.anchorMax;
obj3.anchoredPosition = component3.anchoredPosition;
obj3.sizeDelta = component3.sizeDelta;
obj3.pivot = component3.pivot;
TextMeshProUGUI obj4 = val2.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj4).text = "Loadouts";
((TMP_Text)obj4).fontSize = ((TMP_Text)componentInChildren).fontSize;
((TMP_Text)obj4).font = ((TMP_Text)componentInChildren).font;
((Graphic)obj4).color = ((Graphic)componentInChildren).color;
((TMP_Text)obj4).alignment = (TextAlignmentOptions)514;
((TMP_Text)obj4).fontStyle = ((TMP_Text)componentInChildren).fontStyle;
((TMP_Text)obj4).fontSizeMin = ((TMP_Text)componentInChildren).fontSizeMin;
((TMP_Text)obj4).fontSizeMax = ((TMP_Text)componentInChildren).fontSizeMax;
((TMP_Text)obj4).autoSizeTextContainer = true;
((TMP_Text)obj4).margin = ((TMP_Text)componentInChildren).margin;
}
_logger.LogInfo((object)"LoadoutPresets button created successfully!");
if (!Object.op_Implicit((Object)(object)_loadoutMenuPanel))
{
CreateLoadoutMenu(parentTransform.root);
}
}
private void CreateLoadoutMenu(Transform canvasRoot)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_004e: 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_0063: 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_00bb: 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_00cc: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Expected O, but got Unknown
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
_loadoutMenuPanel = new GameObject("LoadoutMenuPanel");
_loadoutMenuPanel.transform.SetParent(canvasRoot, false);
Canvas obj = _loadoutMenuPanel.AddComponent<Canvas>();
obj.overrideSorting = true;
obj.sortingOrder = 100;
_loadoutMenuPanel.AddComponent<GraphicRaycaster>();
RectTransform component = _loadoutMenuPanel.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
((Graphic)_loadoutMenuPanel.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.8f);
Button obj2 = _loadoutMenuPanel.AddComponent<Button>();
((UnityEvent)obj2.onClick).AddListener(UnityAction.op_Implicit((Action)CloseLoadoutMenu));
((Selectable)obj2).navigation = new Navigation
{
mode = (Mode)0
};
GameObject val = new GameObject("ContentPanel");
val.transform.SetParent(_loadoutMenuPanel.transform, false);
RectTransform obj3 = val.AddComponent<RectTransform>();
obj3.anchorMin = new Vector2(0.2f, 0.2f);
obj3.anchorMax = new Vector2(0.8f, 0.8f);
obj3.sizeDelta = Vector2.zero;
((Graphic)val.AddComponent<Image>()).color = new Color(0.1f, 0.1f, 0.1f, 1f);
GameObject val2 = new GameObject("Title");
val2.transform.SetParent(val.transform, false);
RectTransform obj4 = val2.AddComponent<RectTransform>();
obj4.anchorMin = new Vector2(0f, 0.9f);
obj4.anchorMax = new Vector2(1f, 1f);
obj4.sizeDelta = Vector2.zero;
TextMeshProUGUI obj5 = val2.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj5).text = "Loadout Manager";
((TMP_Text)obj5).fontSize = 36f;
((TMP_Text)obj5).alignment = (TextAlignmentOptions)514;
CreateMenuButton(val.transform, "Save Current Loadout", new Vector2(0.05f, 0.82f), new Vector2(0.35f, 0.88f), ShowSaveDialog, _referenceButton);
CreateMenuButton(val.transform, "Open Folder", new Vector2(0.37f, 0.82f), new Vector2(0.63f, 0.88f), OpenLoadoutPresetsFolder, _referenceButton);
CreateMenuButton(val.transform, "Close", new Vector2(0.65f, 0.82f), new Vector2(0.95f, 0.88f), CloseLoadoutMenu, _referenceButton);
GameObject val3 = new GameObject("ScrollView");
val3.transform.SetParent(val.transform, false);
RectTransform obj6 = val3.AddComponent<RectTransform>();
obj6.anchorMin = new Vector2(0.05f, 0.05f);
obj6.anchorMax = new Vector2(0.95f, 0.78f);
obj6.sizeDelta = Vector2.zero;
((Graphic)val3.AddComponent<Image>()).color = new Color(0.05f, 0.05f, 0.05f, 1f);
val3.AddComponent<Mask>().showMaskGraphic = true;
GameObject val4 = new GameObject("Container");
val4.transform.SetParent(val3.transform, false);
RectTransform obj7 = val4.AddComponent<RectTransform>();
obj7.anchorMin = new Vector2(0f, 1f);
obj7.anchorMax = new Vector2(1f, 1f);
obj7.pivot = new Vector2(0.5f, 1f);
obj7.anchoredPosition = Vector2.zero;
obj7.sizeDelta = new Vector2(0f, 0f);
_loadoutListContainer = val4.transform;
_loadoutMenuPanel.SetActive(false);
CreateSaveDialog(canvasRoot);
}
private void CreateSaveDialog(Transform canvasRoot)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_0051: 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_0066: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00ca: 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)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: 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_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Expected O, but got Unknown
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
_saveDialogPanel = new GameObject("SaveDialogPanel");
_saveDialogPanel.transform.SetParent(canvasRoot, false);
Canvas obj = _saveDialogPanel.AddComponent<Canvas>();
obj.overrideSorting = true;
obj.sortingOrder = 200;
_saveDialogPanel.AddComponent<GraphicRaycaster>();
RectTransform component = _saveDialogPanel.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
((Graphic)_saveDialogPanel.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.9f);
GameObject val = new GameObject("DialogContent");
val.transform.SetParent(_saveDialogPanel.transform, false);
RectTransform obj2 = val.AddComponent<RectTransform>();
obj2.anchorMin = new Vector2(0.3f, 0.4f);
obj2.anchorMax = new Vector2(0.7f, 0.6f);
obj2.sizeDelta = Vector2.zero;
((Graphic)val.AddComponent<Image>()).color = new Color(0.15f, 0.15f, 0.15f, 1f);
GameObject val2 = new GameObject("Title");
val2.transform.SetParent(val.transform, false);
RectTransform obj3 = val2.AddComponent<RectTransform>();
obj3.anchorMin = new Vector2(0.05f, 0.7f);
obj3.anchorMax = new Vector2(0.95f, 0.9f);
obj3.sizeDelta = Vector2.zero;
TextMeshProUGUI obj4 = val2.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj4).text = "Enter Loadout Name";
((TMP_Text)obj4).fontSize = 28f;
((TMP_Text)obj4).alignment = (TextAlignmentOptions)514;
GameObject val3 = new GameObject("InputField");
val3.transform.SetParent(val.transform, false);
RectTransform obj5 = val3.AddComponent<RectTransform>();
obj5.anchorMin = new Vector2(0.1f, 0.45f);
obj5.anchorMax = new Vector2(0.9f, 0.65f);
obj5.sizeDelta = Vector2.zero;
((Graphic)val3.AddComponent<Image>()).color = new Color(0.2f, 0.2f, 0.2f, 1f);
_loadoutNameInput = val3.AddComponent<TMP_InputField>();
_loadoutNameInput.textComponent = (TMP_Text)(object)CreateInputTextComponent(val3.transform);
_loadoutNameInput.placeholder = (Graphic)(object)CreatePlaceholderComponent(val3.transform);
_loadoutNameInput.text = "";
((Selectable)_loadoutNameInput).navigation = new Navigation
{
mode = (Mode)3
};
CreateMenuButton(val.transform, "Save", new Vector2(0.1f, 0.1f), new Vector2(0.45f, 0.35f), SaveLoadoutFromDialog, _referenceButton);
CreateMenuButton(val.transform, "Cancel", new Vector2(0.55f, 0.1f), new Vector2(0.9f, 0.35f), CloseSaveDialog, _referenceButton);
_saveDialogPanel.SetActive(false);
}
private static TextMeshProUGUI CreateInputTextComponent(Transform parent)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0028: 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_0047: 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)
GameObject val = new GameObject("Text");
val.transform.SetParent(parent, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.05f, 0f);
obj.anchorMax = new Vector2(0.95f, 1f);
obj.sizeDelta = Vector2.zero;
TextMeshProUGUI obj2 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj2).fontSize = 24f;
((TMP_Text)obj2).alignment = (TextAlignmentOptions)513;
((Graphic)obj2).color = Color.white;
return obj2;
}
private static TextMeshProUGUI CreatePlaceholderComponent(Transform parent)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0028: 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_0047: 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)
GameObject val = new GameObject("Placeholder");
val.transform.SetParent(parent, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.05f, 0f);
obj.anchorMax = new Vector2(0.95f, 1f);
obj.sizeDelta = Vector2.zero;
TextMeshProUGUI obj2 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj2).text = "My Loadout";
((TMP_Text)obj2).fontSize = 24f;
((TMP_Text)obj2).alignment = (TextAlignmentOptions)513;
((Graphic)obj2).color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
return obj2;
}
private static void CreateMenuButton(Transform parent, string text, Vector2 anchorMin, Vector2 anchorMax, Action onClick, Button referenceButton = null)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0025: 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_0032: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Button_" + text);
val.transform.SetParent(parent, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = anchorMin;
obj.anchorMax = anchorMax;
obj.sizeDelta = Vector2.zero;
Image val2 = val.AddComponent<Image>();
((Graphic)val2).color = new Color(0.2f, 0.4f, 0.6f, 1f);
Button val3 = val.AddComponent<Button>();
((Selectable)val3).targetGraphic = (Graphic)(object)val2;
((UnityEvent)val3.onClick).AddListener(UnityAction.op_Implicit(onClick));
if (Object.op_Implicit((Object)(object)referenceButton))
{
((Selectable)val3).colors = ((Selectable)referenceButton).colors;
((Selectable)val3).transition = ((Selectable)referenceButton).transition;
}
else
{
ColorBlock val4 = default(ColorBlock);
((ColorBlock)(ref val4)).normalColor = new Color(1f, 1f, 1f, 1f);
((ColorBlock)(ref val4)).highlightedColor = new Color(0.9f, 0.9f, 0.9f, 1f);
((ColorBlock)(ref val4)).pressedColor = new Color(0.7f, 0.7f, 0.7f, 1f);
((ColorBlock)(ref val4)).selectedColor = new Color(0.9f, 0.9f, 0.9f, 1f);
((ColorBlock)(ref val4)).disabledColor = new Color(0.5f, 0.5f, 0.5f, 0.5f);
((ColorBlock)(ref val4)).colorMultiplier = 1f;
((ColorBlock)(ref val4)).fadeDuration = 0.1f;
ColorBlock colors = val4;
((Selectable)val3).colors = colors;
((Selectable)val3).transition = (Transition)1;
}
((Selectable)val3).navigation = new Navigation
{
mode = (Mode)3
};
GameObject val5 = new GameObject("Text");
val5.transform.SetParent(val.transform, false);
RectTransform obj2 = val5.AddComponent<RectTransform>();
obj2.anchorMin = Vector2.zero;
obj2.anchorMax = Vector2.one;
obj2.sizeDelta = Vector2.zero;
TextMeshProUGUI obj3 = val5.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj3).text = text;
((TMP_Text)obj3).fontSize = 24f;
((TMP_Text)obj3).alignment = (TextAlignmentOptions)514;
}
private static void ShowSaveDialog()
{
if (Object.op_Implicit((Object)(object)_saveDialogPanel))
{
_saveDialogPanel.SetActive(true);
_loadoutNameInput.text = "Loadout_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
((Selectable)_loadoutNameInput).Select();
_loadoutNameInput.ActivateInputField();
}
}
private static void CloseSaveDialog()
{
if (Object.op_Implicit((Object)(object)_saveDialogPanel))
{
_saveDialogPanel.SetActive(false);
}
}
private static void SaveLoadoutFromDialog()
{
string text = _loadoutNameInput.text.Trim();
if (string.IsNullOrEmpty(text))
{
text = "Loadout_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
}
text = Path.GetInvalidFileNameChars().Aggregate(text, (string current, char c) => current.Replace(c, '_'));
SaveCurrentLoadout(text);
CloseSaveDialog();
RefreshLoadoutList();
}
private static void OnLoadoutPresetsButtonClicked()
{
OpenLoadoutMenu();
}
private static void OpenLoadoutMenu()
{
if (!Object.op_Implicit((Object)(object)_loadoutMenuPanel))
{
return;
}
_loadoutMenuPanel.SetActive(true);
RefreshLoadoutList();
Transform val = _loadoutMenuPanel.transform.Find("ContentPanel/Button_Save Current Loadout");
if (Object.op_Implicit((Object)(object)val))
{
Button component = ((Component)val).GetComponent<Button>();
if (Object.op_Implicit((Object)(object)component))
{
((Selectable)component).Select();
}
}
}
private static void CloseLoadoutMenu()
{
if (Object.op_Implicit((Object)(object)_loadoutMenuPanel))
{
_loadoutMenuPanel.SetActive(false);
}
}
private static void RefreshLoadoutList()
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
for (int num = _loadoutListContainer.childCount - 1; num >= 0; num--)
{
Object.Destroy((Object)(object)((Component)_loadoutListContainer.GetChild(num)).gameObject);
}
if (Directory.Exists(_LoadoutPresetsFolder))
{
string[] files = Directory.GetFiles(_LoadoutPresetsFolder, "*.json");
float num2 = 0f;
string[] array = files;
for (int i = 0; i < array.Length; i++)
{
CreateLoadoutListItem(Path.GetFileNameWithoutExtension(array[i]), num2);
num2 -= 60f;
}
((Component)_loadoutListContainer).GetComponent<RectTransform>().sizeDelta = new Vector2(0f, Math.Max(0f, 0f - num2));
}
}
private static void CreateLoadoutListItem(string loadoutName, float yPos)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0045: 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_006f: 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)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Expected O, but got Unknown
//IL_0191: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Expected O, but got Unknown
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Expected O, but got Unknown
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Expected O, but got Unknown
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("LoadoutItem_" + loadoutName);
val.transform.SetParent(_loadoutListContainer, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0f, 1f);
obj.anchorMax = new Vector2(1f, 1f);
obj.pivot = new Vector2(0.5f, 1f);
obj.sizeDelta = new Vector2(-10f, 50f);
obj.anchoredPosition = new Vector2(0f, yPos - 5f);
((Graphic)val.AddComponent<Image>()).color = new Color(0.15f, 0.15f, 0.15f, 1f);
GameObject val2 = new GameObject("Name");
val2.transform.SetParent(val.transform, false);
RectTransform obj2 = val2.AddComponent<RectTransform>();
obj2.anchorMin = new Vector2(0f, 0f);
obj2.anchorMax = new Vector2(0.5f, 1f);
obj2.sizeDelta = Vector2.zero;
TextMeshProUGUI obj3 = val2.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj3).text = loadoutName;
((TMP_Text)obj3).fontSize = 20f;
((TMP_Text)obj3).alignment = (TextAlignmentOptions)513;
((TMP_Text)obj3).margin = new Vector4(10f, 0f, 0f, 0f);
GameObject val3 = new GameObject("LoadButton");
val3.transform.SetParent(val.transform, false);
RectTransform obj4 = val3.AddComponent<RectTransform>();
obj4.anchorMin = new Vector2(0.52f, 0.1f);
obj4.anchorMax = new Vector2(0.72f, 0.9f);
obj4.sizeDelta = Vector2.zero;
Image val4 = val3.AddComponent<Image>();
((Graphic)val4).color = new Color(0.2f, 0.6f, 0.2f, 1f);
Button obj5 = val3.AddComponent<Button>();
((Selectable)obj5).targetGraphic = (Graphic)(object)val4;
((UnityEvent)obj5.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
{
LoadLoadout(loadoutName);
CloseLoadoutMenu();
}));
((Selectable)obj5).navigation = new Navigation
{
mode = (Mode)3
};
GameObject val5 = new GameObject("Text");
val5.transform.SetParent(val3.transform, false);
RectTransform obj6 = val5.AddComponent<RectTransform>();
obj6.anchorMin = Vector2.zero;
obj6.anchorMax = Vector2.one;
obj6.sizeDelta = Vector2.zero;
TextMeshProUGUI obj7 = val5.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj7).text = "Load";
((TMP_Text)obj7).fontSize = 18f;
((TMP_Text)obj7).alignment = (TextAlignmentOptions)514;
GameObject val6 = new GameObject("DeleteButton");
val6.transform.SetParent(val.transform, false);
RectTransform obj8 = val6.AddComponent<RectTransform>();
obj8.anchorMin = new Vector2(0.75f, 0.1f);
obj8.anchorMax = new Vector2(0.95f, 0.9f);
obj8.sizeDelta = Vector2.zero;
Image val7 = val6.AddComponent<Image>();
((Graphic)val7).color = new Color(0.6f, 0.2f, 0.2f, 1f);
Button obj9 = val6.AddComponent<Button>();
((Selectable)obj9).targetGraphic = (Graphic)(object)val7;
((UnityEvent)obj9.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
{
DeleteLoadout(loadoutName);
RefreshLoadoutList();
}));
((Selectable)obj9).navigation = new Navigation
{
mode = (Mode)3
};
GameObject val8 = new GameObject("Text");
val8.transform.SetParent(val6.transform, false);
RectTransform obj10 = val8.AddComponent<RectTransform>();
obj10.anchorMin = Vector2.zero;
obj10.anchorMax = Vector2.one;
obj10.sizeDelta = Vector2.zero;
TextMeshProUGUI obj11 = val8.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj11).text = "Delete";
((TMP_Text)obj11).fontSize = 18f;
((TMP_Text)obj11).alignment = (TextAlignmentOptions)514;
}
private static void DeleteLoadout(string loadoutName)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
string path = Path.Combine(_LoadoutPresetsFolder, loadoutName + ".json");
if (File.Exists(path))
{
File.Delete(path);
ManualLogSource logger = _logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Deleted loadout: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(loadoutName);
}
logger.LogInfo(val);
}
}
private static void SaveCurrentLoadout(string loadoutName)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)SaveManager.Instance))
{
_logger.LogError((object)"SaveManager is null, cannot save loadout");
return;
}
LoadoutData loadoutData = new LoadoutData
{
Name = loadoutName,
SavedAt = DateTime.Now,
InactivatedUnlockables = new List<string>()
};
Enumerator<string> enumerator = SaveManager.Instance.progression.inactivated.GetEnumerator();
while (enumerator.MoveNext())
{
string current = enumerator.Current;
loadoutData.InactivatedUnlockables.Add(current);
}
string path = Path.Combine(_LoadoutPresetsFolder, loadoutName + ".json");
string contents = JsonSerializer.Serialize(loadoutData, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(path, contents);
ManualLogSource logger = _logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loadout saved: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(loadoutName);
}
logger.LogInfo(val);
}
private static void LoadLoadout(string loadoutName)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
string text = Path.Combine(_LoadoutPresetsFolder, loadoutName + ".json");
bool flag = default(bool);
if (!File.Exists(text))
{
ManualLogSource logger = _logger;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loadout file not found: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
}
logger.LogError(val);
return;
}
LoadoutData loadoutData = JsonSerializer.Deserialize<LoadoutData>(File.ReadAllText(text));
if (!Object.op_Implicit((Object)(object)DataManager.Instance) || !Object.op_Implicit((Object)(object)SaveManager.Instance))
{
_logger.LogError((object)"DataManager or SaveManager is null");
return;
}
SaveManager.Instance.progression.inactivated.Clear();
foreach (string inactivatedUnlockable in loadoutData.InactivatedUnlockables)
{
SaveManager.Instance.progression.inactivated.Add(inactivatedUnlockable);
}
SaveManager.Instance.SaveProgression();
ManualLogSource logger2 = _logger;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Loadout loaded: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(loadoutName);
}
logger2.LogInfo(val2);
}
private static void OpenLoadoutPresetsFolder()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
try
{
if (!Directory.Exists(_LoadoutPresetsFolder))
{
Directory.CreateDirectory(_LoadoutPresetsFolder);
}
Application.OpenURL(_LoadoutPresetsFolder);
_logger.LogInfo((object)"Opened LoadoutPresets folder");
}
catch (Exception ex)
{
ManualLogSource logger = _logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to open LoadoutPresets folder: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogError(val);
}
}
}
[Serializable]
public class LoadoutData
{
public string Name { get; set; }
public DateTime SavedAt { get; set; }
public List<string> InactivatedUnlockables { get; set; }
}
}