using System;
using System.Collections;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Lamb.UI;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Newtonsoft.Json")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")]
[assembly: AssemblyCompany("p1xel8ted")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Namify")]
[assembly: AssemblyFileVersion("0.1.3")]
[assembly: AssemblyInformationalVersion("0.1.3+7e5ae3787ab1dd030e43c52a5af8589646676531")]
[assembly: AssemblyProduct("Namify")]
[assembly: AssemblyTitle("Namify")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.3.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.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;
}
}
[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 Namify
{
internal sealed class ConfigurationManagerAttributes
{
public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);
public bool? ShowRangeAsPercent;
public Action<ConfigEntryBase> CustomDrawer;
public CustomHotkeyDrawerFunc CustomHotkeyDrawer;
public bool? Browsable;
public string Category;
public object DefaultValue;
public bool? HideDefaultButton;
public bool? HideSettingName;
public string Description;
public string DispName;
public int? Order;
public bool? ReadOnly;
public bool? IsAdvanced;
public Func<object, string> ObjToStr;
public Func<string, object> StrToObj;
}
public static class Data
{
internal const string NamifyDataPath = "namify_names.json";
internal const string UserDataPath = "user_names.json";
public static SortedSet<string> NamifyNames;
public static SortedSet<string> UserNames;
private static readonly COTLDataReadWriter<List<string>> NamifyNameReadWriter;
private static readonly COTLDataReadWriter<List<string>> UserNameReadWriter;
static Data()
{
NamifyNames = new SortedSet<string>();
UserNames = new SortedSet<string>();
NamifyNameReadWriter = new COTLDataReadWriter<List<string>>();
UserNameReadWriter = new COTLDataReadWriter<List<string>>();
COTLDataReadWriter<List<string>> namifyNameReadWriter = NamifyNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter).OnReadCompleted = (Action<List<string>>)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter).OnReadCompleted, (Action<List<string>>)delegate(List<string> names)
{
NamifyNames = new SortedSet<string>(names);
Plugin.Log.LogInfo((object)((NamifyNames.Count > 0) ? $"Loaded {NamifyNames.Count} Namify generated names." : "No saved names exist."));
RemoveFollowerNames();
});
COTLDataReadWriter<List<string>> namifyNameReadWriter2 = NamifyNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter2).OnReadError = (Action<MMReadWriteError>)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter2).OnReadError, (Action<MMReadWriteError>)delegate
{
Plugin.Log.LogWarning((object)"Failed to load saved names!");
});
COTLDataReadWriter<List<string>> namifyNameReadWriter3 = NamifyNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter3).OnWriteCompleted = (Action)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter3).OnWriteCompleted, (Action)delegate
{
Plugin.Log.LogInfo((object)$"Saved {NamifyNames.Count} Namify generated names!");
});
COTLDataReadWriter<List<string>> namifyNameReadWriter4 = NamifyNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter4).OnWriteError = (Action<MMReadWriteError>)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)namifyNameReadWriter4).OnWriteError, (Action<MMReadWriteError>)delegate(MMReadWriteError error)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogWarning((object)("There was an issue saving Namify generated names: " + error.Message));
});
COTLDataReadWriter<List<string>> userNameReadWriter = UserNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter).OnReadCompleted = (Action<List<string>>)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter).OnReadCompleted, (Action<List<string>>)delegate(List<string> names)
{
UserNames = new SortedSet<string>(names);
Plugin.Log.LogInfo((object)((UserNames.Count > 0) ? $"Loaded {UserNames.Count} user-generated names." : "No saved names exist."));
RemoveFollowerNames();
});
COTLDataReadWriter<List<string>> userNameReadWriter2 = UserNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter2).OnReadError = (Action<MMReadWriteError>)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter2).OnReadError, (Action<MMReadWriteError>)delegate
{
Plugin.Log.LogWarning((object)"Failed to load saved user-generated names!");
});
COTLDataReadWriter<List<string>> userNameReadWriter3 = UserNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter3).OnWriteCompleted = (Action)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter3).OnWriteCompleted, (Action)delegate
{
Plugin.Log.LogInfo((object)$"Saved {UserNames.Count} user-generated names!");
});
COTLDataReadWriter<List<string>> userNameReadWriter4 = UserNameReadWriter;
((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter4).OnWriteError = (Action<MMReadWriteError>)Delegate.Combine(((MMDataReadWriterBase<List<string>>)(object)userNameReadWriter4).OnWriteError, (Action<MMReadWriteError>)delegate(MMReadWriteError error)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogWarning((object)("There was an issue saving user-generated names: " + error.Message));
});
}
private static void RemoveFollowerNames()
{
foreach (string name in NamifyNames)
{
Follower.Followers.RemoveAll((Follower a) => a.Brain.Info.Name == name);
}
foreach (string name2 in UserNames)
{
Follower.Followers.RemoveAll((Follower a) => a.Brain.Info.Name == name2);
}
}
internal static void LoadData()
{
((MMDataReadWriterBase<List<string>>)(object)NamifyNameReadWriter).Read("namify_names.json");
((MMDataReadWriterBase<List<string>>)(object)UserNameReadWriter).Read("user_names.json");
}
internal static void SaveData()
{
((MMDataReadWriterBase<List<string>>)(object)NamifyNameReadWriter).Write(NamifyNames.ToList(), "namify_names.json", false, true);
((MMDataReadWriterBase<List<string>>)(object)UserNameReadWriter).Write(UserNames.ToList(), "user_names.json", false, true);
}
internal static void GetNamifyNames(Action? onFail = null, Action? onComplete = null)
{
Action onFail2 = onFail;
Action onComplete2 = onComplete;
bool primaryError = false;
if (NamifyNames.Count > 0)
{
return;
}
((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(NamifyNamesGetRequest("https://randommer.io/api/Name?nameType=fullname&quantity=1000", apiKey: true, delegate(UnityWebRequest req)
{
//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)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
Result result = req.result;
if (result - 2 <= 2)
{
Plugin.Log.LogError((object)(req.error + ": " + req.downloadHandler.text));
NotificationCentre.Instance.PlayGenericNotification("There was an error retrieving names for Namify! Trying back-up source...", (Flair)0);
onFail2?.Invoke();
primaryError = true;
}
else
{
string[] array = JsonConvert.DeserializeObject<string[]>(req.downloadHandler.text);
foreach (string text in array)
{
NamifyNames.AddRange(text.Split());
}
SaveData();
NotificationCentre.Instance.PlayGenericNotification("Names retrieved for Namify!", (Flair)0);
onComplete2?.Invoke();
}
}));
if (primaryError)
{
((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(GetNamifyNamesBackupRequest(onFail2, onComplete2));
}
}
private static IEnumerator GetNamifyNamesBackupRequest(Action? onFail = null, Action? onComplete = null)
{
Action onFail2 = onFail;
Action onComplete2 = onComplete;
for (int i = 0; i < 10; i++)
{
yield return ((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(NamifyNamesGetRequest("https://namey.muffinlabs.com/name.json?count=10&with_surname=true&frequency=all", apiKey: false, delegate(UnityWebRequest req)
{
//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)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
Result result = req.result;
if (result - 2 <= 2)
{
Plugin.Log.LogError((object)(req.error + ": " + req.downloadHandler.text));
NotificationCentre.Instance.PlayGenericNotification("There was an error retrieving names for Namify from the backup source!", (Flair)0);
onFail2?.Invoke();
}
else
{
string[] array = JsonConvert.DeserializeObject<string[]>(req.downloadHandler.text);
foreach (string item in array)
{
NamifyNames.Add(item);
}
SaveData();
NotificationCentre.Instance.PlayGenericNotification("Names retrieved for Namify from the backup source!", (Flair)0);
onComplete2?.Invoke();
}
}));
}
}
private static IEnumerator NamifyNamesGetRequest(string endpoint, bool apiKey, Action<UnityWebRequest> callback)
{
UnityWebRequest request = UnityWebRequest.Get(endpoint);
try
{
if (apiKey)
{
request.SetRequestHeader("X-Api-Key", Plugin.PersonalApiKey.Value);
}
yield return request.SendWebRequest();
callback(request);
}
finally
{
((IDisposable)request)?.Dispose();
}
}
}
public static class Extensions
{
public static void AddRange<T>(this SortedSet<T> set, IEnumerable<T> elements)
{
foreach (T element in elements)
{
set.Add(element);
}
}
}
[Harmony]
public static class Patches
{
private static string _pendingName = string.Empty;
[HarmonyPostfix]
[HarmonyPatch(typeof(SaveAndLoad), "Save")]
private static void SaveAndLoad_Save()
{
if (DataManager.Instance.AllowSaving && !CheatConsole.IN_DEMO)
{
Data.SaveData();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SaveAndLoad), "Load")]
private static void SaveAndLoad_Load(int saveSlot)
{
if (!CheatConsole.IN_DEMO)
{
Data.LoadData();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UIFollowerIndoctrinationMenuController), "Show", new Type[]
{
typeof(Follower),
typeof(OriginalFollowerLookData),
typeof(bool)
})]
private static void UIFollowerIndoctrinationMenuController_Show(ref UIFollowerIndoctrinationMenuController __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
UIFollowerIndoctrinationMenuController instance = __instance;
((UnityEvent)((Button)__instance._acceptButton).onClick).AddListener((UnityAction)delegate
{
string name = instance._targetFollower.Brain.Info.Name;
if (!(name != _pendingName))
{
Plugin.Log.LogInfo((object)("Follower name " + name + " confirmed! Removing name from saved name list."));
Data.NamifyNames.Remove(_pendingName);
Data.UserNames.Remove(_pendingName);
}
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(FollowerInfo), "GenerateName")]
public static void FollowerInfo_GenerateName(ref string __result)
{
if (GameManager.GetInstance() != null && DataManager.Instance != null)
{
if (Data.NamifyNames.Count <= 0)
{
Data.GetNamifyNames();
}
if (Data.NamifyNames.Count <= 0 && Data.UserNames.Count <= 0)
{
Plugin.Log.LogError((object)"No names found!");
}
else if (!(__result == _pendingName))
{
_pendingName = ListExtensions.RandomElement<string>(Data.NamifyNames.Concat(Data.UserNames).Distinct().ToList());
__result = _pendingName;
}
}
}
}
[BepInPlugin("p1xel8ted.cotl.namify", "Namify", "0.1.3")]
[BepInDependency("com.bepis.bepinex.configurationmanager", "18.2")]
public class Plugin : BaseUnityPlugin
{
private const string PluginGuid = "p1xel8ted.cotl.namify";
internal const string PluginName = "Namify";
private const string PluginVer = "0.1.3";
private const string NamesSection = "Names";
private const string ApiSection = "API";
public static ManualLogSource Log;
internal static ConfigEntry<string> PersonalApiKey;
internal static ConfigEntry<string> AddName;
private static bool _showGetNewConfirmationDialog;
private static bool _showReloadConfirmationDialog;
private static string? _namifyNamesFilePath;
private static string? _userDataFilePath;
private static PopupManager PopupManager;
private static string NamifyNamesFilePath => _namifyNamesFilePath ?? (_namifyNamesFilePath = Path.Combine(Application.persistentDataPath, "saves", "namify_names.json"));
private static string UserNameFilePath => _userDataFilePath ?? (_userDataFilePath = Path.Combine(Application.persistentDataPath, "saves", "user_names.json"));
private void Awake()
{
InitializeLogger();
InitializeConfigurations();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "p1xel8ted.cotl.namify");
Log.LogInfo((object)"Loaded Namify!");
}
private void InitializeLogger()
{
Log = ((BaseUnityPlugin)this).Logger;
}
private void InitializeConfigurations()
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Expected O, but got Unknown
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Expected O, but got Unknown
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Expected O, but got Unknown
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Expected O, but got Unknown
PopupManager = ((Component)this).gameObject.AddComponent<PopupManager>();
PersonalApiKey = ((BaseUnityPlugin)this).Config.Bind<string>("API", "Personal API Key", "ee5f806e1c1d458b99c934c0eb3de5b8", "The default API Key is mine, limited to 1000 requests per day. You can get your own at https://randommer.io/");
AddName = ((BaseUnityPlugin)this).Config.Bind<string>("Names", "Add Name", "", new ConfigDescription("Adds a name to the list of names.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 10
}
}));
((BaseUnityPlugin)this).Config.Bind<bool>("Names", "Add Name Button", true, new ConfigDescription("Add the name entered to the list.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 9,
DispName = string.Empty,
HideDefaultButton = true,
CustomDrawer = AddNameButton
}
}));
((BaseUnityPlugin)this).Config.Bind<bool>("Names", "Open Namify Names File", true, new ConfigDescription("Opens the Namify generated names file for viewing/editing.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 8,
DispName = string.Empty,
HideDefaultButton = true,
CustomDrawer = OpenNamifyNamesFile
}
}));
((BaseUnityPlugin)this).Config.Bind<bool>("Names", "Open User Names File", true, new ConfigDescription("Opens the user-generated names file for viewing/editing.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 7,
DispName = string.Empty,
HideDefaultButton = true,
CustomDrawer = OpenUserGeneratedNamesFile
}
}));
((BaseUnityPlugin)this).Config.Bind<bool>("Names", "Generate New Names", true, new ConfigDescription("Generates new Namify games. User-generated names are not changed.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 6,
DispName = string.Empty,
HideDefaultButton = true,
CustomDrawer = GenerateNewNamesButton
}
}));
((BaseUnityPlugin)this).Config.Bind<bool>("Names", "Reload Names", true, new ConfigDescription("Reloads names from file.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 5,
DispName = string.Empty,
HideDefaultButton = true,
CustomDrawer = ReloadNames
}
}));
}
private static void OpenNamifyNamesFile(ConfigEntryBase entry)
{
if (GUILayout.Button("Open Namify List", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
TryOpenNamifyNamesFile();
}
}
private static void OpenUserGeneratedNamesFile(ConfigEntryBase entry)
{
if (GUILayout.Button("Open User List", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
TryOpenUserNamesFile();
}
}
private static void TryOpenNamifyNamesFile()
{
if (File.Exists(NamifyNamesFilePath))
{
Application.OpenURL(NamifyNamesFilePath);
}
else
{
PopupManager.ShowPopup("Names file (" + NamifyNamesFilePath + ") does not exist!");
}
}
private static void TryOpenUserNamesFile()
{
if (File.Exists(UserNameFilePath))
{
Application.OpenURL(UserNameFilePath);
}
else
{
PopupManager.ShowPopup("Names file (" + UserNameFilePath + ") does not exist!");
}
}
private static void DisplayGetNewConfirmationDialog()
{
GUILayout.Label("Are you sure you want to generate new names?", Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Yes", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
GenerateNewNamesAction();
_showGetNewConfirmationDialog = false;
}
if (GUILayout.Button("No", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
_showGetNewConfirmationDialog = false;
}
GUILayout.EndHorizontal();
}
private static void DisplayReloadConfirmationDialog()
{
GUILayout.Label("Are you sure you want to reload names from file?", Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Yes", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
try
{
Data.LoadData();
PopupManager.ShowPopup("Names reloaded from file!");
}
catch (Exception ex)
{
PopupManager.ShowPopup("Error in reloading names. Check log for more details.");
Log.LogError((object)("Error in reloading names: " + ex.Message));
}
_showReloadConfirmationDialog = false;
}
if (GUILayout.Button("No", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
_showReloadConfirmationDialog = false;
}
GUILayout.EndHorizontal();
}
private static void GenerateNewNamesAction()
{
try
{
File.Delete(NamifyNamesFilePath);
Data.NamifyNames.Clear();
Data.GetNamifyNames(delegate
{
PopupManager.ShowPopup("Error in generating new names!");
}, delegate
{
PopupManager.ShowPopup("New names generated!");
});
}
catch (Exception ex)
{
Log.LogError((object)("Error in generating new names: " + ex.Message));
}
}
private static void AddNameButton(ConfigEntryBase entry)
{
if (GUILayout.Button("Add Name", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
if (string.IsNullOrWhiteSpace(AddName.Value))
{
PopupManager.ShowPopup("You haven't entered a name to add?");
return;
}
if (!Data.UserNames.Add(AddName.Value))
{
PopupManager.ShowPopup("'" + AddName.Value + "' already exists!");
return;
}
Data.SaveData();
PopupManager.ShowPopup("Added '" + AddName.Value + "' to available names!");
}
}
private static void ReloadNames(ConfigEntryBase entry)
{
if (_showReloadConfirmationDialog)
{
DisplayReloadConfirmationDialog();
}
else if (GUILayout.Button("Reload Names From File", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
_showReloadConfirmationDialog = true;
}
}
private static void GenerateNewNamesButton(ConfigEntryBase entry)
{
if (_showGetNewConfirmationDialog)
{
DisplayGetNewConfirmationDialog();
}
else if (GUILayout.Button("Generate New Names", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
_showGetNewConfirmationDialog = true;
}
}
}
internal class PopupManager : MonoBehaviour
{
private bool showPopup;
private string popupMessage = "";
private Rect popupRect = new Rect((float)Screen.width / 2f - 150f, (float)Screen.height / 2f - 75f, 300f, 100f);
private GUIStyle? messageStyle;
private void Start()
{
//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)
//IL_000d: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
GUIStyle val = new GUIStyle
{
alignment = (TextAnchor)4,
wordWrap = true,
fontSize = 20
};
val.normal.textColor = Color.white;
messageStyle = val;
}
private void OnGUI()
{
//IL_000b: 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_002b: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (showPopup)
{
popupRect = GUILayout.Window(0, popupRect, new WindowFunction(DrawPopup), "Namify", Array.Empty<GUILayoutOption>());
}
}
private void DrawPopup(int windowID)
{
GUILayout.FlexibleSpace();
GUILayout.Label(popupMessage, messageStyle, Array.Empty<GUILayoutOption>());
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.FlexibleSpace();
if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
{
Plugin.AddName.Value = string.Empty;
showPopup = false;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
public void ShowPopup(string message)
{
popupMessage = message;
showPopup = true;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}