using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using KeybindManager;
using KeybindManager.Integrations;
using KeybindManager.UI;
using KeybindManager.Utils;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using S1API.Console;
using S1API.Input;
using S1API.Logging;
using S1API.PhoneApp;
using S1API.UI;
using S1API.Utils;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "Keybind Manager", "1.0.0", "Riccaforte", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonAuthorColor(1, 68, 2, 152)]
[assembly: MelonColor(1, 68, 2, 152)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KeybindManager")]
[assembly: AssemblyConfiguration("CrossCompat")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9830294891316ac2d0eedcfda957e5ec2350af54")]
[assembly: AssemblyProduct("KeybindManager")]
[assembly: AssemblyTitle("KeybindManager")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.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 KeybindManager
{
public class Core : MelonMod
{
public readonly Log _logger = new Log("KeybindManager");
public static Core? Instance { get; private set; }
public override void OnInitializeMelon()
{
Instance = this;
HarmonyPatches.SetModInstance(this);
KeybindRuntimeService.Shared.InitializePreferences();
_logger.Msg("Mod initialized and config loaded.");
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
KeybindRuntimeService.Shared.HandleSceneInitialized(sceneName);
}
public override void OnUpdate()
{
HarmonyPatches.TryApplyPatches();
KeybindManagerPhoneApp.TickActiveInstance();
KeybindRuntimeService.Shared.TickPendingSavedKeybindRestore(_logger);
}
public override void OnLateUpdate()
{
KeybindManagerPhoneApp.TickActiveInstanceLate();
}
public override void OnApplicationQuit()
{
Instance = null;
KeybindRuntimeService.Shared.ResetRuntimeState();
}
}
}
namespace KeybindManager.Utils
{
internal sealed class ConsoleCommandCatalog
{
private static readonly string[] ConsoleAssemblyNames = new string[2] { "Assembly-CSharp", "Il2CppAssembly-CSharp" };
private static readonly string[] ConsoleTypeNames = new string[2] { "ScheduleOne.Console", "Il2CppScheduleOne.Console" };
internal ConsoleCommandCatalogResult LoadEntries()
{
List<ConsoleCommandReferenceEntry> entries = new List<ConsoleCommandReferenceEntry>();
string statusMessage = "Commands are loaded from the game's console registry.";
try
{
Type type = FindConsoleType();
if ((object)type == null)
{
return new ConsoleCommandCatalogResult(entries, "The game's console registry isn't available in this runtime.");
}
object obj = ReadStaticMember(type, "Commands") ?? ReadStaticMember(type, "commands");
if (obj == null)
{
return new ConsoleCommandCatalogResult(entries, "The game's command list couldn't be read.");
}
if (!TryEnumerateCommandObjects(obj, delegate(object command)
{
AddCommandReferenceEntry(entries, command);
}))
{
return new ConsoleCommandCatalogResult(entries, "The game's command list couldn't be enumerated in this runtime.");
}
if (entries.Count == 0)
{
statusMessage = "No console commands are currently registered.";
}
}
catch (Exception ex)
{
statusMessage = "Couldn't load command data: " + ex.Message;
}
return new ConsoleCommandCatalogResult(entries, statusMessage);
}
private static Type? FindConsoleType()
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
string name = assembly.GetName().Name;
if (string.IsNullOrWhiteSpace(name) || !MatchesKnownAssemblyName(name))
{
continue;
}
string[] consoleTypeNames = ConsoleTypeNames;
foreach (string name2 in consoleTypeNames)
{
Type type = assembly.GetType(name2, throwOnError: false);
if ((object)type != null)
{
return type;
}
}
}
return null;
}
private static bool MatchesKnownAssemblyName(string assemblyName)
{
string[] consoleAssemblyNames = ConsoleAssemblyNames;
foreach (string b in consoleAssemblyNames)
{
if (string.Equals(assemblyName, b, StringComparison.Ordinal))
{
return true;
}
}
return false;
}
private static bool TryEnumerateCommandObjects(object commandsValue, Action<object> onCommand)
{
if (commandsValue is IEnumerable enumerable)
{
foreach (object item in enumerable)
{
if (item != null)
{
onCommand(item);
}
}
return true;
}
object obj = commandsValue.GetType().GetMethod("GetEnumerator", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null)?.Invoke(commandsValue, null);
if (obj == null)
{
return false;
}
Type type = obj.GetType();
MethodInfo method = type.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
PropertyInfo property = type.GetProperty("Current", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if ((object)method == null || (object)property == null)
{
return false;
}
bool flag = default(bool);
while (true)
{
object obj2 = method.Invoke(obj, null);
int num;
if (obj2 is bool)
{
flag = (bool)obj2;
num = 1;
}
else
{
num = 0;
}
if (((uint)num & (flag ? 1u : 0u)) == 0)
{
break;
}
object value = property.GetValue(obj, null);
if (value != null)
{
onCommand(value);
}
}
return true;
}
private static void AddCommandReferenceEntry(ICollection<ConsoleCommandReferenceEntry> entries, object command)
{
string text = ReadStringMember(command, "CommandWord");
if (!string.IsNullOrWhiteSpace(text))
{
entries.Add(new ConsoleCommandReferenceEntry(text, ReadStringMember(command, "CommandDescription"), ReadStringMember(command, "ExampleUsage")));
}
}
private static string ReadStringMember(object instance, string memberName)
{
Type type = instance.GetType();
if (type.GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(instance, null) is string result)
{
return result;
}
if (type.GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(instance) is string result2)
{
return result2;
}
return string.Empty;
}
private static object? ReadStaticMember(Type type, string memberName)
{
PropertyInfo property = type.GetProperty(memberName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if ((object)property != null)
{
return property.GetValue(null, null);
}
return type.GetField(memberName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
}
}
internal sealed class ConsoleCommandCatalogResult
{
internal IReadOnlyList<ConsoleCommandReferenceEntry> Entries { get; }
internal string StatusMessage { get; }
internal ConsoleCommandCatalogResult(IReadOnlyList<ConsoleCommandReferenceEntry> entries, string statusMessage)
{
Entries = entries;
StatusMessage = statusMessage;
}
}
internal sealed class ConsoleCommandReferenceEntry
{
internal string Command { get; }
internal string Description { get; }
internal string Example { get; }
internal ConsoleCommandReferenceEntry(string command, string description, string example)
{
Command = command;
Description = description;
Example = example;
}
}
internal static class KeybindInputUtility
{
internal static bool TryParseKeyCode(string? rawValue, out KeyCode keyCode)
{
keyCode = (KeyCode)0;
if (string.IsNullOrWhiteSpace(rawValue))
{
return false;
}
string text = rawValue.Trim();
if (int.TryParse(text, out var _))
{
return false;
}
if (Enum.TryParse<KeyCode>(text, ignoreCase: true, out keyCode) && IsSupportedKeyboardKey(keyCode))
{
return true;
}
if (text.Length == 1)
{
char c = char.ToUpperInvariant(text[0]);
if (char.IsLetter(c) && Enum.TryParse<KeyCode>(c.ToString(), out keyCode))
{
return true;
}
if (char.IsDigit(c) && Enum.TryParse<KeyCode>($"Alpha{c}", out keyCode))
{
return true;
}
}
return false;
}
internal static string FormatKeyCode(KeyCode keyCode)
{
return ((object)(KeyCode)(ref keyCode)).ToString();
}
internal static bool IsSupportedKeyboardKey(KeyCode keyCode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
if ((int)keyCode == 0)
{
return false;
}
string text = ((object)(KeyCode)(ref keyCode)).ToString();
return !text.StartsWith("Mouse", StringComparison.Ordinal) && !text.StartsWith("Joystick", StringComparison.Ordinal);
}
}
internal sealed class KeybindRuntimeService
{
private MelonPreferences_Category? _keybindManagerCategory;
private MelonPreferences_Entry<bool>? _modEnabled;
private MelonPreferences_Entry<string>? _savedKeybinds;
private int _pendingSavedKeybindApplyFrames = -1;
internal static KeybindRuntimeService Shared { get; } = new KeybindRuntimeService();
internal void InitializePreferences()
{
_keybindManagerCategory = MelonPreferences.CreateCategory("Keybind Manager");
_modEnabled = _keybindManagerCategory.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_savedKeybinds = _keybindManagerCategory.CreateEntry<string>("SavedKeybinds", "[]", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
}
internal IReadOnlyList<SavedKeybind> LoadSavedKeybinds()
{
return KeybindPreferences.Deserialize(_savedKeybinds?.Value);
}
internal void SaveKeybinds(IEnumerable<SavedKeybind> keybinds)
{
if (_savedKeybinds != null && _keybindManagerCategory != null)
{
_savedKeybinds.Value = KeybindPreferences.Serialize(keybinds);
_keybindManagerCategory.SaveToFile(false);
}
}
internal void ApplySavedKeybinds()
{
foreach (SavedKeybind item in LoadSavedKeybinds())
{
ApplyBind(item);
}
}
internal void ApplyBind(SavedKeybind keybind)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (keybind != null && !string.IsNullOrWhiteSpace(keybind.Command))
{
string bindKeyToken = GetBindKeyToken(keybind.Key);
if (!string.IsNullOrWhiteSpace(bindKeyToken))
{
ConsoleHelper.Submit("bind " + bindKeyToken + " " + keybind.Command.Trim());
}
}
}
internal void RemoveBind(KeyCode keyCode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
string bindKeyToken = GetBindKeyToken(keyCode);
if (!string.IsNullOrWhiteSpace(bindKeyToken))
{
ConsoleHelper.Submit("unbind " + bindKeyToken);
}
}
internal void HandleSceneInitialized(string sceneName)
{
MelonPreferences_Entry<bool>? modEnabled = _modEnabled;
if (modEnabled != null && modEnabled.Value && string.Equals(sceneName, "Main", StringComparison.Ordinal) && LoadSavedKeybinds().Count != 0)
{
_pendingSavedKeybindApplyFrames = 120;
}
}
internal void TickPendingSavedKeybindRestore(Log logger)
{
if (_pendingSavedKeybindApplyFrames < 0)
{
return;
}
if (_pendingSavedKeybindApplyFrames > 0)
{
_pendingSavedKeybindApplyFrames--;
return;
}
_pendingSavedKeybindApplyFrames = -1;
int count = LoadSavedKeybinds().Count;
MelonPreferences_Entry<bool>? modEnabled = _modEnabled;
if (modEnabled != null && modEnabled.Value && count != 0)
{
ApplySavedKeybinds();
logger.Msg(string.Format("Loaded {0} saved keybind(s) in scene '{1}'.", count, "Main"));
}
}
internal void ResetRuntimeState()
{
_pendingSavedKeybindApplyFrames = -1;
}
private static string? GetBindKeyToken(KeyCode keyCode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
if ((int)keyCode == 0)
{
return null;
}
string text = ((object)(KeyCode)(ref keyCode)).ToString();
if (text.StartsWith("Alpha", StringComparison.Ordinal) && text.Length == 6)
{
return text.Substring(5, 1).ToLowerInvariant();
}
if (text.Length == 1)
{
return text.ToLowerInvariant();
}
return text;
}
}
public sealed class SavedKeybind
{
public string Command { get; set; } = string.Empty;
public KeyCode Key { get; set; } = (KeyCode)0;
}
public static class KeybindPreferences
{
public static IReadOnlyList<SavedKeybind> Deserialize(string? rawValue)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(rawValue))
{
return Array.Empty<SavedKeybind>();
}
try
{
List<SavedKeybind> list = JsonConvert.DeserializeObject<List<SavedKeybind>>(rawValue);
if (list == null)
{
return Array.Empty<SavedKeybind>();
}
list.RemoveAll((SavedKeybind keybind) => keybind == null || string.IsNullOrWhiteSpace(keybind.Command) || (int)keybind.Key == 0);
if (list.Count <= 1)
{
return list;
}
List<SavedKeybind> list2 = new List<SavedKeybind>(list.Count);
HashSet<KeyCode> hashSet = new HashSet<KeyCode>();
for (int num = list.Count - 1; num >= 0; num--)
{
SavedKeybind savedKeybind = list[num];
if (hashSet.Add(savedKeybind.Key))
{
list2.Add(new SavedKeybind
{
Command = savedKeybind.Command,
Key = savedKeybind.Key
});
}
}
list2.Reverse();
return list2;
}
catch
{
return Array.Empty<SavedKeybind>();
}
}
public static string Serialize(IEnumerable<SavedKeybind> keybinds)
{
return JsonConvert.SerializeObject((object)keybinds, (Formatting)0);
}
}
public static class Constants
{
public static class Game
{
public const string GAME_STUDIO = "TVGS";
public const string GAME_NAME = "Schedule I";
public const string MAIN_SCENE = "Main";
public const int MAIN_SCENE_BIND_DELAY_FRAMES = 120;
}
public const string MOD_NAME = "Keybind Manager";
public const string MOD_VERSION = "1.0.0";
public const string MOD_AUTHOR = "Riccaforte";
public const string PREFERENCES_CATEGORY = "Keybind Manager";
public const string KEYBINDS_PREFERENCE = "SavedKeybinds";
}
}
namespace KeybindManager.Integrations
{
public static class HarmonyPatches
{
private static readonly string[] ConsoleAssemblyNames = new string[2] { "Assembly-CSharp", "Il2CppAssembly-CSharp" };
private static readonly string[] ConsoleTypeNames = new string[2] { "ScheduleOne.Console", "Il2CppScheduleOne.Console" };
private static Core? _modInstance;
private static bool _patchesApplied;
public static void SetModInstance(Core modInstance)
{
_modInstance = modInstance;
TryApplyPatches();
}
public static void TryApplyPatches()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
if (_patchesApplied || _modInstance == null)
{
return;
}
MethodBase methodBase = FindConsoleUpdateMethod();
if (!(methodBase == null))
{
MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(HarmonyPatches), "BeforeConsoleUpdate", (Type[])null, (Type[])null);
if (!(methodInfo == null))
{
((MelonBase)_modInstance).HarmonyInstance.Patch(methodBase, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
_patchesApplied = true;
}
}
}
private static MethodBase? FindConsoleUpdateMethod()
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
string name = assembly.GetName().Name;
if (string.IsNullOrWhiteSpace(name) || !MatchesKnownAssemblyName(name))
{
continue;
}
string[] consoleTypeNames = ConsoleTypeNames;
foreach (string name2 in consoleTypeNames)
{
Type type = assembly.GetType(name2, throwOnError: false);
if (!(type == null))
{
MethodInfo methodInfo = AccessTools.DeclaredMethod(type, "Update", (Type[])null, (Type[])null);
if (methodInfo != null)
{
return methodInfo;
}
}
}
}
return null;
}
private static bool MatchesKnownAssemblyName(string assemblyName)
{
string[] consoleAssemblyNames = ConsoleAssemblyNames;
foreach (string b in consoleAssemblyNames)
{
if (string.Equals(assemblyName, b, StringComparison.Ordinal))
{
return true;
}
}
return false;
}
private static bool BeforeConsoleUpdate()
{
KeybindManagerPhoneApp.SyncTypingState();
return !KeybindManagerPhoneApp.ShouldSuppressConsoleBinds();
}
}
}
namespace KeybindManager.UI
{
public class KeybindManagerPhoneApp : PhoneApp
{
private static KeybindManagerPhoneApp? _instance;
private readonly ConsoleCommandCatalog _commandCatalog = new ConsoleCommandCatalog();
private readonly KeybindManagerPhoneAppCoordinator _keybindCoordinator;
private readonly KeybindManagerPhoneAppView _view;
protected override string AppName => "KeybindManager";
protected override string AppTitle => "Keybind Manager";
protected override string IconLabel => "Keybinds";
protected override string IconFileName => string.Empty;
public KeybindManagerPhoneApp()
: this(KeybindRuntimeService.Shared)
{
}
internal KeybindManagerPhoneApp(KeybindRuntimeService keybindRuntime)
{
_keybindCoordinator = new KeybindManagerPhoneAppCoordinator(keybindRuntime);
_view = new KeybindManagerPhoneAppView(BeginEditKeybind, RequestDeleteKeybind, SubmitKeybind, CancelEditMode, OpenCommandReference);
}
protected override void OnCreated()
{
_instance = this;
Sprite val = LoadEmbeddedAppIcon();
if ((Object)(object)val != (Object)null)
{
((PhoneApp)this).SetIconSprite(val);
}
((PhoneApp)this).OnCreated();
}
protected override void OnCreatedUI(GameObject container)
{
_keybindCoordinator.LoadSavedKeybinds();
_view.Build(container, ((PhoneApp)this).AppTitle);
RefreshKeybindList();
}
protected override void OnPhoneClosed()
{
((PhoneApp)this).OnPhoneClosed();
_view.HandlePhoneClosed();
Controls.IsTyping = false;
}
internal static void SyncTypingState()
{
_instance?.UpdateTypingState();
}
internal static bool ShouldSuppressConsoleBinds()
{
return _instance?._view.IsKeyCaptureDialogActive() ?? false;
}
internal static void TickActiveInstance()
{
_instance?.Tick();
}
internal static void TickActiveInstanceLate()
{
_instance?.TickLate();
}
internal void Tick()
{
UpdateTypingState();
_view.Tick();
UpdateTypingState();
}
internal void TickLate()
{
UpdateTypingState();
}
private void RefreshKeybindList()
{
_view.RefreshKeybindList(_keybindCoordinator.SavedKeybinds);
}
private void RequestDeleteKeybind(int index)
{
if (_keybindCoordinator.ContainsIndex(index))
{
_view.RequestConfirmation("Delete keybind?", "Are you sure you want to delete this saved keybind?", "Delete", delegate
{
DeleteKeybind(index);
});
}
}
private void SubmitKeybind()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if (_view.ValidateForm(showErrors: true))
{
string command = _view.CommandText.Trim();
KeybindInputUtility.TryParseKeyCode(_view.KeyText, out var keyCode);
SavedKeybind newKeybind = new SavedKeybind
{
Command = command,
Key = keyCode
};
SaveKeybind(newKeybind, allowOverwrite: false);
}
}
private void BeginEditKeybind(int index)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (_keybindCoordinator.TryBeginEdit(index, out SavedKeybind keybind))
{
_view.CloseTransientUi();
_view.PopulateComposer(keybind.Command, KeybindInputUtility.FormatKeyCode(keybind.Key));
UpdateComposerActions();
}
}
private void SaveKeybind(SavedKeybind newKeybind, bool allowOverwrite)
{
SavedKeybind newKeybind2 = newKeybind;
KeybindCoordinatorSaveResult keybindCoordinatorSaveResult = _keybindCoordinator.Save(newKeybind2, allowOverwrite);
if (keybindCoordinatorSaveResult.Outcome == KeybindCoordinatorSaveOutcome.DuplicateConflict && keybindCoordinatorSaveResult.ConflictingKeybind != null)
{
int? originalEditIndex = _keybindCoordinator.EditingKeybindIndex;
RequestDuplicateOverwriteConfirmation(newKeybind2, keybindCoordinatorSaveResult.ConflictingKeybind, delegate
{
ConfirmDuplicateOverwrite(newKeybind2, originalEditIndex);
});
}
else if (keybindCoordinatorSaveResult.Outcome == KeybindCoordinatorSaveOutcome.InvalidEditTarget)
{
ClearComposer();
}
else
{
RefreshKeybindList();
ClearComposer();
}
}
private void ConfirmDuplicateOverwrite(SavedKeybind newKeybind, int? originalEditIndex)
{
KeybindCoordinatorSaveResult keybindCoordinatorSaveResult = (originalEditIndex.HasValue ? _keybindCoordinator.OverwriteEditedKeybind(originalEditIndex.Value, newKeybind) : _keybindCoordinator.Save(newKeybind, allowOverwrite: true));
if (keybindCoordinatorSaveResult.Outcome == KeybindCoordinatorSaveOutcome.InvalidEditTarget)
{
ClearComposer();
return;
}
RefreshKeybindList();
ClearComposer();
}
private void CancelEditMode()
{
ClearComposer();
}
private void DeleteKeybind(int index)
{
KeybindCoordinatorDeleteResult keybindCoordinatorDeleteResult = _keybindCoordinator.Delete(index);
if (keybindCoordinatorDeleteResult.Deleted)
{
if (keybindCoordinatorDeleteResult.ClearedCurrentEdit)
{
_view.ClearComposer();
UpdateComposerActions();
}
RefreshKeybindList();
}
}
private void ClearComposer()
{
_keybindCoordinator.CancelEdit();
_view.ClearComposer();
UpdateComposerActions();
}
private void UpdateComposerActions()
{
_view.UpdateComposerActions(_keybindCoordinator.IsEditing);
}
private void OpenCommandReference()
{
ConsoleCommandCatalogResult consoleCommandCatalogResult = _commandCatalog.LoadEntries();
_view.SetCommandReferenceStatus(consoleCommandCatalogResult.StatusMessage);
_view.OpenCommandReference(consoleCommandCatalogResult.Entries);
UpdateTypingState();
}
private void RequestDuplicateOverwriteConfirmation(SavedKeybind pendingKeybind, SavedKeybind existingKeybind, Action confirmAction)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
string text = KeybindInputUtility.FormatKeyCode(pendingKeybind.Key);
string text2 = (string.IsNullOrWhiteSpace(existingKeybind.Command) ? "the existing keybind" : existingKeybind.Command);
string message = (_keybindCoordinator.IsEditing ? ("A saved keybind already uses " + text + " for \"" + text2 + "\". Confirming will replace that saved keybind and remove the keybind you are currently editing.") : ("A saved keybind already uses " + text + " for \"" + text2 + "\". Confirming will overwrite that keybind with your new command."));
_view.RequestConfirmation("Overwrite keybind?", message, "Overwrite", confirmAction);
}
private void CloseCommandReference()
{
_view.CloseCommandReference();
UpdateTypingState();
}
private void UpdateTypingState()
{
Controls.IsTyping = _view.ShouldMarkTyping(((PhoneApp)this).IsOpen());
}
private Sprite? LoadEmbeddedAppIcon()
{
try
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string[] array = new string[3] { "KeybindManager.icon.png", "KeybindManagerPhoneApp.icon.png", "icon.png" };
string[] array2 = array;
foreach (string name in array2)
{
using Stream stream = executingAssembly.GetManifestResourceStream(name);
if (stream == null)
{
continue;
}
byte[] array3 = new byte[stream.Length];
stream.Read(array3, 0, array3.Length);
return ImageUtils.LoadImageRaw(array3);
}
}
catch (Exception ex)
{
Core? instance = Core.Instance;
if (instance != null)
{
instance._logger.Msg("Failed to load embedded app icon: " + ex.Message);
}
}
return null;
}
}
internal sealed class KeybindManagerPhoneAppCoordinator
{
private readonly KeybindRuntimeService _keybindRuntime;
private readonly List<SavedKeybind> _savedKeybinds = new List<SavedKeybind>();
internal IReadOnlyList<SavedKeybind> SavedKeybinds => _savedKeybinds;
internal bool IsEditing => EditingKeybindIndex.HasValue;
internal int? EditingKeybindIndex { get; private set; }
internal KeybindManagerPhoneAppCoordinator(KeybindRuntimeService keybindRuntime)
{
_keybindRuntime = keybindRuntime;
}
internal void LoadSavedKeybinds()
{
_savedKeybinds.Clear();
_savedKeybinds.AddRange(_keybindRuntime.LoadSavedKeybinds());
EditingKeybindIndex = null;
}
internal bool ContainsIndex(int index)
{
return index >= 0 && index < _savedKeybinds.Count;
}
internal bool TryBeginEdit(int index, out SavedKeybind keybind)
{
if (!ContainsIndex(index))
{
keybind = new SavedKeybind();
return false;
}
EditingKeybindIndex = index;
keybind = _savedKeybinds[index];
return true;
}
internal KeybindCoordinatorSaveResult Save(SavedKeybind keybind, bool allowOverwrite)
{
return EditingKeybindIndex.HasValue ? SaveEditedKeybind(EditingKeybindIndex.Value, keybind, allowOverwrite) : AddNewKeybind(keybind, allowOverwrite);
}
internal KeybindCoordinatorSaveResult OverwriteEditedKeybind(int originalEditIndex, SavedKeybind keybind)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_009c: Unknown result type (might be due to invalid IL or missing references)
if (!ContainsIndex(originalEditIndex))
{
EditingKeybindIndex = null;
return KeybindCoordinatorSaveResult.InvalidEditTarget();
}
int num = FindDuplicateKeybindIndex(keybind.Key, originalEditIndex);
if (num < 0)
{
return SaveEditedKeybind(originalEditIndex, keybind, allowOverwrite: true);
}
SavedKeybind savedKeybind = _savedKeybinds[originalEditIndex];
_savedKeybinds[num] = keybind;
_savedKeybinds.RemoveAt(originalEditIndex);
if (savedKeybind.Key != keybind.Key)
{
_keybindRuntime.RemoveBind(savedKeybind.Key);
}
_keybindRuntime.SaveKeybinds(_savedKeybinds);
_keybindRuntime.ApplyBind(keybind);
EditingKeybindIndex = null;
return KeybindCoordinatorSaveResult.Saved();
}
internal KeybindCoordinatorDeleteResult Delete(int index)
{
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
if (!ContainsIndex(index))
{
return new KeybindCoordinatorDeleteResult(deleted: false, clearedCurrentEdit: false);
}
SavedKeybind savedKeybind = _savedKeybinds[index];
_savedKeybinds.RemoveAt(index);
bool clearedCurrentEdit = false;
if (EditingKeybindIndex == index)
{
EditingKeybindIndex = null;
clearedCurrentEdit = true;
}
else if (EditingKeybindIndex.HasValue && EditingKeybindIndex.Value > index)
{
EditingKeybindIndex = EditingKeybindIndex.Value - 1;
}
_keybindRuntime.SaveKeybinds(_savedKeybinds);
_keybindRuntime.RemoveBind(savedKeybind.Key);
return new KeybindCoordinatorDeleteResult(deleted: true, clearedCurrentEdit);
}
internal void CancelEdit()
{
EditingKeybindIndex = null;
}
private KeybindCoordinatorSaveResult AddNewKeybind(SavedKeybind newKeybind, bool allowOverwrite)
{
SavedKeybind newKeybind2 = newKeybind;
int num = _savedKeybinds.FindIndex((SavedKeybind existing) => existing.Key == newKeybind2.Key);
if (num >= 0 && !allowOverwrite)
{
return KeybindCoordinatorSaveResult.DuplicateConflict(_savedKeybinds[num]);
}
if (num >= 0)
{
_savedKeybinds[num] = newKeybind2;
}
else
{
_savedKeybinds.Add(newKeybind2);
}
_keybindRuntime.SaveKeybinds(_savedKeybinds);
_keybindRuntime.ApplyBind(newKeybind2);
EditingKeybindIndex = null;
return KeybindCoordinatorSaveResult.Saved();
}
private KeybindCoordinatorSaveResult SaveEditedKeybind(int index, SavedKeybind updatedKeybind, bool allowOverwrite)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
if (!ContainsIndex(index))
{
EditingKeybindIndex = null;
return KeybindCoordinatorSaveResult.InvalidEditTarget();
}
SavedKeybind savedKeybind = _savedKeybinds[index];
int num = FindDuplicateKeybindIndex(updatedKeybind.Key, index);
if (num >= 0 && !allowOverwrite)
{
return KeybindCoordinatorSaveResult.DuplicateConflict(_savedKeybinds[num]);
}
if (num >= 0)
{
_savedKeybinds.RemoveAt(num);
if (num < index)
{
index--;
}
}
_savedKeybinds[index] = updatedKeybind;
if (savedKeybind.Key != updatedKeybind.Key)
{
_keybindRuntime.RemoveBind(savedKeybind.Key);
}
_keybindRuntime.SaveKeybinds(_savedKeybinds);
_keybindRuntime.ApplyBind(updatedKeybind);
EditingKeybindIndex = null;
return KeybindCoordinatorSaveResult.Saved();
}
private int FindDuplicateKeybindIndex(KeyCode keyCode, int excludedIndex)
{
//IL_001d: 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)
for (int i = 0; i < _savedKeybinds.Count; i++)
{
if (i != excludedIndex && _savedKeybinds[i].Key == keyCode)
{
return i;
}
}
return -1;
}
}
internal sealed class KeybindCoordinatorSaveResult
{
internal KeybindCoordinatorSaveOutcome Outcome { get; }
internal SavedKeybind? ConflictingKeybind { get; }
private KeybindCoordinatorSaveResult(KeybindCoordinatorSaveOutcome outcome, SavedKeybind? conflictingKeybind)
{
Outcome = outcome;
ConflictingKeybind = conflictingKeybind;
}
internal static KeybindCoordinatorSaveResult Saved()
{
return new KeybindCoordinatorSaveResult(KeybindCoordinatorSaveOutcome.Saved, null);
}
internal static KeybindCoordinatorSaveResult InvalidEditTarget()
{
return new KeybindCoordinatorSaveResult(KeybindCoordinatorSaveOutcome.InvalidEditTarget, null);
}
internal static KeybindCoordinatorSaveResult DuplicateConflict(SavedKeybind conflictingKeybind)
{
return new KeybindCoordinatorSaveResult(KeybindCoordinatorSaveOutcome.DuplicateConflict, conflictingKeybind);
}
}
internal enum KeybindCoordinatorSaveOutcome
{
Saved,
DuplicateConflict,
InvalidEditTarget
}
internal readonly struct KeybindCoordinatorDeleteResult
{
internal bool Deleted { get; }
internal bool ClearedCurrentEdit { get; }
internal KeybindCoordinatorDeleteResult(bool deleted, bool clearedCurrentEdit)
{
Deleted = deleted;
ClearedCurrentEdit = clearedCurrentEdit;
}
}
internal sealed class KeybindManagerPhoneAppView
{
private readonly Action<int> _beginEditKeybind;
private readonly Action<int> _requestDeleteKeybind;
private readonly Action _submitKeybind;
private readonly Action _cancelEditMode;
private readonly Action _openCommandReference;
private RectTransform? _keybindListContent;
private RectTransform? _commandReferenceListContent;
private InputField? _commandInput;
private InputField? _keyInput;
private Text? _commandErrorText;
private Text? _keyErrorText;
private GameObject? _deleteConfirmationOverlay;
private RectTransform? _deleteConfirmationDialogRect;
private Text? _deleteConfirmationTitleText;
private Text? _deleteConfirmationText;
private Text? _deleteConfirmationConfirmButtonText;
private GameObject? _keyCaptureOverlay;
private KeyCaptureListener? _keyCaptureListener;
private Text? _keyCaptureValueText;
private Button? _saveCapturedKeyButton;
private GameObject? _commandReferenceOverlay;
private Text? _commandReferenceStatusText;
private GameObject? _cancelEditButtonRow;
private Text? _composerHeadingText;
private Text? _submitKeybindButtonText;
private bool _isAwaitingKeyCapture;
private KeyCode? _capturedKey;
private Action? _pendingConfirmationAction;
private bool _commandInputWasFocused;
private bool _keyInputWasFocused;
private string _lastCommandInputText = string.Empty;
private string _lastKeyInputText = string.Empty;
internal string CommandText
{
get
{
InputField? commandInput = _commandInput;
return ((commandInput != null) ? commandInput.text : null) ?? string.Empty;
}
}
internal string KeyText
{
get
{
InputField? keyInput = _keyInput;
return ((keyInput != null) ? keyInput.text : null) ?? string.Empty;
}
}
public KeybindManagerPhoneAppView(Action<int> beginEditKeybind, Action<int> requestDeleteKeybind, Action submitKeybind, Action cancelEditMode, Action openCommandReference)
{
_beginEditKeybind = beginEditKeybind;
_requestDeleteKeybind = requestDeleteKeybind;
_submitKeybind = submitKeybind;
_cancelEditMode = cancelEditMode;
_openCommandReference = openCommandReference;
}
internal void Build(GameObject container, string appTitle)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = UIFactory.Panel("MainPanel", container.transform, new Color(0.08f, 0.09f, 0.12f, 0.96f), (Vector2?)null, (Vector2?)null, true);
StretchToFill(val.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
GameObject val2 = UIFactory.TopBar("TitleBar", val.transform, appTitle, 0.13f, 18, 18, 10, 10);
ConfigureTitleBarRect(val2.GetComponent<RectTransform>());
ConfigureTitleBar(val2);
GameObject val3 = UIFactory.Panel("ContentPanel", val.transform, new Color(0.12f, 0.14f, 0.18f, 0.94f), (Vector2?)new Vector2(0.03f, 0.04f), (Vector2?)new Vector2(0.97f, 0.88f), false);
StretchToFill(val3.GetComponent<RectTransform>(), 0f, 0f, 0f, 52f);
UIFactory.HorizontalLayoutOnGO(val3, 18, 20, 20, 20, 20, (TextAnchor)0);
ConfigureContentColumns(val3);
CreateSavedKeybindsSection(val3.transform);
CreateAddKeybindSection(val3.transform);
CreateDeleteConfirmationDialog(val.transform);
CreateKeyCaptureDialog(val.transform);
CreateCommandReferenceDialog(val.transform);
UpdateComposerActions(isEditing: false);
}
internal void HandlePhoneClosed()
{
CloseTransientUi();
}
internal void Tick()
{
PollInputField(_commandInput, ref _commandInputWasFocused, ref _lastCommandInputText, HandleCommandInputChanged, HandleCommandInputEndEdit);
PollInputField(_keyInput, ref _keyInputWasFocused, ref _lastKeyInputText, HandleKeyInputChanged, HandleKeyInputEndEdit);
PollKeyCapture();
}
internal void RefreshKeybindList(IReadOnlyList<SavedKeybind> savedKeybinds)
{
if ((Object)(object)_keybindListContent == (Object)null)
{
return;
}
UIFactory.ClearChildren((Transform)(object)_keybindListContent);
if (savedKeybinds.Count == 0)
{
CreateEmptyKeybindState();
UIFactory.FitContentHeight(_keybindListContent);
return;
}
for (int i = 0; i < savedKeybinds.Count; i++)
{
CreateSavedKeybindRow(i, savedKeybinds[i]);
}
UIFactory.FitContentHeight(_keybindListContent);
}
internal void OpenCommandReference(IReadOnlyList<ConsoleCommandReferenceEntry> entries)
{
if (!((Object)(object)_commandReferenceOverlay == (Object)null))
{
CancelCapture();
CloseDeleteConfirmation();
InputField? commandInput = _commandInput;
if (commandInput != null)
{
commandInput.DeactivateInputField();
}
InputField? keyInput = _keyInput;
if (keyInput != null)
{
keyInput.DeactivateInputField();
}
EventSystem current = EventSystem.current;
if (current != null)
{
current.SetSelectedGameObject((GameObject)null);
}
RefreshCommandReferenceList(entries);
_commandReferenceOverlay.SetActive(true);
_commandReferenceOverlay.transform.SetAsLastSibling();
}
}
internal void CloseCommandReference()
{
if ((Object)(object)_commandReferenceOverlay != (Object)null)
{
_commandReferenceOverlay.SetActive(false);
}
}
internal void RequestConfirmation(string title, string message, string confirmLabel, Action confirmAction)
{
if (!((Object)(object)_deleteConfirmationOverlay == (Object)null))
{
_pendingConfirmationAction = confirmAction;
InputField? commandInput = _commandInput;
if (commandInput != null)
{
commandInput.DeactivateInputField();
}
InputField? keyInput = _keyInput;
if (keyInput != null)
{
keyInput.DeactivateInputField();
}
EventSystem current = EventSystem.current;
if (current != null)
{
current.SetSelectedGameObject((GameObject)null);
}
if ((Object)(object)_deleteConfirmationTitleText != (Object)null)
{
_deleteConfirmationTitleText.text = title;
}
if ((Object)(object)_deleteConfirmationText != (Object)null)
{
_deleteConfirmationText.text = message;
}
if ((Object)(object)_deleteConfirmationConfirmButtonText != (Object)null)
{
_deleteConfirmationConfirmButtonText.text = confirmLabel;
}
_deleteConfirmationOverlay.SetActive(true);
_deleteConfirmationOverlay.transform.SetAsLastSibling();
}
}
internal void CloseDeleteConfirmation()
{
_pendingConfirmationAction = null;
if ((Object)(object)_deleteConfirmationOverlay != (Object)null)
{
_deleteConfirmationOverlay.SetActive(false);
}
}
internal void CloseTransientUi()
{
CancelCapture();
CloseCommandReference();
CloseDeleteConfirmation();
}
internal void PopulateComposer(string command, string keyText)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_commandInput != (Object)null)
{
_commandInput.text = command;
}
if ((Object)(object)_keyInput != (Object)null)
{
_keyInput.text = keyText;
}
_capturedKey = (KeybindInputUtility.TryParseKeyCode(keyText, out var keyCode) ? new KeyCode?(keyCode) : null);
SetFieldError(_commandErrorText, null);
SetFieldError(_keyErrorText, null);
}
internal void ClearComposer()
{
CancelCapture();
if ((Object)(object)_commandInput != (Object)null)
{
_commandInput.text = string.Empty;
}
if ((Object)(object)_keyInput != (Object)null)
{
_keyInput.text = string.Empty;
}
SetFieldError(_commandErrorText, null);
SetFieldError(_keyErrorText, null);
}
internal void UpdateComposerActions(bool isEditing)
{
if ((Object)(object)_cancelEditButtonRow != (Object)null)
{
_cancelEditButtonRow.SetActive(isEditing);
}
if ((Object)(object)_composerHeadingText != (Object)null)
{
_composerHeadingText.text = (isEditing ? "Edit Keybind" : "Add Keybind");
}
if ((Object)(object)_submitKeybindButtonText != (Object)null)
{
_submitKeybindButtonText.text = (isEditing ? "Save Changes" : "Add Keybind");
}
}
internal void SetCommandReferenceStatus(string message)
{
if (!((Object)(object)_commandReferenceStatusText == (Object)null))
{
_commandReferenceStatusText.text = message;
}
}
internal bool ShouldMarkTyping(bool isPhoneOpen)
{
return isPhoneOpen && !IsKeyCaptureDialogActive() && !IsConfirmationDialogActive() && !IsCommandReferenceDialogActive() && (IsInputFieldActive(_commandInput) || IsInputFieldActive(_keyInput));
}
internal bool IsKeyCaptureDialogActive()
{
return (Object)(object)_keyCaptureOverlay != (Object)null && _keyCaptureOverlay.activeSelf;
}
private void CreateSavedKeybindsSection(Transform parent)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_00b7: 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_016d: Expected O, but got Unknown
GameObject val = UIFactory.Panel("SavedKeybindsSection", parent, new Color(0.15f, 0.17f, 0.22f, 0.94f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredWidth = 330f;
val2.minWidth = 300f;
val2.flexibleWidth = 1.1f;
val2.flexibleHeight = 1f;
val2.minHeight = 220f;
UIFactory.VerticalLayoutOnGO(val, 12, new RectOffset(16, 16, 16, 16));
ConfigureSectionStack(val, (TextAnchor)0);
Text val3 = UIFactory.Text("SavedKeybindsHeading", "Saved Keybinds", val.transform, 18, (TextAnchor)3, (FontStyle)1);
((Graphic)val3).color = Color.white;
LayoutElement val4 = ((Component)val3).gameObject.AddComponent<LayoutElement>();
val4.preferredHeight = 24f;
val4.flexibleHeight = 0f;
ScrollRect val5 = default(ScrollRect);
_keybindListContent = UIFactory.ScrollableVerticalList("SavedKeybindsList", val.transform, ref val5);
LayoutElement val6 = ((Component)val5).gameObject.AddComponent<LayoutElement>();
val6.flexibleHeight = 1f;
val6.minHeight = 140f;
ConfigureScrollRect(val5);
ConfigureScrollContent(_keybindListContent);
if ((Object)(object)((Component)_keybindListContent).GetComponent<VerticalLayoutGroup>() == (Object)null)
{
UIFactory.VerticalLayoutOnGO(((Component)_keybindListContent).gameObject, 10, new RectOffset(8, 8, 8, 8));
}
UIFactory.FitContentHeight(_keybindListContent);
}
private void CreateAddKeybindSection(Transform parent)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Expected O, but got Unknown
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_0455: Unknown result type (might be due to invalid IL or missing references)
//IL_0466: Unknown result type (might be due to invalid IL or missing references)
//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Unknown result type (might be due to invalid IL or missing references)
//IL_056c: Expected O, but got Unknown
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0666: Unknown result type (might be due to invalid IL or missing references)
//IL_0691: Unknown result type (might be due to invalid IL or missing references)
//IL_075a: Unknown result type (might be due to invalid IL or missing references)
//IL_076b: Unknown result type (might be due to invalid IL or missing references)
//IL_079b: Unknown result type (might be due to invalid IL or missing references)
//IL_086f: Unknown result type (might be due to invalid IL or missing references)
//IL_0880: Unknown result type (might be due to invalid IL or missing references)
//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
//IL_090a: Unknown result type (might be due to invalid IL or missing references)
GameObject val = UIFactory.Panel("AddKeybindSection", parent, new Color(0.15f, 0.17f, 0.22f, 0.94f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredWidth = 300f;
val2.minWidth = 280f;
val2.flexibleWidth = 0.9f;
val2.flexibleHeight = 1f;
val2.minHeight = 220f;
UIFactory.VerticalLayoutOnGO(val, 12, new RectOffset(16, 16, 16, 16));
ConfigureSectionStack(val, (TextAnchor)0);
_composerHeadingText = UIFactory.Text("AddKeybindHeading", "Add Keybind", val.transform, 18, (TextAnchor)3, (FontStyle)1);
((Graphic)_composerHeadingText).color = Color.white;
LayoutElement val3 = ((Component)_composerHeadingText).gameObject.AddComponent<LayoutElement>();
val3.preferredHeight = 24f;
val3.flexibleHeight = 0f;
_commandInput = CreateLabeledInputField(val.transform, "Command", "Example: teleport motel", out _commandErrorText);
GameObject val4 = UIFactory.Panel("KeyFieldRoot", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val5 = val4.AddComponent<LayoutElement>();
val5.preferredHeight = 74f;
val5.flexibleHeight = 0f;
UIFactory.VerticalLayoutOnGO(val4, 4, new RectOffset(0, 0, 0, 0));
ConfigureSectionStack(val4, (TextAnchor)0);
Text val6 = UIFactory.Text("KeyLabel", "Key", val4.transform, 14, (TextAnchor)3, (FontStyle)1);
((Graphic)val6).color = Color.white;
LayoutElement val7 = ((Component)val6).gameObject.AddComponent<LayoutElement>();
val7.preferredHeight = 18f;
val7.flexibleHeight = 0f;
GameObject val8 = UIFactory.Panel("KeyCaptureRow", val4.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val9 = val8.AddComponent<LayoutElement>();
val9.preferredHeight = 34f;
val9.flexibleHeight = 0f;
val9.flexibleWidth = 1f;
GameObject val10 = UIFactory.Panel("KeyInputBackground", val8.transform, new Color(0.1f, 0.11f, 0.14f, 0.96f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val11 = val10.AddComponent<LayoutElement>();
val11.preferredHeight = 34f;
val11.flexibleHeight = 0f;
val11.flexibleWidth = 1f;
val11.minWidth = 0f;
StretchToFill(val10.GetComponent<RectTransform>(), 0f, 166f, 0f, 0f);
_keyInput = CreateStyledInputField(val10, "Key", "Examples: Q, Alpha4, F2, or Keypad0");
GameObject val12 = UIFactory.Panel("CaptureKeyButtonHost", val8.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val13 = val12.AddComponent<LayoutElement>();
val13.preferredWidth = 148f;
val13.minWidth = 148f;
val13.preferredHeight = 34f;
RectTransform component = val12.GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null)
{
component.anchorMin = new Vector2(1f, 0.5f);
component.anchorMax = new Vector2(1f, 0.5f);
component.pivot = new Vector2(1f, 0.5f);
component.sizeDelta = new Vector2(148f, 34f);
component.anchoredPosition = Vector2.zero;
}
GameObject val14 = UIFactory.ButtonRow("CaptureKeyButtonRow", val12.transform, 0f, (TextAnchor)4);
StretchToFill(val14.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
Button item = UIFactory.RoundedButtonWithLabel("CaptureKeyButton", "Capture Key...", val14.transform, new Color(0.19f, 0.42f, 0.74f), 148f, 38f, 15, Color.white).Item2;
_keyErrorText = UIFactory.Text("KeyErrorText", string.Empty, val4.transform, 12, (TextAnchor)3, (FontStyle)0);
((Graphic)_keyErrorText).color = new Color(0.93f, 0.52f, 0.52f);
((Component)_keyErrorText).gameObject.SetActive(false);
LayoutElement val15 = ((Component)_keyErrorText).gameObject.AddComponent<LayoutElement>();
val15.preferredHeight = 14f;
val15.flexibleHeight = 0f;
GameObject val16 = UIFactory.Panel("CommandHelpPanel", val.transform, new Color(0.18f, 0.2f, 0.27f, 0.9f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val17 = val16.AddComponent<LayoutElement>();
val17.preferredHeight = 96f;
val17.flexibleHeight = 0f;
UIFactory.VerticalLayoutOnGO(val16, 8, new RectOffset(14, 14, 14, 14));
ConfigureSectionStack(val16, (TextAnchor)4);
Text val18 = UIFactory.Text("CommandHelpTitle", "Need help with a command?", val16.transform, 15, (TextAnchor)4, (FontStyle)1);
((Graphic)val18).color = Color.white;
GameObject val19 = UIFactory.Panel("CommandHelpTextSpacer", val16.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
Image component2 = val19.GetComponent<Image>();
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = false;
((Graphic)component2).raycastTarget = false;
}
LayoutElement val20 = val19.GetComponent<LayoutElement>() ?? val19.AddComponent<LayoutElement>();
val20.preferredHeight = 4f;
val20.flexibleHeight = 0f;
Text val21 = UIFactory.Text("CommandHelpBody", "Open the in-game command reference to browse available console commands.", val16.transform, 12, (TextAnchor)4, (FontStyle)0);
((Graphic)val21).color = new Color(0.82f, 0.86f, 0.92f);
GameObject val22 = UIFactory.Panel("CommandHelpButtonSpacer", val16.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
Image component3 = val22.GetComponent<Image>();
if ((Object)(object)component3 != (Object)null)
{
((Behaviour)component3).enabled = false;
((Graphic)component3).raycastTarget = false;
}
LayoutElement val23 = val22.GetComponent<LayoutElement>() ?? val22.AddComponent<LayoutElement>();
val23.preferredHeight = 6f;
val23.flexibleHeight = 0f;
GameObject val24 = UIFactory.ButtonRow("CommandHelpButtons", val16.transform, 0f, (TextAnchor)4);
LayoutElement val25 = val24.AddComponent<LayoutElement>();
val25.preferredHeight = 58f;
Button item2 = UIFactory.RoundedButtonWithLabel("CommandReferenceButton", "Command Reference", val24.transform, new Color(0.31f, 0.46f, 0.71f), 172f, 38f, 14, Color.white).Item2;
GameObject val26 = UIFactory.Panel("AddKeybindButtonSpacer", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
Image component4 = val26.GetComponent<Image>();
if ((Object)(object)component4 != (Object)null)
{
((Behaviour)component4).enabled = false;
((Graphic)component4).raycastTarget = false;
}
LayoutElement val27 = val26.GetComponent<LayoutElement>() ?? val26.AddComponent<LayoutElement>();
val27.flexibleHeight = 1f;
_cancelEditButtonRow = UIFactory.ButtonRow("CancelEditButtons", val.transform, 10f, (TextAnchor)4);
LayoutElement val28 = _cancelEditButtonRow.AddComponent<LayoutElement>();
val28.preferredHeight = 44f;
val28.flexibleHeight = 0f;
Button item3 = UIFactory.RoundedButtonWithLabel("CancelEditButton", "Cancel", _cancelEditButtonRow.transform, new Color(0.42f, 0.45f, 0.5f), 176f, 38f, 15, Color.white).Item2;
_cancelEditButtonRow.SetActive(false);
GameObject val29 = UIFactory.ButtonRow("AddKeybindButtons", val.transform, 10f, (TextAnchor)4);
LayoutElement val30 = val29.AddComponent<LayoutElement>();
val30.preferredHeight = 44f;
val30.flexibleHeight = 0f;
ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.RoundedButtonWithLabel("AddKeybindButton", "Add Keybind", val29.transform, new Color(0.24f, 0.56f, 0.33f), 176f, 38f, 15, Color.white);
Button item4 = valueTuple.Item2;
Text item5 = valueTuple.Item3;
_submitKeybindButtonText = item5;
ButtonUtils.AddListener(item, (Action)BeginKeyCapture);
ButtonUtils.AddListener(item2, _openCommandReference);
ButtonUtils.AddListener(item3, _cancelEditMode);
ButtonUtils.AddListener(item4, _submitKeybind);
UpdateComposerActions(isEditing: false);
}
private InputField CreateLabeledInputField(Transform parent, string labelText, string placeholderText, out Text errorText)
{
//IL_0021: 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_0064: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
GameObject val = UIFactory.Panel(labelText + "FieldRoot", parent, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredHeight = 74f;
UIFactory.VerticalLayoutOnGO(val, 4, new RectOffset(0, 0, 0, 0));
ConfigureSectionStack(val, (TextAnchor)0);
Text val3 = UIFactory.Text(labelText + "Label", labelText, val.transform, 14, (TextAnchor)3, (FontStyle)1);
((Graphic)val3).color = Color.white;
LayoutElement val4 = ((Component)val3).gameObject.AddComponent<LayoutElement>();
val4.preferredHeight = 18f;
val4.flexibleHeight = 0f;
GameObject val5 = UIFactory.Panel(labelText + "InputBackground", val.transform, new Color(0.1f, 0.11f, 0.14f, 0.96f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val6 = val5.AddComponent<LayoutElement>();
val6.preferredHeight = 34f;
val6.flexibleHeight = 0f;
InputField result = CreateStyledInputField(val5, labelText, placeholderText);
errorText = UIFactory.Text(labelText + "ErrorText", string.Empty, val.transform, 12, (TextAnchor)3, (FontStyle)0);
((Graphic)errorText).color = new Color(0.93f, 0.52f, 0.52f);
((Component)errorText).gameObject.SetActive(false);
LayoutElement val7 = ((Component)errorText).gameObject.AddComponent<LayoutElement>();
val7.preferredHeight = 14f;
val7.flexibleHeight = 0f;
return result;
}
private InputField CreateStyledInputField(GameObject inputBackground, string fieldName, string placeholderText)
{
//IL_004d: 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)
InputField val = inputBackground.AddComponent<InputField>();
((Selectable)val).targetGraphic = (Graphic)(object)inputBackground.GetComponent<Image>();
val.lineType = (LineType)0;
val.shouldHideMobileInput = true;
DisableSelectableNavigation((Selectable)(object)val);
Text val2 = UIFactory.Text(fieldName + "InputText", string.Empty, inputBackground.transform, 15, (TextAnchor)3, (FontStyle)0);
((Graphic)val2).color = Color.white;
val2.supportRichText = false;
ConfigureInputTextRect(((Graphic)val2).rectTransform);
Text val3 = UIFactory.Text(fieldName + "Placeholder", placeholderText, inputBackground.transform, 15, (TextAnchor)3, (FontStyle)2);
((Graphic)val3).color = new Color(1f, 1f, 1f, 0.38f);
((Graphic)val3).raycastTarget = false;
ConfigureInputTextRect(((Graphic)val3).rectTransform);
val.textComponent = val2;
val.placeholder = (Graphic)(object)val3;
return val;
}
private void HandleCommandInputChanged()
{
if ((Object)(object)_commandInput != (Object)null)
{
ValidateFieldLive(_commandInput);
}
}
private void HandleCommandInputEndEdit()
{
if ((Object)(object)_commandInput != (Object)null)
{
ValidateFieldOnBlur(_commandInput);
}
}
private void HandleKeyInputChanged()
{
if ((Object)(object)_keyInput != (Object)null)
{
ValidateFieldLive(_keyInput);
}
}
private void HandleKeyInputEndEdit()
{
NormalizeKeyInputText();
if ((Object)(object)_keyInput != (Object)null)
{
ValidateFieldOnBlur(_keyInput);
}
}
private static void ConfigureInputTextRect(RectTransform rectTransform)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_003a: Unknown result type (might be due to invalid IL or missing references)
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = new Vector2(12f, 5f);
rectTransform.offsetMax = new Vector2(-12f, -5f);
}
private static void DisableSelectableNavigation(Selectable selectable)
{
PropertyInfo property = typeof(Selectable).GetProperty("navigation");
if (property == null)
{
return;
}
object value = property.GetValue(selectable, null);
if (value == null)
{
return;
}
Type type = value.GetType();
MemberInfo memberInfo = (MemberInfo)(((object)type.GetProperty("mode")) ?? ((object)type.GetField("mode")));
if (!(memberInfo == null))
{
Type enumType = ((memberInfo is PropertyInfo propertyInfo) ? propertyInfo.PropertyType : ((FieldInfo)memberInfo).FieldType);
object value2 = Enum.ToObject(enumType, 0);
if (memberInfo is PropertyInfo propertyInfo2)
{
propertyInfo2.SetValue(value, value2, null);
}
else
{
((FieldInfo)memberInfo).SetValue(value, value2);
}
property.SetValue(selectable, value, null);
}
}
private void BeginKeyCapture()
{
if (!((Object)(object)_keyInput == (Object)null) && !((Object)(object)_keyCaptureOverlay == (Object)null))
{
_isAwaitingKeyCapture = true;
_capturedKey = null;
_keyInput.DeactivateInputField();
_keyCaptureListener?.BeginCapture();
_keyCaptureOverlay.SetActive(true);
_keyCaptureOverlay.transform.SetAsLastSibling();
EventSystem current = EventSystem.current;
if (current != null)
{
current.SetSelectedGameObject((GameObject)null);
}
if ((Object)(object)_keyCaptureValueText != (Object)null)
{
_keyCaptureValueText.text = "Waiting for input...";
}
if ((Object)(object)_saveCapturedKeyButton != (Object)null)
{
((Selectable)_saveCapturedKeyButton).interactable = false;
}
}
}
private void OnKeyCaptured(KeyCode keyCode)
{
//IL_0012: 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)
if (_isAwaitingKeyCapture)
{
_capturedKey = keyCode;
EventSystem current = EventSystem.current;
if (current != null)
{
current.SetSelectedGameObject((GameObject)null);
}
if ((Object)(object)_keyCaptureValueText != (Object)null)
{
_keyCaptureValueText.text = KeybindInputUtility.FormatKeyCode(keyCode);
}
if ((Object)(object)_saveCapturedKeyButton != (Object)null)
{
((Selectable)_saveCapturedKeyButton).interactable = true;
}
}
}
private void CancelCapture()
{
_isAwaitingKeyCapture = false;
_capturedKey = null;
_keyCaptureListener?.CancelCapture();
if ((Object)(object)_keyCaptureOverlay != (Object)null)
{
_keyCaptureOverlay.SetActive(false);
}
if ((Object)(object)_keyCaptureValueText != (Object)null)
{
_keyCaptureValueText.text = "Waiting for input...";
}
if ((Object)(object)_saveCapturedKeyButton != (Object)null)
{
((Selectable)_saveCapturedKeyButton).interactable = false;
}
}
private void SaveCapturedKey()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_keyInput == (Object)null) && _capturedKey.HasValue)
{
_keyInput.text = KeybindInputUtility.FormatKeyCode(_capturedKey.Value);
SetFieldError(_keyErrorText, null);
ValidateKeyField(showErrors: false);
CancelCapture();
}
}
private void NormalizeKeyInputText()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_keyInput == (Object)null))
{
if (KeybindInputUtility.TryParseKeyCode(_keyInput.text, out var keyCode))
{
_isAwaitingKeyCapture = false;
_capturedKey = keyCode;
_keyInput.text = KeybindInputUtility.FormatKeyCode(keyCode);
SetFieldError(_keyErrorText, null);
}
else
{
_capturedKey = null;
}
}
}
private void PollKeyCapture()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005d: 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_007d: Unknown result type (might be due to invalid IL or missing references)
if (!_isAwaitingKeyCapture)
{
return;
}
KeyCaptureListener? keyCaptureListener = _keyCaptureListener;
if (keyCaptureListener != null && keyCaptureListener.TryConsumeCapturedKey(out var keyCode))
{
OnKeyCaptured(keyCode);
return;
}
foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
{
if (!KeybindInputUtility.IsSupportedKeyboardKey(value) || !Input.GetKeyDown(value))
{
continue;
}
OnKeyCaptured(value);
break;
}
}
private void PollInputField(InputField? inputField, ref bool wasFocused, ref string lastText, Action onTextChanged, Action onEndEdit)
{
if ((Object)(object)inputField == (Object)null)
{
wasFocused = false;
lastText = string.Empty;
return;
}
bool flag = IsInputFieldActive(inputField);
if (flag != wasFocused)
{
wasFocused = flag;
lastText = inputField.text ?? string.Empty;
if (!flag)
{
onEndEdit();
}
}
if (flag)
{
HandleFieldInputUpdate(inputField);
string text = inputField.text ?? string.Empty;
if (!string.Equals(text, lastText, StringComparison.Ordinal))
{
lastText = text;
onTextChanged();
}
}
}
private bool IsConfirmationDialogActive()
{
return (Object)(object)_deleteConfirmationOverlay != (Object)null && _deleteConfirmationOverlay.activeSelf;
}
private bool IsCommandReferenceDialogActive()
{
return (Object)(object)_commandReferenceOverlay != (Object)null && _commandReferenceOverlay.activeSelf;
}
private static bool IsInputFieldActive(InputField? inputField)
{
if ((Object)(object)inputField == (Object)null)
{
return false;
}
if (inputField.isFocused)
{
return true;
}
EventSystem current = EventSystem.current;
GameObject val = ((current != null) ? current.currentSelectedGameObject : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
return (Object)(object)val == (Object)(object)((Component)inputField).gameObject;
}
private void ConfirmPendingConfirmation()
{
Action pendingConfirmationAction = _pendingConfirmationAction;
CloseDeleteConfirmation();
pendingConfirmationAction?.Invoke();
}
private void RefreshCommandReferenceList(IReadOnlyList<ConsoleCommandReferenceEntry> entries)
{
if ((Object)(object)_commandReferenceListContent == (Object)null)
{
return;
}
UIFactory.ClearChildren((Transform)(object)_commandReferenceListContent);
if (entries.Count == 0)
{
CreateCommandReferenceEmptyState();
UIFactory.FitContentHeight(_commandReferenceListContent);
return;
}
for (int i = 0; i < entries.Count; i++)
{
CreateCommandReferenceRow(i, entries[i]);
}
UIFactory.FitContentHeight(_commandReferenceListContent);
}
private void HandleFieldInputUpdate(InputField sourceField)
{
if (Input.GetKeyDown((KeyCode)96))
{
sourceField.text = sourceField.text.Replace("`", string.Empty);
sourceField.caretPosition = sourceField.text.Length;
}
}
private static void ConfigureContentColumns(GameObject contentPanel)
{
HorizontalLayoutGroup component = contentPanel.GetComponent<HorizontalLayoutGroup>();
if (!((Object)(object)component == (Object)null))
{
((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = true;
((LayoutGroup)component).childAlignment = (TextAnchor)0;
}
}
private static void ConfigureSectionStack(GameObject section, TextAnchor alignment)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
VerticalLayoutGroup component = section.GetComponent<VerticalLayoutGroup>();
if (!((Object)(object)component == (Object)null))
{
((LayoutGroup)component).childAlignment = alignment;
((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
}
}
private static void ConfigureTitleBarRect(RectTransform? rectTransform)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_006f: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rectTransform == (Object)null))
{
((Transform)rectTransform).SetAsFirstSibling();
rectTransform.anchorMin = new Vector2(0f, 1f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.pivot = new Vector2(0.5f, 1f);
rectTransform.offsetMin = new Vector2(0f, -52f);
rectTransform.offsetMax = Vector2.zero;
}
}
private static void StretchToFill(RectTransform? rectTransform, float left, float right, float bottom, float top)
{
//IL_0010: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rectTransform == (Object)null))
{
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = new Vector2(left, bottom);
rectTransform.offsetMax = new Vector2(0f - right, 0f - top);
}
}
private static void ConfigureScrollRect(ScrollRect scrollRect)
{
RectTransform viewport = scrollRect.viewport;
StretchToFill(((Component)scrollRect).GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
if ((Object)(object)viewport != (Object)null)
{
StretchToFill(viewport, 0f, 0f, 0f, 0f);
}
if ((Object)(object)scrollRect.verticalScrollbar != (Object)null)
{
((Component)scrollRect.verticalScrollbar).gameObject.SetActive(false);
scrollRect.verticalScrollbar = null;
}
scrollRect.horizontal = false;
}
private static void ConfigureScrollContent(RectTransform content)
{
//IL_000c: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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)
content.anchorMin = new Vector2(0f, 1f);
content.anchorMax = new Vector2(1f, 1f);
content.pivot = new Vector2(0.5f, 1f);
content.anchoredPosition = Vector2.zero;
content.sizeDelta = new Vector2(0f, content.sizeDelta.y);
if ((Object)(object)((Component)content).GetComponent<ContentSizeFitter>() == (Object)null)
{
ContentSizeFitter val = ((Component)content).gameObject.AddComponent<ContentSizeFitter>();
val.horizontalFit = (FitMode)0;
val.verticalFit = (FitMode)2;
}
VerticalLayoutGroup component = ((Component)content).GetComponent<VerticalLayoutGroup>();
if ((Object)(object)component != (Object)null)
{
((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
}
}
private static Scrollbar EnsureVerticalScrollbar(ScrollRect scrollRect)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
Scrollbar verticalScrollbar = scrollRect.verticalScrollbar;
if ((Object)(object)verticalScrollbar != (Object)null)
{
ConfigureVerticalScrollbarRect(((Component)verticalScrollbar).GetComponent<RectTransform>());
verticalScrollbar.direction = (Direction)2;
return verticalScrollbar;
}
GameObject val = UIFactory.Panel("SavedKeybindsScrollbar", ((Component)scrollRect).transform, new Color(1f, 1f, 1f, 0.12f), (Vector2?)null, (Vector2?)null, false);
Scrollbar val2 = val.GetComponent<Scrollbar>() ?? val.AddComponent<Scrollbar>();
RectTransform component = val.GetComponent<RectTransform>();
ConfigureVerticalScrollbarRect(component);
Image component2 = val.GetComponent<Image>();
((Graphic)component2).color = new Color(1f, 1f, 1f, 0.12f);
((Graphic)component2).raycastTarget = true;
GameObject val3 = UIFactory.Panel("SlidingArea", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
Image component3 = val3.GetComponent<Image>();
if ((Object)(object)component3 != (Object)null)
{
((Behaviour)component3).enabled = false;
((Graphic)component3).raycastTarget = false;
}
RectTransform component4 = val3.GetComponent<RectTransform>();
component4.anchorMin = Vector2.zero;
component4.anchorMax = Vector2.one;
component4.offsetMin = new Vector2(2f, 2f);
component4.offsetMax = new Vector2(-2f, -2f);
GameObject val4 = UIFactory.Panel("Handle", val3.transform, new Color(0.48f, 0.63f, 0.9f, 0.92f), (Vector2?)null, (Vector2?)null, false);
RectTransform component5 = val4.GetComponent<RectTransform>();
component5.anchorMin = Vector2.zero;
component5.anchorMax = Vector2.one;
component5.offsetMin = Vector2.zero;
component5.offsetMax = Vector2.zero;
Image component6 = val4.GetComponent<Image>();
((Graphic)component6).color = new Color(0.48f, 0.63f, 0.9f, 0.92f);
val2.direction = (Direction)2;
((Selectable)val2).targetGraphic = (Graphic)(object)component6;
val2.handleRect = component5;
val2.size = 0.2f;
return val2;
}
private static void ConfigureVerticalScrollbarRect(RectTransform? rectTransform)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rectTransform == (Object)null))
{
rectTransform.anchorMin = new Vector2(1f, 0f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.pivot = new Vector2(1f, 1f);
rectTransform.offsetMin = new Vector2(-24f, 2f);
rectTransform.offsetMax = new Vector2(-2f, -2f);
}
}
private void CreateDeleteConfirmationDialog(Transform parent)
{
//IL_001c: 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_00fd: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Expected O, but got Unknown
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
_deleteConfirmationOverlay = UIFactory.Panel("DeleteConfirmOverlay", parent, new Color(0f, 0f, 0f, 0.72f), (Vector2?)null, (Vector2?)null, true);
StretchToFill(_deleteConfirmationOverlay.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
_deleteConfirmationOverlay.transform.SetAsLastSibling();
Image component = _deleteConfirmationOverlay.GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
((Graphic)component).raycastTarget = true;
}
GameObject val = UIFactory.Panel("DeleteConfirmDialog", _deleteConfirmationOverlay.transform, new Color(0.14f, 0.16f, 0.21f, 0.98f), (Vector2?)null, (Vector2?)null, false);
RectTransform component2 = val.GetComponent<RectTransform>();
if ((Object)(object)component2 != (Object)null)
{
component2.anchorMin = new Vector2(0.5f, 0.5f);
component2.anchorMax = new Vector2(0.5f, 0.5f);
component2.pivot = new Vector2(0.5f, 0.5f);
component2.sizeDelta = new Vector2(380f, 180f);
component2.anchoredPosition = Vector2.zero;
}
_deleteConfirmationDialogRect = component2;
Image component3 = val.GetComponent<Image>();
if ((Object)(object)component3 != (Object)null)
{
((Graphic)component3).raycastTarget = true;
}
UIFactory.VerticalLayoutOnGO(val, 12, new RectOffset(18, 18, 18, 18));
_deleteConfirmationTitleText = UIFactory.Text("DeleteConfirmTitle", "Delete keybind?", val.transform, 18, (TextAnchor)3, (FontStyle)1);
((Graphic)_deleteConfirmationTitleText).color = Color.white;
_deleteConfirmationText = UIFactory.Text("DeleteConfirmText", string.Empty, val.transform, 14, (TextAnchor)0, (FontStyle)0);
((Graphic)_deleteConfirmationText).color = new Color(0.87f, 0.89f, 0.95f);
LayoutElement val2 = ((Component)_deleteConfirmationText).gameObject.AddComponent<LayoutElement>();
val2.flexibleHeight = 1f;
GameObject val3 = UIFactory.ButtonRow("DeleteConfirmButtons", val.transform, 10f, (TextAnchor)5);
LayoutElement val4 = val3.AddComponent<LayoutElement>();
val4.preferredHeight = 42f;
Button item = UIFactory.RoundedButtonWithLabel("CancelDeleteButton", "Cancel", val3.transform, new Color(0.34f, 0.38f, 0.47f), 112f, 38f, 15, Color.white).Item2;
ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.RoundedButtonWithLabel("ConfirmDeleteButton", "Delete", val3.transform, new Color(0.71f, 0.2f, 0.22f), 112f, 38f, 15, Color.white);
Button item2 = valueTuple.Item2;
Text item3 = valueTuple.Item3;
_deleteConfirmationConfirmButtonText = item3;
ButtonUtils.AddListener(item, (Action)CloseDeleteConfirmation);
ButtonUtils.AddListener(item2, (Action)ConfirmPendingConfirmation);
_deleteConfirmationOverlay.SetActive(false);
}
private void CreateKeyCaptureDialog(Transform parent)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: 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_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected O, but got Unknown
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Expected O, but got Unknown
//IL_02d3: 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_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
_keyCaptureOverlay = UIFactory.Panel("KeyCaptureOverlay", parent, new Color(0f, 0f, 0f, 0.72f), (Vector2?)null, (Vector2?)null, true);
_keyCaptureListener = _keyCaptureOverlay.AddComponent<KeyCaptureListener>();
StretchToFill(_keyCaptureOverlay.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
_keyCaptureOverlay.transform.SetAsLastSibling();
Image component = _keyCaptureOverlay.GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
((Graphic)component).raycastTarget = true;
}
GameObject val = UIFactory.Panel("KeyCaptureDialog", _keyCaptureOverlay.transform, new Color(0.14f, 0.16f, 0.21f, 0.98f), (Vector2?)null, (Vector2?)null, false);
RectTransform component2 = val.GetComponent<RectTransform>();
if ((Object)(object)component2 != (Object)null)
{
component2.anchorMin = new Vector2(0.5f, 0.5f);
component2.anchorMax = new Vector2(0.5f, 0.5f);
component2.pivot = new Vector2(0.5f, 0.5f);
component2.sizeDelta = new Vector2(400f, 210f);
component2.anchoredPosition = Vector2.zero;
}
Image component3 = val.GetComponent<Image>();
if ((Object)(object)component3 != (Object)null)
{
((Graphic)component3).raycastTarget = true;
}
UIFactory.VerticalLayoutOnGO(val, 12, new RectOffset(18, 18, 18, 18));
ConfigureSectionStack(val, (TextAnchor)0);
Text val2 = UIFactory.Text("KeyCaptureTitle", "Capture key", val.transform, 18, (TextAnchor)3, (FontStyle)1);
((Graphic)val2).color = Color.white;
LayoutElement val3 = ((Component)val2).gameObject.AddComponent<LayoutElement>();
val3.preferredHeight = 24f;
val3.flexibleHeight = 0f;
Text val4 = UIFactory.Text("KeyCapturePrompt", "Press a key to capture it.", val.transform, 14, (TextAnchor)3, (FontStyle)0);
((Graphic)val4).color = new Color(0.87f, 0.89f, 0.95f);
GameObject val5 = UIFactory.Panel("KeyCaptureValuePanel", val.transform, new Color(0.1f, 0.11f, 0.14f, 0.96f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val6 = val5.AddComponent<LayoutElement>();
val6.preferredHeight = 52f;
val6.flexibleHeight = 0f;
UIFactory.VerticalLayoutOnGO(val5, 0, new RectOffset(14, 14, 12, 12));
ConfigureSectionStack(val5, (TextAnchor)3);
_keyCaptureValueText = UIFactory.Text("KeyCaptureValue", "Waiting for input...", val5.transform, 16, (TextAnchor)3, (FontStyle)1);
((Graphic)_keyCaptureValueText).color = Color.white;
GameObject val7 = UIFactory.Panel("KeyCaptureSpacer", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
Image component4 = val7.GetComponent<Image>();
if ((Object)(object)component4 != (Object)null)
{
((Behaviour)component4).enabled = false;
((Graphic)component4).raycastTarget = false;
}
LayoutElement val8 = val7.GetComponent<LayoutElement>() ?? val7.AddComponent<LayoutElement>();
val8.flexibleHeight = 1f;
GameObject val9 = UIFactory.ButtonRow("KeyCaptureButtons", val.transform, 10f, (TextAnchor)5);
LayoutElement val10 = val9.AddComponent<LayoutElement>();
val10.preferredHeight = 42f;
Button item = UIFactory.RoundedButtonWithLabel("CancelKeyCaptureButton", "Cancel", val9.transform, new Color(0.34f, 0.38f, 0.47f), 112f, 38f, 15, Color.white).Item2;
Button item2 = UIFactory.RoundedButtonWithLabel("SaveCapturedKeyButton", "Save", val9.transform, new Color(0.24f, 0.56f, 0.33f), 112f, 38f, 15, Color.white).Item2;
DisableSelectableNavigation((Selectable)(object)item);
DisableSelectableNavigation((Selectable)(object)item2);
ButtonUtils.AddListener(item, (Action)CancelCapture);
ButtonUtils.AddListener(item2, (Action)SaveCapturedKey);
_saveCapturedKeyButton = item2;
((Selectable)_saveCapturedKeyButton).interactable = false;
_keyCaptureOverlay.SetActive(false);
}
private void CreateCommandReferenceDialog(Transform parent)
{
//IL_001c: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Expected O, but got Unknown
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0502: Unknown result type (might be due to invalid IL or missing references)
//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
//IL_05cd: Expected O, but got Unknown
_commandReferenceOverlay = UIFactory.Panel("CommandReferenceOverlay", parent, new Color(0f, 0f, 0f, 0.78f), (Vector2?)null, (Vector2?)null, true);
StretchToFill(_commandReferenceOverlay.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
_commandReferenceOverlay.transform.SetAsLastSibling();
Image component = _commandReferenceOverlay.GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
((Graphic)component).raycastTarget = true;
}
GameObject val = UIFactory.Panel("CommandReferenceDialog", _commandReferenceOverlay.transform, new Color(0.09f, 0.11f, 0.15f, 0.98f), (Vector2?)null, (Vector2?)null, false);
StretchToFill(val.GetComponent<RectTransform>(), 16f, 16f, 16f, 16f);
UIFactory.VerticalLayoutOnGO(val, 12, new RectOffset(18, 18, 18, 18));
ConfigureSectionStack(val, (TextAnchor)0);
GameObject val2 = UIFactory.Panel("CommandReferenceHeader", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val3 = val2.AddComponent<LayoutElement>();
val3.preferredHeight = 42f;
UIFactory.HorizontalLayoutOnGO(val2, 12, 0, 0, 0, 0, (TextAnchor)3);
Text val4 = UIFactory.Text("CommandReferenceTitle", "Command Reference", val2.transform, 20, (TextAnchor)3, (FontStyle)1);
((Graphic)val4).color = Color.white;
LayoutElement val5 = ((Component)val4).gameObject.AddComponent<LayoutElement>();
val5.flexibleWidth = 1f;
Button item = UIFactory.RoundedButtonWithLabel("CloseCommandReferenceButton", "Close", val2.transform, new Color(0.34f, 0.38f, 0.47f), 110f, 38f, 15, Color.white).Item2;
ButtonUtils.AddListener(item, (Action)CloseCommandReference);
_commandReferenceStatusText = UIFactory.Text("CommandReferenceStatus", string.Empty, val.transform, 13, (TextAnchor)3, (FontStyle)0);
((Graphic)_commandReferenceStatusText).color = new Color(0.79f, 0.84f, 0.9f);
LayoutElement val6 = ((Component)_commandReferenceStatusText).gameObject.AddComponent<LayoutElement>();
val6.preferredHeight = 18f;
val6.flexibleHeight = 0f;
GameObject val7 = UIFactory.Panel("CommandReferenceTableSurface", val.transform, new Color(0.16f, 0.18f, 0.24f, 0.98f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val8 = val7.AddComponent<LayoutElement>();
val8.flexibleHeight = 1f;
val8.minHeight = 180f;
UIFactory.VerticalLayoutOnGO(val7, 0, new RectOffset(0, 0, 0, 0));
ConfigureSectionStack(val7, (TextAnchor)0);
GameObject val9 = UIFactory.Panel("CommandReferenceTableHeader", val7.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val10 = val9.AddComponent<LayoutElement>();
val10.preferredHeight = 38f;
val10.flexibleHeight = 0f;
UIFactory.HorizontalLayoutOnGO(val9, 12, 4, 46, 8, 8, (TextAnchor)3);
GameObject val11 = UIFactory.Panel("CommandReferenceHeaderLeftSpacer", val9.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
Image component2 = val11.GetComponent<Image>();
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = false;
((Graphic)component2).raycastTarget = false;
}
LayoutElement val12 = val11.GetComponent<LayoutElement>() ?? val11.AddComponent<LayoutElement>();
val12.preferredWidth = 8f;
val12.minWidth = 8f;
val12.flexibleWidth = 0f;
Text val13 = CreateCommandReferenceTableText("CommandReferenceHeaderCommand", "Command", val9.transform, 14, (FontStyle)1, Color.white);
LayoutElement val14 = ((Component)val13).gameObject.AddComponent<LayoutElement>();
val14.preferredWidth = 160f;
val14.minWidth = 160f;
Text val15 = CreateCommandReferenceTableText("CommandReferenceHeaderExample", "Example", val9.transform, 14, (FontStyle)1, Color.white);
LayoutElement val16 = ((Component)val15).gameObject.AddComponent<LayoutElement>();
val16.preferredWidth = 220f;
val16.minWidth = 220f;
Text val17 = CreateCommandReferenceTableText("CommandReferenceHeaderDescription", "Description", val9.transform, 14, (FontStyle)1, Color.white);
LayoutElement val18 = ((Component)val17).gameObject.AddComponent<LayoutElement>();
val18.flexibleWidth = 1f;
GameObject val19 = UIFactory.Panel("CommandReferenceHeaderDivider", val7.transform, new Color(1f, 1f, 1f, 0.1f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val20 = val19.AddComponent<LayoutElement>();
val20.preferredHeight = 1f;
val20.flexibleHeight = 0f;
ScrollRect val21 = default(ScrollRect);
_commandReferenceListContent = UIFactory.ScrollableVerticalList("CommandReferenceList", val7.transform, ref val21);
LayoutElement val22 = ((Component)val21).gameObject.AddComponent<LayoutElement>();
val22.flexibleHeight = 1f;
val22.minHeight = 180f;
ConfigureScrollRect(val21);
ConfigureScrollContent(_commandReferenceListContent);
if ((Object)(object)((Component)_commandReferenceListContent).GetComponent<VerticalLayoutGroup>() == (Object)null)
{
UIFactory.VerticalLayoutOnGO(((Component)_commandReferenceListContent).gameObject, 0, new RectOffset(0, 0, 0, 0));
}
_commandReferenceOverlay.SetActive(false);
}
private void ConfigureTitleBar(GameObject titleBar)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
HorizontalLayoutGroup component = titleBar.GetComponent<HorizontalLayoutGroup>();
if ((Object)(object)component != (Object)null)
{
((LayoutGroup)component).childAlignment = (TextAnchor)4;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
((LayoutGroup)component).padding = new RectOffset(16, 16, 10, 10);
}
Text componentInChildren = titleBar.GetComponentInChildren<Text>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.alignment = (TextAnchor)4;
((Graphic)componentInChildren).color = Color.white;
}
}
private void CreateEmptyKeybindState()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_00af: 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)
if (!((Object)(object)_keybindListContent == (Object)null))
{
GameObject val = UIFactory.Panel("EmptyState", (Transform)(object)_keybindListContent, new Color(0.17f, 0.19f, 0.25f, 0.96f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredHeight = 88f;
val2.flexibleWidth = 1f;
UIFactory.VerticalLayoutOnGO(val, 4, new RectOffset(14, 14, 14, 14));
ConfigureSectionStack(val, (TextAnchor)3);
Text val3 = UIFactory.Text("EmptyStateTitle", "No saved keybinds yet", val.transform, 15, (TextAnchor)3, (FontStyle)1);
((Graphic)val3).color = Color.white;
Text val4 = UIFactory.Text("EmptyStateBody", "Add a command and key on the right to create your first keybind.", val.transform, 13, (TextAnchor)3, (FontStyle)0);
((Graphic)val4).color = new Color(0.8f, 0.84f, 0.9f);
}
}
private void CreateCommandReferenceEmptyState()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_00af: 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)
if (!((Object)(object)_commandReferenceListContent == (Object)null))
{
GameObject val = UIFactory.Panel("CommandReferenceEmptyState", (Transform)(object)_commandReferenceListContent, new Color(0.17f, 0.19f, 0.25f, 0.96f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredHeight = 92f;
val2.flexibleWidth = 1f;
UIFactory.VerticalLayoutOnGO(val, 4, new RectOffset(14, 14, 14, 14));
ConfigureSectionStack(val, (TextAnchor)3);
Text val3 = UIFactory.Text("CommandReferenceEmptyTitle", "No commands available", val.transform, 15, (TextAnchor)3, (FontStyle)1);
((Graphic)val3).color = Color.white;
Text val4 = UIFactory.Text("CommandReferenceEmptyBody", "The game's console registry did not return any commands for this session.", val.transform, 13, (TextAnchor)3, (FontStyle)0);
((Graphic)val4).color = new Color(0.8f, 0.84f, 0.9f);
}
}
private void CreateSavedKeybindRow(int index, SavedKeybind keybind)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: 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)
if (!((Object)(object)_keybindListContent == (Object)null))
{
GameObject val = UIFactory.Panel($"KeybindRow{index}", (Transform)(object)_keybindListContent, new Color(0.19f, 0.21f, 0.27f, 0.95f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredHeight = 64f;
val2.flexibleWidth = 1f;
StretchToFill(val.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
UIFactory.HorizontalLayoutOnGO(val, 12, 14, 14, 10, 10, (TextAnchor)3);
GameObject val3 = UIFactory.Panel($"KeybindTextPanel{index}", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val4 = val3.AddComponent<LayoutElement>();
val4.flexibleWidth = 1f;
UIFactory.VerticalLayoutOnGO(val3, 2, new RectOffset(0, 0, 0, 0));
Text val5 = UIFactory.Text($"KeybindCommand{index}", keybind.Command, val3.transform, 15, (TextAnchor)3, (FontStyle)1);
((Graphic)val5).color = Color.white;
Text val6 = UIFactory.Text($"KeybindValue{index}", "Key: " + KeybindInputUtility.FormatKeyCode(keybind.Key), val3.transform, 13, (TextAnchor)3, (FontStyle)0);
((Graphic)val6).color = new Color(0.82f, 0.86f, 0.92f);
GameObject val7 = UIFactory.ButtonRow($"KeybindActions{index}", val.transform, 8f, (TextAnchor)4);
LayoutElement val8 = val7.AddComponent<LayoutElement>();
val8.preferredWidth = 110f;
val8.minWidth = 110f;
Button item = UIFactory.RoundedButtonWithLabel($"EditKeybindButton{index}", "Edit", val7.transform, new Color(0.24f, 0.48f, 0.72f), 68f, 34f, 13, Color.white).Item2;
ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.RoundedButtonWithLabel($"DeleteKeybindButton{index}", "X", val7.transform, new Color(0.71f, 0.2f, 0.22f), 34f, 34f, 16, Color.white);
Button item2 = valueTuple.Item2;
Text item3 = valueTuple.Item3;
item3.fontStyle = (FontStyle)1;
int rowIndex = index;
ButtonUtils.AddListener(item, (Action)delegate
{
_beginEditKeybind(rowIndex);
});
ButtonUtils.AddListener(item2, (Action)delegate
{
_requestDeleteKeybind(rowIndex);
});
}
}
private void CreateCommandReferenceRow(int index, ConsoleCommandReferenceEntry entry)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: 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_027a: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_commandReferenceListContent == (Object)null))
{
GameObject val = UIFactory.Panel($"CommandReferenceRow{index}", (Transform)(object)_commandReferenceListContent, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredHeight = 74f;
val2.flexibleWidth = 1f;
UIFactory.VerticalLayoutOnGO(val, 0, new RectOffset(0, 0, 0, 0));
ConfigureSectionStack(val, (TextAnchor)3);
GameObject val3 = UIFactory.Panel($"CommandReferenceRowContent{index}", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val4 = val3.AddComponent<LayoutElement>();
val4.preferredHeight = 73f;
val4.flexibleWidth = 1f;
UIFactory.HorizontalLayoutOnGO(val3, 12, 14, 46, 10, 10, (TextAnchor)3);
Text val5 = CreateCommandReferenceTableText($"CommandReferenceWord{index}", entry.Command, val3.transform, 15, (FontStyle)1, Color.white);
LayoutElement val6 = ((Component)val5).gameObject.AddComponent<LayoutElement>();
val6.preferredWidth = 160f;
val6.minWidth = 160f;
string content = (string.IsNullOrWhiteSpace(entry.Description) ? "No description provided." : entry.Description);
string content2 = (string.IsNullOrWhiteSpace(entry.Example) ? "Unavailable" : entry.Example);
Text val7 = CreateCommandReferenceTableText($"CommandReferenceExample{index}", content2, val3.transform, 13, (FontStyle)2, new Color(0.69f, 0.77f, 0.88f));
LayoutElement val8 = ((Component)val7).gameObject.AddComponent<LayoutElement>();
val8.preferredWidth = 220f;
val8.minWidth = 220f;
Text val9 = CreateCommandReferenceTableText($"CommandReferenceDescription{index}", content, val3.transform, 13, (FontStyle)0, new Color(0.84f, 0.88f, 0.94f));
LayoutElement val10 = ((Component)val9).gameObject.AddComponent<LayoutElement>();
val10.flexibleWidth = 1f;
GameObject val11 = UIFactory.Panel($"CommandReferenceDivider{index}", val.transform, new Color(1f, 1f, 1f, 0.08f), (Vector2?)null, (Vector2?)null, false);
LayoutElement val12 = val11.AddComponent<LayoutElement>();
val12.preferredHeight = 1f;
val12.flexibleWidth = 1f;
}
}