Decompiled source of GK2 AutoKeeper v0.3.28
plugins/AutoKeeper/AutoKeeper.dll
Decompiled 5 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using AutoKeeper.Bot; using AutoKeeper.Bot.Tasks; using AutoKeeper.Config; using AutoKeeper.Core; using AutoKeeper.UI; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LazyBearTechnology; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pathfinding; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("focabr")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.28.0")] [assembly: AssemblyInformationalVersion("0.3.28+e7f8ad56032b61c02d1ba5f572fd3bd3c16f9430")] [assembly: AssemblyProduct("GK2 AutoKeeper")] [assembly: AssemblyTitle("AutoKeeper")] [assembly: AssemblyVersion("0.3.28.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 AutoKeeper { [BepInPlugin("com.focabr.gk2.autokeeper", "GK2 AutoKeeper", "0.3.28")] [BepInProcess("GraveyardKeeper2.exe")] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.focabr.gk2.autokeeper"; public const string Name = "GK2 AutoKeeper"; public const string Version = "0.3.28"; public const string TestedGameVersion = "1.007.1"; private Harmony harmony; private Overlay overlay; private SettingsWindow settingsWindow; private NativeSettingsWindow nativeWindow; private bool compatibilityChecked; private bool configDirty; private float configDirtySince; public static Plugin Instance { get; private set; } public Settings Settings { get; private set; } internal BotController Bot { get; private set; } public string BotStatusText { get { if (Bot != null) { if (!string.IsNullOrEmpty(Bot.StateDetail)) { return $"{Bot.State} — {Bot.StateDetail}"; } return Bot.State.ToString(); } return "-"; } } public bool IsBotOn { get { if (Bot != null) { return Bot.State != BotController.BotState.Off; } return false; } } private bool SettingsOpen { get { if (!((Object)(object)nativeWindow != (Object)null) || !((LazyWindow<LazyWidgetDataBase>)nativeWindow).IsShown) { if (settingsWindow != null) { return settingsWindow.IsOpen; } return false; } return true; } } private bool CapturingKey { get { if (!((Object)(object)nativeWindow != (Object)null) || !nativeWindow.IsCapturingKey) { if (settingsWindow != null) { return settingsWindow.IsCapturingKey; } return false; } return true; } } public void ToggleBot() { Bot?.Toggle(); } public void ToggleSettingsWindow() { if ((Object)(object)nativeWindow != (Object)null && ((LazyWindow<LazyWidgetDataBase>)nativeWindow).IsShown) { ((LazyWindow<LazyWidgetDataBase>)nativeWindow).Close(); return; } if (settingsWindow.IsOpen) { settingsWindow.Close(); return; } if ((Object)(object)nativeWindow == (Object)null) { nativeWindow = NativeSettingsWindow.TryCreate(Settings, Bot, out var error); if ((Object)(object)nativeWindow == (Object)null) { ModLog.WarnOnce("native-ui", Lang.T("Tela nativa indisponível (" + error + "); usando a tela simples.", "Native settings window unavailable (" + error + "); using the simple window.")); } } if ((Object)(object)nativeWindow != (Object)null) { try { ((LazyWindow<LazyWidgetDataBase>)nativeWindow).Open((LazyWidgetDataBase)null); return; } catch (Exception arg) { ModLog.Error(Lang.T($"Falha ao abrir a tela nativa: {arg}", $"Failed to open the native settings window: {arg}")); Object.Destroy((Object)(object)((Component)nativeWindow).gameObject); nativeWindow = null; } } settingsWindow.Toggle(); } private void Awake() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown Instance = this; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; Settings = new Settings(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Config.SettingChanged += delegate { configDirty = true; configDirtySince = Time.unscaledTime; }; ((BaseUnityPlugin)this).Config.Save(); ModLog.Init(((BaseUnityPlugin)this).Logger, Settings); harmony = new Harmony("com.focabr.gk2.autokeeper"); try { harmony.PatchAll(typeof(Plugin).Assembly); ModLog.Detail(Lang.T($"Patches Harmony aplicados: {harmony.GetPatchedMethods().CountSafe()}", $"Harmony patches applied: {harmony.GetPatchedMethods().CountSafe()}")); } catch (Exception arg) { ModLog.Error(Lang.T($"Falha ao aplicar patches Harmony — o bot ficará desativado. {arg}", $"Failed to apply Harmony patches — the bot will be disabled. {arg}")); } Bot = new BotController(Settings); GameApi.HookGameLifecycle(); Bot.Register(new ProcessBodiesTask(Settings, Bot.Navigator)); overlay = new Overlay(Settings, Bot); settingsWindow = new SettingsWindow(Settings, Bot); overlay.OnSettingsClicked = ToggleSettingsWindow; ModLog.Detail("GK2 AutoKeeper 0.3.28 loaded."); } private void Update() { CheckCompatibilityOnce(); HandleHotkeys(); Bot.Update(Time.unscaledDeltaTime); SaveConfigIfDirty(!SettingsOpen); } private void OnGUI() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0066: Unknown result type (might be due to invalid IL or missing references) overlay.Draw(); settingsWindow.Draw(); if (Event.current == null || (int)Event.current.type != 7) { return; } Vector2 mousePosition = Event.current.mousePosition; Rect rect = overlay.Rect; int num; if (!((Rect)(ref rect)).Contains(mousePosition)) { if (settingsWindow.IsOpen) { rect = settingsWindow.Rect; num = (((Rect)(ref rect)).Contains(mousePosition) ? 1 : 0); } else { num = 0; } } else { num = 1; } bool mouseOverUi = (byte)num != 0; GameApi.SetModUiState(settingsWindow.IsOpen, mouseOverUi); } private void OnDestroy() { Bot?.Stop(Lang.T("plugin descarregado", "plugin unloaded")); GameApi.SetModUiState(windowOpen: false, mouseOverUi: false); SaveConfigIfDirty(force: true); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private void SaveConfigIfDirty(bool force) { if (!configDirty || (!force && !(Time.unscaledTime - configDirtySince > 1f))) { return; } configDirty = false; try { ((BaseUnityPlugin)this).Config.Save(); } catch (Exception ex) { ModLog.Warn(Lang.T("Não consegui salvar o .cfg: " + ex.Message, "Could not save the .cfg: " + ex.Message)); } } private void CheckCompatibilityOnce() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00d7: Unknown result type (might be due to invalid IL or missing references) if (!compatibilityChecked && GameApi.IsMainGameReady) { compatibilityChecked = true; ModLog.Info(Lang.T(string.Format("{0} {1} carregado. {2} = bot, {3} = configurações, {4} = painel.", "GK2 AutoKeeper", "0.3.28", Settings.ToggleBotKey.Value, Settings.OpenSettingsKey.Value, Settings.ToggleOverlayKey.Value), string.Format("{0} {1} loaded. {2} = bot, {3} = settings, {4} = status panel.", "GK2 AutoKeeper", "0.3.28", Settings.ToggleBotKey.Value, Settings.OpenSettingsKey.Value, Settings.ToggleOverlayKey.Value))); string gameVersion = GameApi.GetGameVersion(); if (gameVersion == null) { ModLog.Warn(Lang.T("Não consegui ler a versão do jogo (GameInfo). O mod pode estar desatualizado.", "Could not read the game version (GameInfo). The mod may be outdated.")); } else if (gameVersion != "1.007.1") { ModLog.Warn(Lang.T("Versão do jogo " + gameVersion + " difere da testada (1.007.1). Se algo falhar, desligue o bot (F8) e verifique atualizações do mod.", "Game version " + gameVersion + " differs from the tested one (1.007.1). If something fails, turn off the bot (F8) and check for mod updates.")); } else { ModLog.Info(Lang.T("Versão do jogo " + gameVersion + " — compatível (testada).", "Game version " + gameVersion + " — compatible (tested).")); } } } private void HandleHotkeys() { try { HandleHotkeysUnsafe(); } catch (Exception ex) { ModLog.WarnOnce("hotkeys", Lang.T("Hotkeys indisponíveis (" + ex.GetType().Name + ": " + ex.Message + ").", "Hotkeys unavailable (" + ex.GetType().Name + ": " + ex.Message + ").")); } } private void HandleHotkeysUnsafe() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (CapturingKey) { return; } KeyboardShortcut value = Settings.OpenSettingsKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { ToggleSettingsWindow(); } value = Settings.ToggleBotKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Bot.Toggle(); } value = Settings.ToggleOverlayKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Settings.ShowOverlay.Value = !Settings.ShowOverlay.Value; } value = Settings.DumpKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { string text = GameApi.WriteDiscoveryDump(); if (text != null) { ModLog.Detail(Lang.T("Dump de descoberta salvo em: " + text, "Discovery dump saved to: " + text)); ModLog.Info(Lang.T("Dump salvo: " + Path.GetFileName(text) + " (BepInEx/config/AutoKeeper/dumps)", "Dump saved: " + Path.GetFileName(text) + " (BepInEx/config/AutoKeeper/dumps)")); } } } } internal static class EnumerableExtensions { public static int CountSafe<T>(this IEnumerable<T> source) { if (source == null) { return 0; } int num = 0; foreach (T item in source) { _ = item; num++; } return num; } } } namespace AutoKeeper.UI { internal static class GameUiTheme { public static readonly Color PanelBackground = new Color(0.055f, 0.035f, 0.03f, 0.9f); public static readonly Color PanelInner = new Color(0.105f, 0.112f, 0.14f, 0.96f); public static readonly Color Border = new Color(0.42f, 0.29f, 0.19f, 1f); public static readonly Color Row = new Color(0.16f, 0.1f, 0.08f, 0.85f); public static readonly Color Button = new Color(0.28f, 0.12f, 0.07f, 1f); public static readonly Color ButtonHover = new Color(0.42f, 0.2f, 0.1f, 1f); public static readonly Color ButtonActive = new Color(0.55f, 0.36f, 0.12f, 1f); public static readonly Color Label = new Color(0.59f, 0.55f, 0.53f, 1f); public static readonly Color Value = new Color(1f, 0.74f, 0f, 1f); public static readonly Color Title = new Color(0.95f, 0.89f, 0.78f, 1f); public const string LabelHex = "#978C87"; public const string ValueHex = "#FFBD00"; public const string TitleHex = "#F2E3C7"; public const string GoodHex = "#A6D05A"; public const string BadHex = "#E07A5F"; public const string MutedHex = "#7D726D"; private static Font font; private static bool fontSearched; public static Font Font { get { if (!fontSearched) { fontSearched = true; font = FindGameFont(); } return font; } } public static void ResetFontCache() { if ((Object)(object)font == (Object)null) { fontSearched = false; } } private static Font FindGameFont() { try { TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); TMP_FontAsset val = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => (Object)(object)f != (Object)null && (Object)(object)f.sourceFontFile != (Object)null && ((Object)f).name.IndexOf("small_font", StringComparison.OrdinalIgnoreCase) >= 0 && ((Object)f).name.IndexOf("bold", StringComparison.OrdinalIgnoreCase) < 0)) ?? ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => (Object)(object)f != (Object)null && (Object)(object)f.sourceFontFile != (Object)null && ((Object)f).name.IndexOf("bold", StringComparison.OrdinalIgnoreCase) < 0)) ?? ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => (Object)(object)f != (Object)null && (Object)(object)f.sourceFontFile != (Object)null)); if ((Object)(object)val != (Object)null) { ModLog.Debug(Lang.T("Fonte do jogo para a UI do mod: " + ((Object)val).name + " (" + ((Object)val.sourceFontFile).name + ")", "Game font for the mod UI: " + ((Object)val).name + " (" + ((Object)val.sourceFontFile).name + ")")); return val.sourceFontFile; } } catch (Exception ex) { ModLog.Debug(Lang.T("Fonte do jogo indisponível: " + ex.Message, "Game font unavailable: " + ex.Message)); } return null; } public static Texture2D MakeTex(Color c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } public static void DrawFramedBox(Rect r, Texture2D fill, Texture2D border) { //IL_0000: 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) GUI.DrawTexture(r, (Texture)(object)border); GUI.DrawTexture(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + 2f, ((Rect)(ref r)).width - 4f, ((Rect)(ref r)).height - 4f), (Texture)(object)fill); } } internal sealed class NativeSettingsWindow : LazyWindow<LazyWidgetDataBase> { private static readonly FieldInfo SwitchAmountField = AccessTools.Field(typeof(UISwitchButton), "amountLabel"); private static readonly FieldInfo SwitchIncField = AccessTools.Field(typeof(UISwitchButton), "increaseButton"); private static readonly FieldInfo SwitchDecField = AccessTools.Field(typeof(UISwitchButton), "decreaseButton"); private static readonly FieldInfo SwitchHeaderField = AccessTools.Field(typeof(UISwitchButton), "headerLabel"); private static readonly FieldInfo SliderField = AccessTools.Field(typeof(UISlider), "slider"); private static readonly FieldInfo SliderIncField = AccessTools.Field(typeof(UISlider), "increaseButton"); private static readonly FieldInfo SliderDecField = AccessTools.Field(typeof(UISlider), "decreaseButton"); private static readonly FieldInfo SliderAmountField = AccessTools.Field(typeof(UISlider), "amountLabel"); private static KeyCode[] keyboardKeys; private Settings settings; private BotController bot; private Transform staging; private GameObject switchTemplate; private GameObject sliderTemplate; private GameObject buttonTemplate; private RectTransform content; private TextMeshProUGUI titleText; private TextMeshProUGUI hintText; private TextMeshProUGUI hintStyleSource; private bool hintMaterialRefreshLogged; private UIDialogWindowButton botButton; private readonly List<GameObject> built = new List<GameObject>(); private SettingTab tab = SettingTab.Bodies; private SettingInfo capturing; private int captureEndFrame = -1; private bool rebuildPending; private bool lastBotOn; private bool pt; public bool IsCapturingKey { get { if (capturing == null) { return Time.frameCount == captureEndFrame; } return true; } } internal static NativeSettingsWindow TryCreate(Settings settings, BotController bot, out string error) { //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_01e3: 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_01f8: Expected O, but got Unknown //IL_01f8: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown GameObject val = null; try { UIGameSettingsWindow window = LazyUI.GetWindow<UIGameSettingsWindow>(); if ((Object)(object)window == (Object)null) { error = Lang.T("janela de configurações do jogo indisponível", "game settings window unavailable"); return null; } Transform val2 = ((Component)window).transform.Find("GenericWIndowLayout"); object? obj = AccessTools.Field(typeof(UIGameSettingsWindow), "fullscreenButton")?.GetValue(window); UISwitchButton val3 = (UISwitchButton)((obj is UISwitchButton) ? obj : null); object? obj2 = AccessTools.Field(typeof(UIGameSettingsWindow), "masterVolumeSlider")?.GetValue(window); UISlider val4 = (UISlider)((obj2 is UISlider) ? obj2 : null); object? obj3 = AccessTools.Field(typeof(UIGameSettingsWindow), "lazyButton")?.GetValue(window); UIDialogWindowButton val5 = (UIDialogWindowButton)((obj3 is UIDialogWindowButton) ? obj3 : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null || (Object)(object)val5 == (Object)null || SwitchAmountField == null || SliderField == null || SliderAmountField == null) { error = Lang.T($"peças não encontradas (layout={(Object)(object)val2 != (Object)null}, switch={(Object)(object)val3 != (Object)null}, slider={(Object)(object)val4 != (Object)null}, button={(Object)(object)val5 != (Object)null})", $"parts not found (layout={(Object)(object)val2 != (Object)null}, switch={(Object)(object)val3 != (Object)null}, slider={(Object)(object)val4 != (Object)null}, button={(Object)(object)val5 != (Object)null})"); return null; } val = new GameObject("AutoKeeperSettingsWindow", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(FindUiRoot((Component)(object)window), false); CopyRect((RectTransform)((Component)window).transform, (RectTransform)val.transform); Canvas obj4 = val.AddComponent<Canvas>(); obj4.overrideSorting = true; obj4.sortingOrder = 460; val.AddComponent<GraphicRaycaster>(); GamepadNavigationController obj5 = val.AddComponent<GamepadNavigationController>(); obj5.navigationGroupSources = new List<NavigationGroupSource>(); obj5.useGridSkippedIfListEmpty = true; GameObject val6 = new GameObject("AK_Templates", new Type[1] { typeof(RectTransform) }); val6.transform.SetParent(val.transform, false); val6.SetActive(false); NativeSettingsWindow nativeSettingsWindow = val.AddComponent<NativeSettingsWindow>(); nativeSettingsWindow.settings = settings; nativeSettingsWindow.bot = bot; nativeSettingsWindow.staging = val6.transform; nativeSettingsWindow.switchTemplate = CloneInactive(((Component)val3).gameObject, nativeSettingsWindow.staging); nativeSettingsWindow.sliderTemplate = CloneInactive(((Component)val4).gameObject, nativeSettingsWindow.staging); nativeSettingsWindow.buttonTemplate = CloneInactive(((Component)val5).gameObject, nativeSettingsWindow.staging); nativeSettingsWindow.BuildChrome(((Component)val2).gameObject); ((LazyWidgetBase)nativeSettingsWindow).Init(); error = null; ModLog.Detail(Lang.T("Tela de configurações nativa criada (visual da janela de Configurações do jogo).", "Native settings window created (look of the game's Settings window).")); ModLog.Detail(Lang.T("UI nativa: ", "Native UI: ") + nativeSettingsWindow.Describe()); return nativeSettingsWindow; } catch (Exception ex) { error = ex.GetType().Name + ": " + ex.Message; if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } return null; } } private static Transform FindUiRoot(Component sourceWindow) { GUIElements instance = GUIElements.Instance; Component val = (Component)(((Object)(object)instance == (Object)null) ? null : /*isinst with value type is only supported in some contexts*/); if (!((Object)(object)val != (Object)null)) { return sourceWindow.transform.parent; } return val.transform; } private static GameObject CloneInactive(GameObject template, Transform inactiveParent) { GameObject val = Object.Instantiate<GameObject>(template, inactiveParent, false); ((Object)val).name = ((Object)template).name + "_AK"; LocalizedLabel[] componentsInChildren = val.GetComponentsInChildren<LocalizedLabel>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } return val; } private static void CopyRect(RectTransform from, RectTransform to) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) to.anchorMin = from.anchorMin; to.anchorMax = from.anchorMax; to.pivot = from.pivot; to.anchoredPosition = from.anchoredPosition; to.sizeDelta = from.sizeDelta; ((Transform)to).localScale = Vector3.one; } private void BuildChrome(GameObject srcLayout) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown GameObject val = CloneInactive(srcLayout, staging); Transform val2 = val.transform.Find("Content"); if ((Object)(object)val2 == (Object)null) { throw new InvalidOperationException(Lang.T("Content não encontrado na janela do jogo", "Content not found in the game's window")); } for (int num = val2.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val2.GetChild(num)).gameObject); } content = (RectTransform)val2; if ((Object)(object)((Component)content).GetComponent<LayoutGroup>() == (Object)null) { VerticalLayoutGroup obj = ((Component)content).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; } Transform val3 = val.transform.Find("Frame/HeaderGroup/Header"); titleText = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponent<TextMeshProUGUI>() : null); LazyButton[] componentsInChildren = val.GetComponentsInChildren<LazyButton>(true); foreach (LazyButton obj2 in componentsInChildren) { ((UnityEventBase)((Button)obj2).onClick).RemoveAllListeners(); ((UnityEvent)((Button)obj2).onClick).AddListener(new UnityAction(((LazyWindow<LazyWidgetDataBase>)this).Close)); } val.transform.SetParent(((Component)this).transform, false); } private string Describe() { //IL_00ae: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) LayoutGroup val = (((Object)(object)content != (Object)null) ? ((Component)content).GetComponent<LayoutGroup>() : null); string arg = string.Join(",", (from t in ((IEnumerable)((Component)this).transform).Cast<Transform>().SelectMany((Transform t) => ((IEnumerable)t).Cast<Transform>()) select ((Object)t).name).Take(12)); string[] obj = new string[12] { "content=", null, null, null, null, null, null, null, null, null, null, null }; object obj2; if (!((Object)(object)content != (Object)null)) { obj2 = "-"; } else { Rect rect = content.rect; Vector2 size = ((Rect)(ref rect)).size; obj2 = ((Vector2)(ref size)).ToString("0"); } obj[1] = (string)obj2; obj[2] = " layout="; obj[3] = (((Object)(object)val != (Object)null) ? ((object)val).GetType().Name : "-"); obj[4] = " switch="; obj[5] = Size(switchTemplate); obj[6] = " slider="; obj[7] = Size(sliderTemplate); obj[8] = " button="; obj[9] = Size(buttonTemplate); obj[10] = " "; obj[11] = string.Format("title={0} {1}=[{2}]", (Object)(object)titleText != (Object)null, Lang.T("partes", "parts"), arg); return string.Concat(obj); static string Size(GameObject g) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)g == (Object)null)) { Rect rect2 = ((RectTransform)g.transform).rect; Vector2 size2 = ((Rect)(ref rect2)).size; return ((Vector2)(ref size2)).ToString("0"); } return "-"; } } public override void Redraw() { ((LazyWidget<LazyWidgetDataBase>)(object)this).Redraw(); BuildContent(); } protected override void TestDraw() { } protected override bool OnPressedBack() { if (capturing != null) { capturing = null; captureEndFrame = Time.frameCount; rebuildPending = true; return true; } ((LazyWindow<LazyWidgetDataBase>)this).Close(); return true; } protected override void PrintTips() { if ((Object)(object)base.lazyButtonTips != (Object)null) { base.PrintTips(); } } public override void Close() { capturing = null; base.Close(); } protected override void Update() { base.Update(); HandleKeyCapture(); bool flag = bot.State != BotController.BotState.Off; if (flag != lastBotOn && (Object)(object)botButton != (Object)null) { lastBotOn = flag; DrawButton(botButton, BotButtonText(), bot.Toggle); } if (rebuildPending) { rebuildPending = false; BuildContent(); } SyncHintStyle(hintText); } private void BuildContent() { //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) pt = GameApi.IsGameLanguagePortuguese(); foreach (GameObject item in built) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)item); } } built.Clear(); if ((Object)(object)titleText != (Object)null) { ((TMP_Text)titleText).text = "GK2 AutoKeeper 0.3.28"; } SettingTab[] tabs = (SettingTab[])Enum.GetValues(typeof(SettingTab)); UISwitchButton val = AddSwitch("", tabs.Select(TabName).ToArray(), Array.IndexOf(tabs, tab), delegate(int i) { tab = tabs[i]; rebuildPending = true; }, T("Categoria: escolha o grupo de opções.", "Category: choose the group of options.")); hintStyleSource = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentsInChildren<TextMeshProUGUI>(true).FirstOrDefault() : null); AddDivider(); foreach (SettingInfo item2 in from x in settings.UiSettings where x.Tab == tab orderby x.Order select x) { AddSettingRow(item2); } hintText = AddHint(); AddDivider(); lastBotOn = bot.State != BotController.BotState.Off; botButton = AddButton(BotButtonText(), bot.Toggle, T("Liga ou desliga o bot agora (o mesmo que a tecla F8).", "Turns the bot on or off now (same as the F8 key).")); FixWidth(botButton, 308f); AddButtonRow((T("Restaurar padrões", "Reset defaults"), delegate { settings.ResetTab(tab); rebuildPending = true; }, T("Volta só as opções desta categoria ao valor original.", "Resets only this category's options to their original values.")), (T("Fechar", "Close"), (Action)((LazyWindow<LazyWidgetDataBase>)this).Close, T("Fecha a janela (Esc). As alterações já ficam salvas.", "Closes the window (Esc). Changes are already saved."))); LayoutRebuilder.ForceRebuildLayoutImmediate(content); CenterSwitch(val); if ((Object)(object)hintText != (Object)null) { TextMeshProUGUI val2 = switchTemplate.GetComponentsInChildren<TextMeshProUGUI>(true).FirstOrDefault(); string[] obj = new string[6] { "font=", Name((Object)(object)((TMP_Text)hintText).font), " material=", Name((Object)(object)((TMP_Text)hintText).fontSharedMaterial), " ", null }; string arg = Name((Object)(object)(((Object)(object)val2 != (Object)null) ? ((TMP_Text)val2).fontSharedMaterial : null)); Rect rect = ((TMP_Text)hintText).rectTransform.rect; obj[5] = $"template={arg} rect={((Rect)(ref rect)).size}"; string text = string.Concat(obj); ModLog.Debug(Lang.T("Caixa de descrição da F11: " + text, "F11 description box: " + text)); } static string Name(Object o) { if (!(o == (Object)null)) { return o.name; } return "-"; } } private static void CenterSwitch(UISwitchButton sw) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) try { object? obj = SwitchIncField?.GetValue(sw); object? obj2 = ((obj is Component) ? obj : null); Transform obj3 = ((obj2 != null) ? ((Component)obj2).transform : null); RectTransform val = (RectTransform)(object)((obj3 is RectTransform) ? obj3 : null); object? obj4 = SwitchDecField?.GetValue(sw); object? obj5 = ((obj4 is Component) ? obj4 : null); Transform obj6 = ((obj5 != null) ? ((Component)obj5).transform : null); RectTransform val2 = (RectTransform)(object)((obj6 is RectTransform) ? obj6 : null); object? obj7 = SwitchAmountField?.GetValue(sw); object? obj8 = ((obj7 is TextMeshProUGUI) ? obj7 : null); RectTransform val3 = ((obj8 != null) ? ((TMP_Text)obj8).rectTransform : null); object? obj9 = SwitchHeaderField?.GetValue(sw); TextMeshProUGUI val4 = (TextMeshProUGUI)((obj9 is TextMeshProUGUI) ? obj9 : null); Transform transform = ((Component)sw).transform; RectTransform val5 = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val5 == (Object)null) { return; } if ((Object)(object)val4 != (Object)null) { ((TMP_Text)val4).text = ""; } RectTransform obj10; if ((Object)(object)((Transform)val3).parent != (Object)null && (Object)(object)((Transform)val3).parent != (Object)(object)val5) { Transform parent = ((Transform)val3).parent; RectTransform val6 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val6 != null && (Object)(object)((Transform)val6).parent == (Object)(object)((Transform)val).parent) { obj10 = val6; goto IL_0120; } } obj10 = val3; goto IL_0120; IL_0120: RectTransform val7 = obj10; RectTransform[] array = (RectTransform[])(object)new RectTransform[3] { val, val2, val7 }; Vector3[] array2 = (Vector3[])(object)new Vector3[4]; bool flag = true; Bounds val8 = default(Bounds); RectTransform[] array3 = array; for (int i = 0; i < array3.Length; i++) { array3[i].GetWorldCorners(array2); Vector3[] array4 = array2; foreach (Vector3 val9 in array4) { Vector3 val10 = ((Transform)val5).InverseTransformPoint(val9); if (flag) { ((Bounds)(ref val8))..ctor(val10, Vector3.zero); flag = false; } else { ((Bounds)(ref val8)).Encapsulate(val10); } } } Rect rect = val5.rect; float num = ((Rect)(ref rect)).center.x - ((Bounds)(ref val8)).center.x; if (!(Mathf.Abs(num) < 0.5f)) { array3 = array; foreach (RectTransform obj11 in array3) { obj11.anchoredPosition += new Vector2(num, 0f); } } } catch (Exception ex) { ModLog.Debug(Lang.T("Não consegui centralizar a categoria: " + ex.Message, "Could not center the category: " + ex.Message)); } } private void AddSettingRow(SettingInfo s) { ConfigEntryBase entry = s.Entry; Type settingType = entry.SettingType; string label = s.Label(pt); string text = s.Help(pt); if (settingType == typeof(bool)) { ConfigEntry<bool> e = (ConfigEntry<bool>)(object)entry; AddSwitch(label, new string[2] { T("Não", "No"), T("Sim", "Yes") }, e.Value ? 1 : 0, delegate(int i) { e.Value = i == 1; }, text); } else if (settingType.IsEnum) { Array values = Settings.VisibleValues(settingType); string[] fields = values.Cast<object>().Select(EnumText).ToArray(); AddSwitch(label, fields, Array.IndexOf(values, entry.BoxedValue), delegate(int i) { entry.BoxedValue = values.GetValue(i); }, text); } else if (settingType == typeof(float)) { ConfigEntry<float> e2 = (ConfigEntry<float>)(object)entry; AddSlider(label, s, e2.Value, delegate(float v) { e2.Value = (float)Math.Round(v, 3); }, text); } else if (settingType == typeof(int)) { ConfigEntry<int> e3 = (ConfigEntry<int>)(object)entry; AddSlider(label, s, e3.Value, delegate(float v) { e3.Value = Mathf.RoundToInt(v); }, text); } else if (settingType == typeof(KeyboardShortcut)) { ConfigEntry<KeyboardShortcut> e4 = (ConfigEntry<KeyboardShortcut>)(object)entry; UIDialogWindowButton b = null; b = AddButton(KeyText(s, e4), delegate { capturing = s; DrawButton(b, label + ": " + T("aperte a nova tecla… (Esc cancela)", "press the new key… (Esc cancels)"), null); }, text + " " + T("Clique e aperte a nova tecla.", "Click, then press the new key.")); FixWidth(b, 270f); } else if (settingType == typeof(string)) { ConfigEntry<string> val = (ConfigEntry<string>)(object)entry; string text2 = (string.IsNullOrEmpty(val.Value) ? T("(automático)", "(automatic)") : val.Value); AddSwitch(label, new string[1] { text2 }, 0, null, text + " " + T("(editável no .cfg)", "(editable in the .cfg)")).IsInteractable = false; } } private UISwitchButton AddSwitch(string label, string[] fields, int index, Action<int> onChanged, string help) { GameObject val = Object.Instantiate<GameObject>(switchTemplate, staging, false); UISwitchButton component = val.GetComponent<UISwitchButton>(); component.Initialize((Action<int>)delegate(int i) { onChanged?.Invoke(i); }, fields, Mathf.Max(0, index), label, (GameKey[])null, (GameKey[])null, true); object header = (object)/*isinst with value type is only supported in some contexts*/; object? value = SwitchAmountField.GetValue(component); SetHeader(val, (TextMeshProUGUI)header, (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null), label); Place(val, help); return component; } private void AddSlider(string label, SettingInfo s, float current, Action<float> onChanged, string help) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(sliderTemplate, staging, false); UISlider component = val.GetComponent<UISlider>(); Slider slider = (Slider)SliderField.GetValue(component); object? obj = SliderIncField?.GetValue(component); Button val2 = (Button)((obj is Button) ? obj : null); object? obj2 = SliderDecField?.GetValue(component); object? obj3 = ((obj2 is Button) ? obj2 : null); TextMeshProUGUI amount = (TextMeshProUGUI)SliderAmountField.GetValue(component); Object.DestroyImmediate((Object)(object)component); float step = ((s.Step > 0f) ? s.Step : 1f); int num = Mathf.Max(1, Mathf.RoundToInt((s.Max - s.Min) / step)); ((UnityEventBase)slider.onValueChanged).RemoveAllListeners(); slider.minValue = 0f; slider.maxValue = num; slider.wholeNumbers = true; slider.SetValueWithoutNotify(Mathf.Clamp(Mathf.Round((current - s.Min) / step), 0f, (float)num)); ((TMP_Text)amount).text = FormatNumber(current, step); ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float x) { float num2 = Mathf.Clamp(s.Min + x * step, s.Min, s.Max); ((TMP_Text)amount).text = FormatNumber(num2, step); onChanged(num2); }); if (val2 != null) { ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { slider.value = Mathf.Min(slider.maxValue, slider.value + 1f); }); } if (obj3 != null) { ((UnityEvent)((Button)obj3).onClick).AddListener((UnityAction)delegate { slider.value = Mathf.Max(slider.minValue, slider.value - 1f); }); } SetHeader(val, null, amount, label); Place(val, help); } private void AddButtonRow(params (string text, Action onPressed, string help)[] items) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AK_ButtonRow", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)content, false); ((RectTransform)val.transform).sizeDelta = new Vector2(308f, 26f); LayoutElement obj = val.AddComponent<LayoutElement>(); obj.minHeight = 26f; obj.preferredHeight = 26f; built.Add(val); Vector2 val4 = default(Vector2); for (int i = 0; i < items.Length; i++) { (string text, Action onPressed, string help) tuple = items[i]; string item = tuple.text; Action item2 = tuple.onPressed; string item3 = tuple.help; GameObject val2 = Object.Instantiate<GameObject>(buttonTemplate, staging, false); UIDialogWindowButton component = val2.GetComponent<UIDialogWindowButton>(); Place(val2, item3, val.transform); ContentSizeFitter component2 = val2.GetComponent<ContentSizeFitter>(); if ((Object)(object)component2 != (Object)null) { component2.horizontalFit = (FitMode)0; component2.verticalFit = (FitMode)0; } RectTransform val3 = (RectTransform)val2.transform; ((Vector2)(ref val4))..ctor(0.5f, 0.5f); val3.pivot = val4; Vector2 anchorMin = (val3.anchorMax = val4); val3.anchorMin = anchorMin; val3.sizeDelta = new Vector2(150f, 26f); val3.anchoredPosition = new Vector2(((float)i - (float)(items.Length - 1) / 2f) * 158f, 0f); DrawButton(component, item, item2); } } private static void FixWidth(UIDialogWindowButton b, float width) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0030: 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) if (!((Object)(object)b == (Object)null)) { ContentSizeFitter component = ((Component)b).GetComponent<ContentSizeFitter>(); if ((Object)(object)component != (Object)null) { component.horizontalFit = (FitMode)0; } RectTransform val = (RectTransform)((Component)b).transform; val.sizeDelta = new Vector2(width, val.sizeDelta.y); LayoutElement obj = ((Component)b).GetComponent<LayoutElement>() ?? ((Component)b).gameObject.AddComponent<LayoutElement>(); obj.minWidth = width; obj.preferredWidth = width; } } private UIDialogWindowButton AddButton(string text, Action onPressed, string help) { GameObject val = Object.Instantiate<GameObject>(buttonTemplate, staging, false); UIDialogWindowButton component = val.GetComponent<UIDialogWindowButton>(); Place(val, help); DrawButton(component, text, onPressed); return component; } private static void DrawButton(UIDialogWindowButton b, string text, Action onPressed) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!((Object)(object)b == (Object)null)) { b.Draw(new ButtonData(onPressed, text, (Func<bool>)null, false, GameKey.None, text)); } } private void AddDivider() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0138: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AK_Divider", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)content, false); ((RectTransform)val.transform).sizeDelta = new Vector2(310f, 14f); LayoutElement obj = val.AddComponent<LayoutElement>(); obj.minHeight = 14f; obj.preferredHeight = 14f; obj.minWidth = 310f; obj.preferredWidth = 310f; GameObject val2 = new GameObject("Line", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(val.transform, false); Image obj2 = val2.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0.72f, 0.55f, 0.24f, 0.85f); ((Graphic)obj2).raycastTarget = false; RectTransform val3 = (RectTransform)val2.transform; val3.anchorMin = new Vector2(0f, 0.5f); val3.anchorMax = new Vector2(1f, 0.5f); val3.pivot = new Vector2(0.5f, 0.5f); val3.anchoredPosition = Vector2.zero; val3.sizeDelta = new Vector2(0f, 1.5f); built.Add(val); } private TextMeshProUGUI AddHint() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_013b: 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_009b: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = switchTemplate.GetComponentsInChildren<TextMeshProUGUI>(true).FirstOrDefault(); GameObject val2 = new GameObject("AK_Hint", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent((Transform)(object)content, false); TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>(); if ((Object)(object)val != (Object)null) { ((TMP_Text)val3).font = ((TMP_Text)val).font; ((TMP_Text)val3).fontSharedMaterial = ((TMP_Text)val).fontSharedMaterial; ((TMP_Text)val3).fontSize = Mathf.Max(12f, ((TMP_Text)val).fontSize * 0.8f); ((Graphic)val3).color = new Color(0.8f, 0.74f, 0.62f, 1f); } ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; ((TMP_Text)val3).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)val3).enableAutoSizing = true; ((TMP_Text)val3).fontSizeMax = ((TMP_Text)val3).fontSize; ((TMP_Text)val3).fontSizeMin = Mathf.Max(8f, ((TMP_Text)val3).fontSize * 0.65f); ((TMP_Text)val3).overflowMode = (TextOverflowModes)1; ((Graphic)val3).raycastTarget = false; ((TMP_Text)val3).text = T("Passe o mouse sobre uma opção para ver o que ela faz.", "Hover an option to see what it does."); LayoutElement val4 = val2.AddComponent<LayoutElement>(); val4.minHeight = ((TMP_Text)val3).fontSize * 4.4f; val4.preferredHeight = ((TMP_Text)val3).fontSize * 4.4f; ((RectTransform)val2.transform).sizeDelta = new Vector2(310f, val4.preferredHeight); SyncHintStyle(val3); built.Add(val2); return val3; } private void SyncHintStyle(TextMeshProUGUI hint) { if ((Object)(object)hint == (Object)null) { return; } TextMeshProUGUI val = hintStyleSource; if ((Object)(object)val != (Object)null) { if ((Object)(object)((TMP_Text)val).font != (Object)null && (Object)(object)((TMP_Text)hint).font != (Object)(object)((TMP_Text)val).font) { ((TMP_Text)hint).font = ((TMP_Text)val).font; } Material fontSharedMaterial = ((TMP_Text)val).fontSharedMaterial; if ((Object)(object)fontSharedMaterial != (Object)null && (Object)(object)((TMP_Text)hint).fontSharedMaterial != (Object)(object)fontSharedMaterial) { if ((Object)(object)((TMP_Text)hint).fontSharedMaterial == (Object)null && !hintMaterialRefreshLogged) { hintMaterialRefreshLogged = true; ModLog.Detail(Lang.T("Caixa de descrição da F11: o material do texto foi liberado pelo jogo; usando o atual.", "F11 description box: the text material was released by the game; using the current one.")); } ((TMP_Text)hint).fontSharedMaterial = fontSharedMaterial; } } if ((Object)(object)((TMP_Text)hint).fontSharedMaterial == (Object)null && (Object)(object)((TMP_Text)hint).font != (Object)null) { ((TMP_Text)hint).fontSharedMaterial = ((TMP_Asset)((TMP_Text)hint).font).material; } } private void Place(GameObject go, string help, Transform parent = null) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005c: Expected O, but got Unknown go.transform.SetParent((Transform)(((Object)(object)parent != (Object)null) ? ((object)parent) : ((object)content)), false); if (!string.IsNullOrEmpty(help)) { EventTrigger obj = go.GetComponent<EventTrigger>() ?? go.AddComponent<EventTrigger>(); Entry val = new Entry { eventID = (EventTriggerType)0 }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate { if ((Object)(object)hintText != (Object)null) { ((TMP_Text)hintText).text = help; } }); obj.triggers.Add(val); } built.Add(go); } private static void SetHeader(GameObject row, TextMeshProUGUI header, TextMeshProUGUI amount, string label) { if ((Object)(object)header == (Object)null) { header = ((IEnumerable<TextMeshProUGUI>)row.GetComponentsInChildren<TextMeshProUGUI>(true)).FirstOrDefault((Func<TextMeshProUGUI, bool>)((TextMeshProUGUI t) => (Object)(object)t != (Object)(object)amount)); } if ((Object)(object)header != (Object)null) { ((TMP_Text)header).text = label; } } private void HandleKeyCapture() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0101: 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) if (capturing == null || !Input.anyKeyDown) { return; } if (keyboardKeys == null) { keyboardKeys = ((KeyCode[])Enum.GetValues(typeof(KeyCode))).Where((KeyCode k) => (int)k != 0 && (int)k < 323 && !IsModifier(k)).Distinct().ToArray(); } KeyCode[] array = keyboardKeys; foreach (KeyCode val in array) { if (!Input.GetKeyDown(val)) { continue; } if ((int)val != 27) { List<KeyCode> list = new List<KeyCode>(); if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) { list.Add((KeyCode)306); } if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) { list.Add((KeyCode)304); } if (Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307)) { list.Add((KeyCode)308); } ((ConfigEntry<KeyboardShortcut>)(object)capturing.Entry).Value = new KeyboardShortcut(val, list.ToArray()); } capturing = null; captureEndFrame = Time.frameCount; rebuildPending = true; break; } } private static bool IsModifier(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 if ((int)k != 306 && (int)k != 305 && (int)k != 304 && (int)k != 303 && (int)k != 308 && (int)k != 307 && (int)k != 310 && (int)k != 309) { return (int)k == 313; } return true; } private string T(string ptText, string enText) { if (!pt) { return enText; } return ptText; } private string BotButtonText() { if (bot.State != BotController.BotState.Off) { return T("Desligar bot", "Stop bot"); } return T("Ligar bot", "Start bot"); } private unsafe string KeyText(SettingInfo s, ConfigEntry<KeyboardShortcut> e) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) string text = s.Label(pt); KeyboardShortcut value = e.Value; string text2; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { value = e.Value; text2 = ((object)(*(KeyboardShortcut*)(&value))/*cast due to .constrained prefix*/).ToString(); } else { text2 = T("nenhuma", "none"); } return text + ": " + text2; } private string TabName(SettingTab t) { return t switch { SettingTab.Bot => T("Geral", "General"), SettingTab.Bodies => T("Corpos", "Bodies"), SettingTab.Autopsy => T("Extração", "Extraction"), SettingTab.Hotkeys => T("Teclas", "Hotkeys"), SettingTab.Overlay => T("Painel", "Panel"), _ => T("Avançado", "Advanced"), }; } private string EnumText(object v) { if (v is BodyDestination) { switch ((BodyDestination)v) { case BodyDestination.Crematorium: return T("Crematório", "Crematorium"); case BodyDestination.LeaveOnTable: return T("Deixar na mesa", "Leave on table"); case BodyDestination.Grave: return T("Túmulo (experimental)", "Grave (experimental)"); } } if (v is LackOfSleepAction) { switch ((LackOfSleepAction)v) { case LackOfSleepAction.Stop: return T("Desligar o bot", "Turn off the bot"); case LackOfSleepAction.Sleep: return T("Dormir e continuar", "Sleep, then resume"); case LackOfSleepAction.KeepWorking: return T("Continuar trabalhando", "Keep working"); } } if (v is OverlayCorner) { switch ((OverlayCorner)v) { case OverlayCorner.TopLeft: return T("Superior esquerdo", "Top left"); case OverlayCorner.TopRight: return T("Superior direito", "Top right"); case OverlayCorner.BottomLeft: return T("Inferior esquerdo", "Bottom left"); case OverlayCorner.BottomRight: return T("Inferior direito", "Bottom right"); } } return v.ToString(); } private static string FormatNumber(float v, float step) { if (!(step >= 1f)) { return v.ToString("0.00"); } return v.ToString("0"); } } internal sealed class Overlay { private enum RowKind { Title, Pair, Event, Note, Separator } private struct Row { public RowKind Kind; public string A; public string B; public bool Muted; } private const float RefreshSeconds = 0.2f; private const float Margin = 12f; private const float PadX = 12f; private const float PadY = 8f; private const float RowGap = 2f; private const float SectionGap = 5f; private readonly Settings settings; private readonly BotController bot; private readonly List<Row> rows = new List<Row>(); private GUIStyle titleStyle; private GUIStyle stateStyle; private GUIStyle labelStyle; private GUIStyle valueStyle; private GUIStyle mutedValueStyle; private GUIStyle timeStyle; private GUIStyle eventStyle; private GUIStyle noteStyle; private GUIStyle footerStyle; private GUIStyle buttonStyle; private Texture2D fillTex; private Texture2D borderTex; private Texture2D lineTex; private Texture2D buttonTex; private Texture2D buttonHoverTex; private int styleFontSize = -1; private Font styleFont; private float nextRefresh; private float labelWidth; private float timeWidth; public Action OnSettingsClicked; public Rect Rect { get; private set; } public Overlay(Settings settings, BotController bot) { this.settings = settings; this.bot = bot; } public void Draw() { //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_0036: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Invalid comparison between Unknown and I4 //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Invalid comparison between Unknown and I4 //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) if (!settings.ShowOverlay.Value || Event.current == null) { Rect = Rect.zero; return; } EnsureStyle(); if (((int)Event.current.type == 7 && Time.unscaledTime >= nextRefresh) || rows.Count == 0) { nextRefresh = Time.unscaledTime + 0.2f; BuildRows(); } bool flag = GameApi.IsGameLanguagePortuguese(); float num = Mathf.Min((float)Screen.width * 0.4f, (float)styleFontSize * 30f); float num2 = num - 24f; float num3 = (float)styleFontSize * 1.8f; float num4 = 0f; float[] array = new float[rows.Count]; for (int i = 0; i < rows.Count; i++) { array[i] = RowHeight(rows[i], num2); num4 += array[i] + 2f; } float h = 8f + num4 + 5f + num3 + 8f; Rect = PlaceInCorner(num, h); Rect rect = Rect; float num5 = ((Rect)(ref rect)).x + 12f; rect = Rect; float num6 = ((Rect)(ref rect)).y + 8f; if ((int)Event.current.type == 7) { GameUiTheme.DrawFramedBox(Rect, fillTex, borderTex); for (int j = 0; j < rows.Count; j++) { DrawRow(rows[j], new Rect(num5, num6, num2, array[j])); num6 += array[j] + 2f; } } else { num6 += num4; } num6 += 5f; string text = (flag ? "Configurações (" : "Settings (") + ((object)settings.OpenSettingsKey.Value/*cast due to .constrained prefix*/).ToString() + ")"; float num7 = Mathf.Min(num2 * 0.55f, (float)styleFontSize * 15f); Rect val = default(Rect); ((Rect)(ref val))..ctor(num5, num6, num7, num3); if ((int)Event.current.type == 7) { string text2 = string.Format("{0} {1} · {2} {3}", settings.ToggleBotKey.Value, flag ? "liga/desliga" : "on/off", settings.ToggleOverlayKey.Value, flag ? "esconde" : "hides"); GUI.Label(new Rect(num5 + num7 + 8f, num6, num2 - num7 - 8f, num3), text2, footerStyle); } if (GUI.Button(val, text, buttonStyle)) { OnSettingsClicked?.Invoke(); } } private void BuildRows() { //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Expected O, but got Unknown //IL_06da: Unknown result type (might be due to invalid IL or missing references) bool pt = GameApi.IsGameLanguagePortuguese(); GameSnapshot gameSnapshot = bot.LastSnapshot ?? new GameSnapshot(); rows.Clear(); rows.Add(new Row { Kind = RowKind.Title, A = "GK2 AutoKeeper 0.3.28", B = StateColored(bot.State, pt) }); string text = StateReason(pt); if (text != null) { rows.Add(Pair(pt ? "Motivo:" : "Reason:", text)); } rows.Add(new Row { Kind = RowKind.Separator }); string currentStepText = bot.CurrentStepText; rows.Add(Pair(pt ? "Tarefa:" : "Task:", string.IsNullOrEmpty(currentStepText) ? "—" : currentStepText)); if (!gameSnapshot.InGame) { rows.Add(Pair(pt ? "Local:" : "Place:", pt ? "menu / carregando" : "menu / loading")); } else { string text2 = (string.IsNullOrEmpty(gameSnapshot.ZoneName) ? "?" : gameSnapshot.ZoneName); rows.Add(Pair(pt ? "Local:" : "Place:", string.Format("{0} · {1} {2}, {3}", text2, pt ? "dia" : "day", gameSnapshot.Day, gameSnapshot.ClockText))); bool warn = gameSnapshot.EnergyMax > 0f && gameSnapshot.Energy < settings.EatBelowEnergy.Value; bool warn2 = gameSnapshot.Insanity >= settings.MaxInsanity.Value * 0.8f; rows.Add(Pair(pt ? "Energia:" : "Energy:", Warn($"{gameSnapshot.Energy:0}/{gameSnapshot.EnergyMax:0}", warn) + Muted(" · ") + Warn(string.Format("{0} {1:0}", pt ? "insanidade" : "insanity", gameSnapshot.Insanity), warn2))); if (gameSnapshot.DaysWithoutSleep >= 0f) { string text3 = gameSnapshot.DaysWithoutSleep.ToString("0.0"); string text4 = (pt ? (text3 + " dia(s) sem dormir") : (text3 + " day(s) without sleep")); text4 = ((!gameSnapshot.LackOfSleep) ? Warn(text4, gameSnapshot.DaysWithoutSleep >= 1.75f) : Bad(text4 + (pt ? " — Privação de Sono" : " — Lack of sleep"))); rows.Add(Pair(pt ? "Sono:" : "Sleep:", text4)); } if (gameSnapshot.Overhead.Count > 0) { rows.Add(Pair(pt ? "Carregando:" : "Carrying:", string.Join(", ", gameSnapshot.Overhead.Select((string id) => ItemName(id, pt))))); } if (settings.OverlayDetailed.Value) { rows.Add(MutedPair(pt ? "Posição:" : "Position:", $"{gameSnapshot.Position.x:0.0}, {gameSnapshot.Position.y:0.0}, {gameSnapshot.Position.z:0.0}")); rows.Add(MutedPair(pt ? "Zona:" : "Zone:", (gameSnapshot.ZoneId ?? "-") + " · " + (pt ? "cena" : "scene") + " " + gameSnapshot.SceneId)); rows.Add(MutedPair(pt ? "Dinheiro:" : "Money:", $"{gameSnapshot.Money:0}")); } } if (gameSnapshot.GameVersion != null && gameSnapshot.GameVersion != "1.007.1") { rows.Add(new Row { Kind = RowKind.Note, B = Warn(pt ? ("Jogo " + gameSnapshot.GameVersion + " não testado (testado: 1.007.1)") : ("Game " + gameSnapshot.GameVersion + " untested (tested: 1.007.1)"), warn: true) }); } int value = settings.OverlayLogLines.Value; List<LogEntry> list = ((value > 0) ? ModLog.Recent.Reverse().Take(value).ToList() : new List<LogEntry>()); if (list.Count > 0) { rows.Add(new Row { Kind = RowKind.Separator }); foreach (LogEntry item in list) { rows.Add(new Row { Kind = RowKind.Event, A = Ago(Time.unscaledTime - item.At, pt), B = EventText(item) }); } } rows.Add(new Row { Kind = RowKind.Separator }); labelWidth = 0f; foreach (Row row in rows) { if (row.Kind == RowKind.Pair) { labelWidth = Mathf.Max(labelWidth, labelStyle.CalcSize(new GUIContent(row.A)).x); } } labelWidth += 6f; timeWidth = timeStyle.CalcSize(new GUIContent(pt ? "59 min" : "59 min")).x + 6f; } private string StateReason(bool pt) { string stateDetail = bot.StateDetail; switch (bot.State) { case BotController.BotState.Running: return null; case BotController.BotState.Off: if (!string.IsNullOrEmpty(stateDetail)) { return stateDetail; } return null; default: if (!string.IsNullOrEmpty(stateDetail)) { return stateDetail; } return null; } } private static string EventText(LogEntry e) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 string text = Escape(e.Text); LogLevel level = e.Level; if ((int)level != 2) { if ((int)level == 4) { return Warn(text, warn: true); } return text; } return Bad(text); } private static string Ago(float seconds, bool pt) { if (seconds < 5f) { if (!pt) { return "now"; } return "agora"; } if (seconds < 60f) { return $"{seconds:0} s"; } if (seconds < 3600f) { return $"{seconds / 60f:0} min"; } return $"{seconds / 3600f:0} h"; } private static string ItemName(string id, bool pt) { if (id != null && id.StartsWith("body")) { if (!pt) { return "body"; } return "corpo"; } return id; } private static Row Pair(string label, string value) { return new Row { Kind = RowKind.Pair, A = label, B = value }; } private static Row MutedPair(string label, string value) { return new Row { Kind = RowKind.Pair, A = label, B = value, Muted = true }; } private static string Muted(string t) { return "<color=#7D726D>" + t + "</color>"; } private static string Bad(string t) { return "<color=#E07A5F>" + t + "</color>"; } private static string Warn(string t, bool warn) { if (!warn) { return t; } return "<color=#E07A5F>" + t + "</color>"; } private static string StateColored(BotController.BotState state, bool pt) { return state switch { BotController.BotState.Running => "<color=#A6D05A><b>" + (pt ? "TRABALHANDO" : "WORKING") + "</b></color>", BotController.BotState.Idle => "<color=#A6D05A>" + (pt ? "AGUARDANDO" : "WAITING") + "</color>", BotController.BotState.Paused => "<color=#FFBD00>" + (pt ? "PAUSADO" : "PAUSED") + "</color>", _ => "<color=#E07A5F>" + (pt ? "DESLIGADO" : "OFF") + "</color>", }; } private static string Escape(string s) { return s.Replace("<", "‹").Replace(">", "›"); } private float RowHeight(Row r, float inner) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown return r.Kind switch { RowKind.Title => titleStyle.CalcHeight(new GUIContent(r.A), inner), RowKind.Pair => Mathf.Max(labelStyle.CalcHeight(new GUIContent(r.A), labelWidth), (r.Muted ? mutedValueStyle : valueStyle).CalcHeight(new GUIContent(r.B), inner - labelWidth)), RowKind.Event => eventStyle.CalcHeight(new GUIContent(r.B), inner - timeWidth), RowKind.Note => noteStyle.CalcHeight(new GUIContent(r.B), inner), _ => 11f, }; } private void DrawRow(Row r, Rect rect) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) switch (r.Kind) { case RowKind.Title: GUI.Label(rect, r.A, titleStyle); GUI.Label(rect, r.B, stateStyle); break; case RowKind.Pair: GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, labelWidth, ((Rect)(ref rect)).height), r.A, labelStyle); GUI.Label(new Rect(((Rect)(ref rect)).x + labelWidth, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - labelWidth, ((Rect)(ref rect)).height), r.B, r.Muted ? mutedValueStyle : valueStyle); break; case RowKind.Event: GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, timeWidth, ((Rect)(ref rect)).height), r.A, timeStyle); GUI.Label(new Rect(((Rect)(ref rect)).x + timeWidth, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - timeWidth, ((Rect)(ref rect)).height), r.B, eventStyle); break; case RowKind.Note: GUI.Label(rect, r.B, noteStyle); break; default: GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 5f, ((Rect)(ref rect)).width, 1f), (Texture)(object)lineTex); break; } } private Rect PlaceInCorner(float w, float h) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) return (Rect)(settings.OverlayPosition.Value switch { OverlayCorner.TopRight => new Rect((float)Screen.width - w - 12f, 12f, w, h), OverlayCorner.BottomLeft => new Rect(12f, (float)Screen.height - h - 12f, w, h), OverlayCorner.BottomRight => new Rect((float)Screen.width - w - 12f, (float)Screen.height - h - 12f, w, h), _ => new Rect(12f, 12f, w, h), }); } private void EnsureStyle() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Expected O, but got Unknown //IL_0216: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(Mathf.RoundToInt((float)Screen.height / 62f), 12, 22); Font font = GameUiTheme.Font; if (titleStyle == null || styleFontSize != num || !((Object)(object)styleFont == (Object)(object)font)) { styleFontSize = num; styleFont = font; rows.Clear(); fillTex = fillTex ?? GameUiTheme.MakeTex(GameUiTheme.PanelBackground); borderTex = borderTex ?? GameUiTheme.MakeTex(GameUiTheme.Border); lineTex = lineTex ?? GameUiTheme.MakeTex(new Color(GameUiTheme.Border.r, GameUiTheme.Border.g, GameUiTheme.Border.b, 0.8f)); buttonTex = buttonTex ?? GameUiTheme.MakeTex(GameUiTheme.Button); buttonHoverTex = buttonHoverTex ?? GameUiTheme.MakeTex(GameUiTheme.ButtonHover); int size = Mathf.Max(10, num - 3); titleStyle = Make(num + 1, GameUiTheme.Title, wrap: false); titleStyle.fontStyle = (FontStyle)1; stateStyle = Make(num, GameUiTheme.Value, wrap: false); stateStyle.alignment = (TextAnchor)2; labelStyle = Make(num, GameUiTheme.Label, wrap: false); valueStyle = Make(num, GameUiTheme.Value, wrap: true); mutedValueStyle = Make(size, GameUiTheme.Label, wrap: true); timeStyle = Make(size, GameUiTheme.Label, wrap: false); eventStyle = Make(size, GameUiTheme.Title, wrap: true); noteStyle = Make(size, GameUiTheme.Value, wrap: true); footerStyle = Make(size, GameUiTheme.Label, wrap: true); footerStyle.alignment = (TextAnchor)5; buttonStyle = new GUIStyle(GUI.skin.button) { fontSize = Mathf.Max(11, num - 1), alignment = (TextAnchor)4, border = new RectOffset(0, 0, 0, 0) }; buttonStyle.normal.background = buttonTex; buttonStyle.hover.background = buttonHoverTex; buttonStyle.active.background = buttonHoverTex; buttonStyle.normal.textColor = GameUiTheme.Value; buttonStyle.hover.textColor = GameUiTheme.Title; buttonStyle.active.textColor = GameUiTheme.Title; if ((Object)(object)font != (Object)null) { buttonStyle.font = font; } } } private GUIStyle Make(int size, Color color, bool wrap) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0033: 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_0042: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { richText = true, wordWrap = wrap, fontSize = size, padding = new RectOffset(0, 0, 0, 0), margin = new RectOffset(0, 0, 0, 0), alignment = (TextAnchor)0 }; val.normal.textColor = color; if ((Object)(object)styleFont != (Object)null) { val.font = styleFont; } return val; } } internal sealed class SettingsWindow { private const int WindowId = 19265; private readonly Settings settings; private readonly BotController bot; private Rect rect; private bool rectInitialized; private Vector2 scroll; private SettingTab tab = SettingTab.Bodies; private SettingInfo capturing; private float scale = 1f; private readonly Dictionary<SettingInfo, string> textBuffers = new Dictionary<SettingInfo, string>(); private GUIStyle windowStyle; private GUIStyle titleStyle; private GUIStyle labelStyle; private GUIStyle helpStyle; private GUIStyle valueStyle; private GUIStyle buttonStyle; private GUIStyle tabStyle; private GUIStyle tabActiveStyle; private GUIStyle toggleStyle; private GUIStyle boxStyle; private Texture2D bgTex; private Texture2D rowTex; private Texture2D accentTex; private Texture2D tabTex; private Texture2D buttonTex; private int stylesFor = -1; public bool IsOpen { get; private set; } public bool IsCapturingKey => capturing != null; public Rect Rect => rect; public SettingsWindow(Settings settings, BotController bot) { this.settings = settings; this.bot = bot; } public void Toggle() { if (IsOpen) { Close(); return; } IsOpen = true; capturing = null; textBuffers.Clear(); } public void Close() { IsOpen = false; capturing = null; FlushTextBuffers(); } public void Draw() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Invalid comparison between Unknown and I4 //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 if (IsOpen) { EnsureStyles(); if (!rectInitialized) { float num = Mathf.Min((float)Screen.width - 40f, 760f * scale); float num2 = Mathf.Min((float)Screen.height - 40f, 620f * scale); rect = new Rect(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2); rectInitialized = true; } Event current = Event.current; if (current != null && (int)current.type == 4 && (int)current.keyCode == 27 && capturing == null) { Close(); current.Use(); } else { rect = GUI.Window(19265, rect, new WindowFunction(DrawWindow), GUIContent.none, windowStyle); ((Rect)(ref rect)).x = Mathf.Clamp(((Rect)(ref rect)).x, 0f, (float)Screen.width - ((Rect)(ref rect)).width); ((Rect)(ref rect)).y = Mathf.Clamp(((Rect)(ref rect)).y, 0f, (float)Screen.height - ((Rect)(ref rect)).height); } } } private void DrawWindow(int id) { //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_0360: Unknown result type (might be due to invalid IL or missing references) bool pt = GameApi.IsGameLanguagePortuguese(); HandleKeyCapture(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("GK2 AutoKeeper 0.3.28 — " + T(pt, "Configurações", "Settings"), titleStyle, Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f * scale) })) { Close(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(boxStyle, Array.Empty<GUILayoutOption>()); string text = ((bot.State == BotController.BotState.Off) ? T(pt, "<color=#E07A5F>DESLIGADO</color>", "<color=#E07A5F>OFF</color>") : T(pt, "<color=#A6D05A>LIGADO</color>", "<color=#A6D05A>ON</color>")); GUILayout.Label(T(pt, "Bot", "Bot") + ": " + text + " <i>" + bot.StateDetail + "</i>", labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button((bot.State == BotController.BotState.Off) ? T(pt, "Ligar bot", "Start bot") : T(pt, "Desligar bot", "Stop bot"), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f * scale) })) { bot.Toggle(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); SettingTab[] array = (SettingTab[])Enum.GetValues(typeof(SettingTab)); foreach (SettingTab settingTab in array) { if (GUILayout.Button(TabName(settingTab, pt), (settingTab == tab) ? tabActiveStyle : tabStyle, Array.Empty<GUILayoutOption>())) { FlushTextBuffers(); tab = settingTab; capturing = null; scroll = Vector2.zero; } } GUILayout.EndHorizontal(); scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>()); foreach (SettingInfo item in from x in settings.UiSettings where x.Tab == tab orderby x.Order select x) { DrawRow(item, pt); } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(T(pt, "Restaurar padrões", "Reset defaults"), buttonStyle, Array.Empty<GUILayoutOption>())) { settings.ResetTab(tab); textBuffers.Clear(); capturing = null; } GUILayout.FlexibleSpace(); GUILayout.Label(T(pt, "Salvo automaticamente · Esc fecha", "Saved automatically · Esc closes"), helpStyle, Array.Empty<GUILayoutOption>()); if (GUILayout.Button(T(pt, "Fechar", "Close"), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f * scale) })) { Close(); } GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 40f * scale)); } private void DrawRow(SettingInfo s, bool pt) { //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(boxStyle, Array.Empty<GUILayoutOption>()); ConfigEntryBase entry = s.Entry; Type settingType = entry.SettingType; if (settingType == typeof(bool)) { ConfigEntry<bool> val = (ConfigEntry<bool>)(object)entry; bool flag = GUILayout.Toggle(val.Value, " " + s.Label(pt), toggleStyle, Array.Empty<GUILayoutOption>()); if (flag != val.Value) { val.Value = flag; } } else if (settingType == typeof(float) || settingType == typeof(int)) { float num = ((settingType == typeof(float)) ? ((ConfigEntry<float>)(object)entry).Value : ((float)((ConfigEntry<int>)(object)entry).Value)); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(s.Label(pt), labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f * scale) }); float num2 = GUILayout.HorizontalSlider(num, s.Min, s.Max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.Label(FormatNumber(num, s.Step), valueStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f * scale) }); GUILayout.EndHorizontal(); float num3 = Mathf.Clamp(Mathf.Round(num2 / s.Step) * s.Step, s.Min, s.Max); if (Mathf.Abs(num3 - num) > s.Step * 0.25f) { if (settingType == typeof(float)) { ((ConfigEntry<float>)(object)entry).Value = (float)Math.Round(num3, 3); } else { ((ConfigEntry<int>)(object)entry).Value = Mathf.RoundToInt(num3); } } } else if (settingType.IsEnum) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(s.Label(pt), labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f * scale) }); Array array = Settings.VisibleValues(settingType); string[] array2 = (from object v in array select EnumText(v, pt)).ToArray(); int num4 = Array.IndexOf(array, entry.BoxedValue); int num5 = GUILayout.SelectionGrid(num4, array2, array2.Length, tabStyle, Array.Empty<GUILayoutOption>()); if (num5 != num4 && num5 >= 0) { entry.BoxedValue = array.GetValue(num5); } GUILayout.EndHorizontal(); } else if (settingType == typeof(KeyboardShortcut)) { ConfigEntry<KeyboardShortcut> val2 = (ConfigEntry<KeyboardShortcut>)(object)entry; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(s.Label(pt), labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f * scale) }); if (GUILayout.Button((capturing == s) ? T(pt, "Aperte a nova tecla… (Esc cancela)", "Press the new key… (Esc cancels)") : ((object)val2.Value/*cast due to .constrained prefix*/).ToString(), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { capturing = ((capturing == s) ? null : s); } if (GUILayout.Button(T(pt, "Nenhuma", "None"), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f * scale) })) { val2.Value = KeyboardShortcut.Empty; capturing = null; } GUILayout.EndHorizontal(); } else if (settingType == typeof(string)) { ConfigEntry<string> val3 = (ConfigEntry<string>)(object)entry; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(s.Label(pt), labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f * scale) }); if (!textBuffers.TryGetValue(s, out var value)) { value = val3.Value ?? string.Empty; } textBuffers[s] = GUILayout.TextField(value, 200, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button(T(pt, "Aplicar", "Apply"), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f * scale) })) { val3.Value = textBuffers[s].Trim(); textBuffers.Remove(s); } GUILayout.EndHorizontal(); } GUILayout.Label(s.Help(pt), helpStyle, Array.Empty<GUILayoutOption>()); GUILayout.EndVertical(); } private void HandleKeyCapture() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001b: 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_002b: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (capturing == null || current == null || (int)current.type != 4 || (int)current.keyCode == 0) { return; } if ((int)current.keyCode == 27) { capturing = null; current.Use(); } else if (!IsModifier(current.keyCode)) { List<KeyCode> list = new List<KeyCode>(); if (current.control) { list.Add((KeyCode)306); } if (current.shift) { list.Add((KeyCode)304); } if (current.alt) { list.Add((KeyCode)308); } ((ConfigEntry<KeyboardShortcut>)(object)capturing.Entry).Value = new KeyboardShortcut(current.keyCode, list.ToArray()); capturing = null; current.Use(); } } private void FlushTextBuffers() { textBuffers.Clear(); } private static string T(bool pt, string ptText, string enText) { if (!pt) { return enText; } return ptText; } private static string TabName(SettingTab t, bool pt) { return t switch { SettingTab.Bot => T(pt, "Geral", "General"), SettingTab.Bodies => T(pt, "Corpos", "Bodies"), SettingTab.Autopsy => T(pt, "Extração", "Extraction"), SettingTab.Hotkeys => T(pt, "Teclas", "Hotkeys"), SettingTab.Overlay => T(pt, "Painel", "Panel"), _ => T(pt, "Avançado", "Advanced"), }; } private static string EnumText(object v, bool pt) { if (v is BodyDestination) { switch ((BodyDestination)v) { case BodyDestination.Crematorium: return T(pt, "Crematório", "Crematorium"); case BodyDestination.LeaveOnTable: return T(pt, "Deixar na mesa", "Leave on table"); case BodyDestination.Grave: return T(pt, "Túmulo (exp.)", "Grave (exp.)"); } } if (v is LackOfSleepAction) { switch ((LackOfSleepAction)v) { case LackOfSleepAction.Stop: return T(pt, "Desligar o bot", "Turn off the bot"); case LackOfSleepAction.Sleep: return T(pt, "Dormir e continuar", "Sleep, then resume"); case LackOfSleepAction.KeepWorking: return T(pt, "Continuar trabalhando", "Keep working"); } } if (v is OverlayCorner) { switch ((OverlayCorner)v) { case OverlayCorner.TopLeft: return T(pt, "Superior esquerdo", "Top left"); case OverlayCorner.TopRight: return T(pt, "Superior direito", "Top right"); case OverlayCorner.BottomLeft: return T(pt, "Inferior esquerdo", "Bottom left"); case OverlayCorner.BottomRight: return T(pt, "Inferior direito", "Bottom right"); } } return v.ToString(); } private static string FormatNumber(float v, float step) { if (!(step >= 1f)) { return v.ToString("0.00"); } return v.ToString("0"); } private static bool IsModifier(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 if ((int)k != 306 && (int)k != 305 && (int)k != 304 && (int)k != 303 && (int)k != 308 && (int)k != 307 && (int)k != 310) { return (int)k == 309; } return true; } private void EnsureStyles() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0106: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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) //IL_0227: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_0287: Expected O, but got Unknown //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Expected O, but got Unknown //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown //IL_0461: Expected O, but got Unknown int height = Screen.height; Font font = GameUiTheme.Font; if (stylesFor == height && windowStyle != null && ((Object)(object)font == (Object)null || (Object)(object)titleStyle.font == (Object)(object)font)) { return; } stylesFor = height; scale = Mathf.Clamp((float)Screen.height / 1080f, 0.8f, 2f); int fontSize = Mathf.RoundToInt(16f * scale); bgTex = MakeTex(GameUiTheme.PanelInner); rowTex = MakeTex(GameUiTheme.Row); accentTex = MakeTex(GameUiTheme.ButtonActive); tabTex = MakeTex(GameUiTheme.Button); buttonTex = MakeTex(GameUiTheme
plugins/AutoKeeper/AutoKeeper.FrameworkBridge.dll
Decompiled 5 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AutoKeeper.Config; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GK2.Framework; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("focabr")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.28.0")] [assembly: AssemblyInformationalVersion("0.3.28+e7f8ad56032b61c02d1ba5f572fd3bd3c16f9430")] [assembly: AssemblyProduct("GK2 AutoKeeper")] [assembly: AssemblyTitle("AutoKeeper.FrameworkBridge")] [assembly: AssemblyVersion("0.3.28.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 AutoKeeper.FrameworkBridge { [BepInPlugin("com.focabr.gk2.autokeeper.framework", "GK2 AutoKeeper - Mods menu", "0.3.28")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class FrameworkBridgePlugin : BaseUnityPlugin { private sealed class Bridge : Gk2ModBase { private readonly Plugin main; private readonly Gk2ModMetadata metadata; public override Gk2ModMetadata Metadata => metadata; internal Bridge(Plugin main) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown this.main = main; metadata = new Gk2ModMetadata("com.focabr.gk2.autokeeper", "GK2 AutoKeeper", "focabr", "0.3.28", "Automation bot: morgue body processing using only player actions. F8 toggles the bot, F11 opens its own settings window.", false, false, false); } public override void OnRegister(Gk2ModContext context) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Invalid comparison between Unknown and I4 bool pt = (FrameworkLocalization.CurrentLanguage ?? "en").StartsWith("pt", StringComparison.OrdinalIgnoreCase); Gk2Settings settings = context.Settings; settings.AddButton("Bot", "ToggleBotAction", pt ? "Bot" : "Bot", pt ? "Liga ou desliga o bot agora (mesmo que a tecla de atalho)." : "Turns the bot on or off now (same as the hotkey).", (Func<string>)delegate { if (!main.IsBotOn) { if (!pt) { return "Start bot"; } return "Ligar bot"; } return (!pt) ? "Stop bot" : "Desligar bot"; }, (Action)main.ToggleBot, -20); settings.AddReadOnly("Bot", "StatusReadOnly", pt ? "Estado" : "Status", pt ? "Estado atual do bot." : "Current bot state.", (Func<string>)(() => main.BotStatusText), -19); foreach (SettingInfo uiSetting in main.Settings.UiSettings) { Register(settings, uiSetting, pt); } foreach (SettingInfo uiSetting2 in main.Settings.UiSettings) { if (((int)uiSetting2.Tab == 1 || (int)uiSetting2.Tab == 2) && (object)uiSetting2.Entry != main.Settings.BodiesEnabled) { settings.SetEnabledCondition(uiSetting2.Entry.Definition.Section, uiSetting2.Entry.Definition.Key, (Func<bool>)(() => main.Settings.BodiesEnabled.Value)); } } } private void Register(Gk2Settings ui, SettingInfo s, bool pt) { //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) ConfigDefinition definition = s.Entry.Definition; string text = s.Label(pt); string text2 = s.Help(pt); Type settingType = s.Entry.SettingType; if (settingType == typeof(bool)) { ui.AddToggle(definition.Section, definition.Key, (bool)s.Entry.DefaultValue, text, text2, s.Order); } else if (settingType == typeof(float)) { ui.AddFloatSlider(definition.Section, definition.Key, (float)s.Entry.DefaultValue, s.Min, s.Max, text, text2, s.Step, s.Order); } else if (settingType == typeof(int)) { ui.AddIntSlider(definition.Section, definition.Key, (int)s.Entry.DefaultValue, (int)s.Min, (int)s.Max, text, text2, Math.Max(1, (int)s.Step), s.Order); } else if (settingType == typeof(BodyDestination)) { ui.AddEnum<BodyDestination>(definition.Section, definition.Key, (BodyDestination)s.Entry.DefaultValue, text, text2, s.Order); } else if (settingType == typeof(OverlayCorner)) { ui.AddEnum<OverlayCorner>(definition.Section, definition.Key, (OverlayCorner)s.Entry.DefaultValue, text, text2, s.Order); } else if (settingType == typeof(LackOfSleepAction)) { ui.AddEnum<LackOfSleepAction>(definition.Section, definition.Key, (LackOfSleepAction)s.Entry.DefaultValue, text, text2, s.Order); } else if (settingType == typeof(KeyboardShortcut)) { ui.AddKeybind(definition.Section, definition.Key, (KeyboardShortcut)s.Entry.DefaultValue, text, text2, s.Order); } else if (settingType == typeof(string)) { ui.AddText(definition.Section, definition.Key, (string)s.Entry.DefaultValue, text, text2, s.Order); } } } public const string Guid = "com.focabr.gk2.autokeeper.framework"; public const string Name = "GK2 AutoKeeper - Mods menu"; private void Awake() { Plugin instance = Plugin.Instance; if ((Object)(object)instance == (Object)null || instance.Settings == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Main AutoKeeper plugin is not available; Mods menu integration disabled."); return; } if (!Chainloader.PluginInfos.ContainsKey("superman4eg.gk2.framework")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"GK2 Mod Framework not installed — Mods menu disabled (normal; the options stay in F11)."); return; } try { RegisterWithFramework(instance); ((BaseUnityPlugin)this).Logger.LogInfo((object)"AutoKeeper registered in the GK2 Mod Framework Mods menu."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to register with the GK2 Mod Framework: {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void RegisterWithFramework(Plugin main) { FrameworkApi.RegisterMod((IGk2Mod)(object)new Bridge(main), ((BaseUnityPlugin)main).Config); } } }