using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Splatform;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Auto Pin Signs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Auto Pin Signs")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1f4794c6-9828-458d-bf06-a6acb8e038ac")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace AutoPinSigns
{
[BepInPlugin("shudnal.AutoPinSigns", "Auto Pin Signs", "1.1.0")]
public class AutoPinSigns : BaseUnityPlugin
{
[HarmonyPatch(typeof(Sign), "UpdateText")]
public static class Sign_UpdateText_UpdateSignState
{
public static void Postfix(Sign __instance)
{
if (modEnabled.Value)
{
SignState.UpdatePinState(__instance);
}
}
}
[HarmonyPatch(typeof(WearNTear), "Destroy")]
public static class WearNTear_Destroy_RemoveAddedPin
{
public static void Prefix(WearNTear __instance)
{
if (modEnabled.Value && wntStates.TryGetValue(__instance, out var value))
{
value.RemoveMapPin();
}
}
}
[HarmonyPatch(typeof(WearNTear), "OnDestroy")]
public static class WearNTear_OnDestroy_RemoveSignState
{
public static void Prefix(WearNTear __instance)
{
if (modEnabled.Value && wntStates.TryGetValue(__instance, out var value))
{
signStates.Remove(value.m_sign);
pieceStates.Remove(value.m_piece);
wntStates.Remove(value.m_wnt);
}
}
}
[HarmonyPatch(typeof(ZoneSystem), "OnDestroy")]
public static class ZoneSystem_OnDestroy_Clear
{
public static void Prefix()
{
signStates.Clear();
pieceStates.Clear();
wntStates.Clear();
}
}
public class SignState
{
public Sign m_sign;
public PinData m_pin;
public string m_text;
public Piece m_piece;
public WearNTear m_wnt;
public SignState(Sign sign, string text)
{
m_sign = sign;
m_text = text;
m_piece = ((Component)sign).GetComponent<Piece>();
m_wnt = ((Component)sign).GetComponent<WearNTear>();
signStates[m_sign] = this;
if (Object.op_Implicit((Object)(object)m_piece))
{
pieceStates[m_piece] = this;
}
if (Object.op_Implicit((Object)(object)m_wnt))
{
wntStates[m_wnt] = this;
}
UpdateMapPin();
}
public void UpdateSignText(string text)
{
if (!(text == m_text))
{
m_text = text;
UpdateMapPin();
}
}
public void UpdateMapPin()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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)
if (m_pin != null && (!IsPinnableSign(m_text) || m_text != m_pin.m_name))
{
RemoveMapPin();
}
if (m_pin != null || !IsPinnableSign(m_text))
{
return;
}
PinType pinType = GetIcon(m_text);
m_pin = ((IEnumerable<PinData>)Minimap.instance.m_pins).FirstOrDefault((Func<PinData, bool>)((PinData pin) => pin.m_name == m_text && pin.m_type == pinType && pin.m_save && Utils.DistanceXZ(((Component)m_sign).transform.position, pin.m_pos) < 1f));
if (m_pin == null)
{
m_pin = Minimap.instance.AddPin(((Component)m_sign).transform.position, pinType, m_text, true, false, 0L, default(PlatformUserID));
string name = m_pin.m_name;
Sprite icon = m_pin.m_icon;
LogInfo($"Added map pin from sign: \"{name}\" {((icon != null) ? ((Object)icon).name : null)} {m_pin.m_pos}");
Player localPlayer = Player.m_localPlayer;
if (localPlayer != null)
{
((Character)localPlayer).Message((MessageType)1, "$msg_pin_added: " + m_text, 0, m_pin.m_icon);
}
}
}
public void RemoveMapPin()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
if (m_pin != null)
{
string name = m_pin.m_name;
Sprite icon = m_pin.m_icon;
LogInfo($"Removed map pin from sign: \"{name}\" {((icon != null) ? ((Object)icon).name : null)} {m_pin.m_pos}");
Minimap.instance.RemovePin(m_pin);
m_pin = null;
}
}
private static bool IsSign(HashSet<string> list, string text)
{
return allowSubstrings.Value ? list.Any((string x) => text.IndexOf(x, StringComparison.OrdinalIgnoreCase) >= 0) : list.Contains(text.ToLower());
}
private static bool IsFireSign(string text)
{
return IsSign(fireList, text);
}
private static bool IsBaseSign(string text)
{
return IsSign(baseList, text);
}
private static bool IsHammerSign(string text)
{
return IsSign(hammerList, text);
}
private static bool IsPinSign(string text)
{
return IsSign(pinList, text);
}
private static bool IsPortalSign(string text)
{
return IsSign(portalList, text);
}
private static bool IsPinnableSign(string text)
{
return IsSign(allpins, text);
}
private static PinType GetIcon(string text)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (IsFireSign(text))
{
return (PinType)0;
}
if (IsBaseSign(text))
{
return (PinType)1;
}
if (IsHammerSign(text))
{
return (PinType)2;
}
if (IsPinSign(text))
{
return (PinType)3;
}
if (IsPortalSign(text))
{
return (PinType)6;
}
return (PinType)3;
}
public static void UpdatePinState(Sign sign)
{
string text = StringExtensionMethods.RemoveRichTextTags(sign.GetText());
if (signStates.TryGetValue(sign, out var value))
{
value.UpdateSignText(text);
}
else
{
new SignState(sign, text);
}
}
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action<KeyValuePair<Sign, SignState>> <>9__25_0;
public static Func<string, string> <>9__26_0;
public static ConsoleEvent <>9__27_0;
public static ConsoleOptionsFetcher <>9__27_1;
internal void <UpdatePinLists>b__25_0(KeyValuePair<Sign, SignState> kvp)
{
kvp.Value.UpdateMapPin();
}
internal string <AddToHS>b__26_0(string entry)
{
return entry.ToLower().Trim();
}
internal void <InitCommands>b__27_0(ConsoleEventArgs args)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
if (!modEnabled.Value)
{
args.Context.AddString("Mod disabled");
}
else
{
if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
return;
}
if (args.Args.Length >= 2 && args.Args[1] == "clear")
{
float result;
while (<InitCommands>g__FindAndDeleteClosestPin|27_2(((Component)Player.m_localPlayer).transform.position, (args.Args.Length > 2 && float.TryParse(args.Args[2], out result)) ? result : 0f))
{
}
}
else
{
args.Context.AddString("Syntax: " + typeof(AutoPinSigns).Namespace.ToLower() + " [action]");
}
}
}
internal List<string> <InitCommands>b__27_1()
{
return new List<string> { "clear [range] - Clear closest to current player pins in set range. Default 5" };
}
}
public const string pluginID = "shudnal.AutoPinSigns";
public const string pluginName = "Auto Pin Signs";
public const string pluginVersion = "1.1.0";
private Harmony _harmony;
private static ConfigEntry<bool> modEnabled;
private static ConfigEntry<bool> loggingEnabled;
private static ConfigEntry<bool> allowSubstrings;
private static ConfigEntry<bool> removePinsWithoutSigns;
private static ConfigEntry<string> configFireList;
private static ConfigEntry<string> configBaseList;
private static ConfigEntry<string> configHammerList;
private static ConfigEntry<string> configPinList;
private static ConfigEntry<string> configPortalList;
private static readonly HashSet<string> fireList = new HashSet<string>();
private static readonly HashSet<string> baseList = new HashSet<string>();
private static readonly HashSet<string> hammerList = new HashSet<string>();
private static readonly HashSet<string> pinList = new HashSet<string>();
private static readonly HashSet<string> portalList = new HashSet<string>();
private static readonly HashSet<string> allpins = new HashSet<string>();
private static AutoPinSigns instance;
private static readonly List<Piece> tempPieces = new List<Piece>();
private static Vector2i currentZone = Vector2i.zero;
public static readonly Dictionary<Sign, SignState> signStates = new Dictionary<Sign, SignState>();
public static readonly Dictionary<Piece, SignState> pieceStates = new Dictionary<Piece, SignState>();
public static readonly Dictionary<WearNTear, SignState> wntStates = new Dictionary<WearNTear, SignState>();
private void Awake()
{
ConfigInit();
_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "shudnal.AutoPinSigns");
instance = this;
}
private void OnDestroy()
{
((BaseUnityPlugin)this).Config.Save();
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private static void LogInfo(object data)
{
if (loggingEnabled.Value)
{
((BaseUnityPlugin)instance).Logger.LogInfo(data);
}
}
private void ConfigInit()
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Expected O, but got Unknown
modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable the mod");
loggingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Logging enabled", false, "Enable logging");
allowSubstrings = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Less strict string comparison", false, "Less strict comparison of config substrings. Enable to create pins if sign have any substring instead of exact match");
removePinsWithoutSigns = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove nearby map pins without related signs", false, "If enabled - if nearby pin has no related sign that pin will be removed from map.");
configFireList = ((BaseUnityPlugin)this).Config.Bind<string>("Signs", "FireList", "fire", new ConfigDescription("List of the case-insensitive strings to add Fire pin. Comma-separate each string.", (AcceptableValueBase)null, new object[1]
{
new CustomConfigs.ConfigurationManagerAttributes
{
CustomDrawer = CustomConfigs.DrawSeparatedStrings(",")
}
}));
configBaseList = ((BaseUnityPlugin)this).Config.Bind<string>("Signs", "BaseList", "base,shelter,home,house", new ConfigDescription("List of the case-insensitive strings to add Base pin. Comma-separate each string.", (AcceptableValueBase)null, new object[1]
{
new CustomConfigs.ConfigurationManagerAttributes
{
CustomDrawer = CustomConfigs.DrawSeparatedStrings(",")
}
}));
configHammerList = ((BaseUnityPlugin)this).Config.Bind<string>("Signs", "HammerList", "hammer,crypt,mine,boss,cave", new ConfigDescription("List of the strings to add Hammer pin. Comma-separate each string.", (AcceptableValueBase)null, new object[1]
{
new CustomConfigs.ConfigurationManagerAttributes
{
CustomDrawer = CustomConfigs.DrawSeparatedStrings(",")
}
}));
configPinList = ((BaseUnityPlugin)this).Config.Bind<string>("Signs", "PinList", "pin,dot,ore,vein,point", new ConfigDescription("List of the strings to add Dot pin. Comma-separate each string.", (AcceptableValueBase)null, new object[1]
{
new CustomConfigs.ConfigurationManagerAttributes
{
CustomDrawer = CustomConfigs.DrawSeparatedStrings(",")
}
}));
configPortalList = ((BaseUnityPlugin)this).Config.Bind<string>("Signs", "PortalList", "portal", new ConfigDescription("List of the strings to add Portal pin. Comma-separate each string.", (AcceptableValueBase)null, new object[1]
{
new CustomConfigs.ConfigurationManagerAttributes
{
CustomDrawer = CustomConfigs.DrawSeparatedStrings(",")
}
}));
configFireList.SettingChanged += ConfigList_SettingChanged;
configBaseList.SettingChanged += ConfigList_SettingChanged;
configHammerList.SettingChanged += ConfigList_SettingChanged;
configPinList.SettingChanged += ConfigList_SettingChanged;
configPortalList.SettingChanged += ConfigList_SettingChanged;
UpdatePinLists();
InitCommands();
}
private void ConfigList_SettingChanged(object sender, EventArgs e)
{
UpdatePinLists();
}
private static void UpdatePinLists()
{
AddToHS(configFireList.Value, fireList);
AddToHS(configBaseList.Value, baseList);
AddToHS(configHammerList.Value, hammerList);
AddToHS(configPinList.Value, pinList);
AddToHS(configPortalList.Value, portalList);
allpins.Clear();
allpins.UnionWith(fireList);
allpins.UnionWith(baseList);
allpins.UnionWith(hammerList);
allpins.UnionWith(pinList);
allpins.UnionWith(portalList);
CollectionExtensions.Do<KeyValuePair<Sign, SignState>>((IEnumerable<KeyValuePair<Sign, SignState>>)signStates, (Action<KeyValuePair<Sign, SignState>>)delegate(KeyValuePair<Sign, SignState> kvp)
{
kvp.Value.UpdateMapPin();
});
}
private static void AddToHS(string text, HashSet<string> hashSet)
{
hashSet.Clear();
hashSet.UnionWith(from entry in text.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)
select entry.ToLower().Trim());
}
public static void InitCommands()
{
//IL_0037: 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_0042: Expected O, but got Unknown
//IL_0069: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
string obj = typeof(AutoPinSigns).Namespace.ToLower() ?? "";
object obj2 = <>c.<>9__27_0;
if (obj2 == null)
{
ConsoleEvent val = delegate(ConsoleEventArgs args)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
if (!modEnabled.Value)
{
args.Context.AddString("Mod disabled");
}
else if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
if (args.Args.Length >= 2 && args.Args[1] == "clear")
{
float result;
while (FindAndDeleteClosestPin(((Component)Player.m_localPlayer).transform.position, (args.Args.Length > 2 && float.TryParse(args.Args[2], out result)) ? result : 0f))
{
}
}
else
{
args.Context.AddString("Syntax: " + typeof(AutoPinSigns).Namespace.ToLower() + " [action]");
}
}
};
<>c.<>9__27_0 = val;
obj2 = (object)val;
}
object obj3 = <>c.<>9__27_1;
if (obj3 == null)
{
ConsoleOptionsFetcher val2 = () => new List<string> { "clear [range] - Clear closest to current player pins in set range. Default 5" };
<>c.<>9__27_1 = val2;
obj3 = (object)val2;
}
new ConsoleCommand(obj, "[action]", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)obj3, true, false, false);
static bool FindAndDeleteClosestPin(Vector3 pos, float distance = 5f)
{
//IL_002c: 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)
if (Object.op_Implicit((Object)(object)Minimap.instance))
{
foreach (PinData pin in Minimap.instance.m_pins)
{
if (Utils.DistanceXZ(pos, pin.m_pos) < distance)
{
Minimap.instance.RemovePin(pin);
return true;
}
}
}
return false;
}
}
private static bool IsAutoPinIcon(PinType pinType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Invalid comparison between Unknown and I4
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
return (int)pinType == 0 || (int)pinType == 1 || (int)pinType == 2 || (int)pinType == 3 || (int)pinType == 6;
}
private void FixedUpdate()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
if (!modEnabled.Value || !removePinsWithoutSigns.Value || !Object.op_Implicit((Object)(object)ZNet.instance) || currentZone == (currentZone = ZoneSystem.GetZone(ZNet.instance.GetReferencePosition())) || !Object.op_Implicit((Object)(object)Minimap.instance) || !IsCurrentZoneActive())
{
return;
}
foreach (PinData item in Minimap.instance.m_pins.Where(IsPinToRemove).ToList())
{
string name = item.m_name;
Sprite icon = item.m_icon;
LogInfo($"Removed map pin without sign: \"{name}\" {((icon != null) ? ((Object)icon).name : null)} {item.m_pos}");
Minimap.instance.RemovePin(item);
}
}
private static bool IsPinToRemove(PinData pin)
{
//IL_0012: 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_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)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (pin.m_ownerID == 0L && pin.m_save && IsAutoPinIcon(pin.m_type) && currentZone == ZoneSystem.GetZone(pin.m_pos))
{
tempPieces.Clear();
Piece.GetAllPiecesInRadius(pin.m_pos, 1f, tempPieces);
return !tempPieces.Any(pieceStates.ContainsKey);
}
return false;
}
private static bool IsCurrentZoneActive()
{
//IL_0011: 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)
ZoneData value;
return Object.op_Implicit((Object)(object)ZoneSystem.instance) && ZoneSystem.instance.IsZoneLoaded(currentZone) && ZoneSystem.instance.m_zones.TryGetValue(currentZone, out value) && value.m_ttl <= 0.1f;
}
[CompilerGenerated]
internal static bool <InitCommands>g__FindAndDeleteClosestPin|27_2(Vector3 pos, float distance = 5f)
{
//IL_002c: 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)
if (Object.op_Implicit((Object)(object)Minimap.instance))
{
foreach (PinData pin in Minimap.instance.m_pins)
{
if (Utils.DistanceXZ(pos, pin.m_pos) < distance)
{
Minimap.instance.RemovePin(pin);
return true;
}
}
}
return false;
}
}
internal class CustomConfigs
{
internal class ConfigurationManagerAttributes
{
[UsedImplicitly]
public Action<ConfigEntryBase>? CustomDrawer;
}
internal static object? configManager;
internal static Type? configManagerStyles;
internal static GUIStyle GetStyle(GUIStyle other)
{
//IL_0034: 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_0051: Expected O, but got Unknown
if (configManagerStyles == null)
{
return other;
}
FieldInfo fieldInfo = AccessTools.Field(configManagerStyles, "fontSize");
if (fieldInfo == null)
{
return other;
}
return new GUIStyle(other)
{
fontSize = (int)fieldInfo.GetValue(configManagerStyles)
};
}
internal static void Awake()
{
Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager");
Type type = assembly?.GetType("ConfigurationManager.ConfigurationManager");
configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type));
configManagerStyles = assembly?.GetType("ConfigurationManager.ConfigurationManagerStyles");
}
internal static Action<ConfigEntryBase> DrawSeparatedStrings(string splitString)
{
string splitString2 = splitString;
return delegate(ConfigEntryBase cfg)
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Expected O, but got Unknown
bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : null).FirstOrDefault((bool? v) => v.HasValue).GetValueOrDefault();
bool flag = false;
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
List<string> list = new List<string>();
List<string> list2 = ((string)cfg.BoxedValue).Split(new string[1] { splitString2 }, StringSplitOptions.None).ToList();
for (int i = 0; i < list2.Count; i++)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
string text = list2[i];
string text2 = GUILayout.TextField(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
if (text2 != text && !valueOrDefault)
{
flag = true;
}
if (GUILayout.Button("x", new GUIStyle(GetStyle(GUI.skin.button))
{
fixedWidth = 21f
}, Array.Empty<GUILayoutOption>()) && !valueOrDefault)
{
flag = true;
}
else
{
list.Add(text2);
}
if (GUILayout.Button("+", new GUIStyle(GetStyle(GUI.skin.button))
{
fixedWidth = 21f
}, Array.Empty<GUILayoutOption>()) && !valueOrDefault)
{
flag = true;
list.Add("");
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
if (flag)
{
cfg.BoxedValue = string.Join(splitString2, list);
}
};
}
internal static Action<ConfigEntryBase> DrawOrderedFixedStrings(string splitString)
{
string splitString2 = splitString;
return delegate(ConfigEntryBase cfg)
{
//IL_00e4: 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_00ff: Expected O, but got Unknown
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Expected O, but got Unknown
bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : null).FirstOrDefault((bool? v) => v.HasValue).GetValueOrDefault();
bool flag = false;
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
string[] array = ((string)cfg.BoxedValue).Split(new string[1] { splitString2 }, StringSplitOptions.None).ToArray();
for (int i = 0; i < array.Length; i++)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
string text = array[i];
GUILayout.Label(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
if (GUILayout.Button("ʌ", new GUIStyle(GetStyle(GUI.skin.button))
{
fixedWidth = 21f
}, Array.Empty<GUILayoutOption>()) && !valueOrDefault && (flag = i > 0))
{
ref string reference = ref array[i];
ref string reference2 = ref array[i - 1];
string text2 = array[i - 1];
string text3 = array[i];
reference = text2;
reference2 = text3;
}
if (GUILayout.Button("v", new GUIStyle(GetStyle(GUI.skin.button))
{
fixedWidth = 21f
}, Array.Empty<GUILayoutOption>()) && !valueOrDefault && (flag = i < array.Length - 1))
{
ref string reference = ref array[i];
ref string reference3 = ref array[i + 1];
string text3 = array[i + 1];
string text2 = array[i];
reference = text3;
reference3 = text2;
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
if (flag)
{
cfg.BoxedValue = string.Join(splitString2, array);
}
};
}
}
}