using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DialogUIRework")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cc63a05bdebfc67a74159218998a429246a53784")]
[assembly: AssemblyProduct("DialogUIRework")]
[assembly: AssemblyTitle("DialogUIRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace DialogUIRework
{
public static class DialogCategories
{
public static readonly Dictionary<string, List<string>> CategoryIDs = new Dictionary<string, List<string>>
{
["Dialogue"] = new List<string> { "ac8eec11-4039-463e-858d-94aa2a1b0cf5", "4f98dbb8-20c0-49b2-8c18-058a7e24f5a2", "873a7c42-f8c3-49ee-8ce7-3c0dabc2f33a", "5782e38b-a47d-434a-9b67-df366e0840a5", "71947512-010c-491d-9460-b7d78b688ee7", "af3b919b-8f69-406f-84b8-cf1b290e4575", "f1c27270-248d-4021-a5b6-3c2c30bae2b9", "703eca0b-dc96-4d29-9cf5-d87e52d34049", "9b1506ab-d6a0-4ec7-bf74-d8ad21c2d064", "6ab7c550-d795-4408-9cb5-4208f79355a0" },
["Investigation"] = new List<string>
{
"8aaa446c-f38e-4654-a4b9-0c37716ba910", "c9e93baa-e090-4242-b1ee-33f50271edd9", "8d0e1aa9-2a97-4b41-81e9-209053393577", "e77a3e32-6d2e-47b2-900a-b78d30164307", "d6c5d3de-b4f0-4d01-99e6-ed0df0fb0d69", "268053d5-2a13-4ae7-8583-77e1aa6680a8", "270fb046-e03e-4f2d-82be-d5e47de6c8e7", "2e04903a-54f4-49cc-9ba4-02657562f5c5", "83035934-50cc-49ab-9611-67a6b5c1631d", "f94eae0b-f691-4577-9d20-fe9cf6ef0593",
"7fd14a69-af7d-47fb-be81-e97671fb9001", "f6e73fc7-16b1-423f-82e8-2df62b277103", "cd4a4551-d2bd-45f4-b467-202e081379ef", "8dc675bb-ce7f-4758-aea2-84b0c75b827f", "7eb7b547-ac14-4529-869a-8d57ba750c45", "e7e04bd1-ac47-4123-bb75-0d1106eaedba", "e1783c63-bcb9-483a-888d-c4e995e7af2b"
},
["Transaction"] = new List<string>
{
"2ec57d6d-3034-44cc-ba37-7876b97014b6", "39b5d41c-cec7-4696-95c1-b1153b90b40b", "41e93330-78ba-4914-9456-adaa162f1f71", "f6e0d635-0977-4da2-b5f7-29c691ccf663", "96d190f6-556c-4bd3-a079-756fc5e0eba2", "d03fcf7c-f0d4-4f0b-88df-0a316632262e", "a4be688f-5f1d-4e55-8d55-2d6860394a64", "ae8f7278-6424-4e5a-8544-1355c4e9dcdc", "dd194ff8-0889-41d0-a974-9128bde320e0", "77672a96-b943-4d17-8e13-08f0e442acc8",
"5ad482ca-1356-47ef-baf5-9adc13edf25c", "da1e6fab-1a06-4b45-90cc-6d2c3bc883f8", "a93ee4da-f436-4115-9c1b-1588a80e7c64", "4bdc6c80-c929-4e40-ac2e-70516ea4a4ec", "30221a22-824d-4c6d-9783-43b6b6676586", "af9962a1-0526-460b-8fb0-00cee66ebe19", "4d3fbf2c-94e1-45de-8a55-94484b2bb153", "cb900896-5345-4ad3-a5f7-48e274314e57"
},
["Confrontation"] = new List<string> { "88000f4b-c693-49fd-a020-f48d6c7825b9", "370b5d7c-7607-4530-9e72-59aa09a6b205", "7d3db84f-467c-4dec-90b2-218fa74ee392", "f4fe690f-dc37-4df8-b315-d4878cd96048", "95aeeabc-0b53-436c-85ab-234571cd42cd", "7edb78fa-d11a-4939-b461-211cbf368bb9", "487788e6-1bf9-462e-b163-e137d2371182" },
["Medical"] = new List<string> { "354023a2-5c75-4d66-a831-23cfec0199c4", "17bba270-1793-400d-a464-53edef9adc30" },
["Other"] = new List<string>(),
["All"] = new List<string>()
};
public static readonly Dictionary<string, List<string>> CategoryKeywords = new Dictionary<string, List<string>>
{
{
"Dialogue",
new List<string>
{
"name", "hello", "hi", "goodbye", "bye", "how are you", "doing", "greet", "chat", "talk",
"spare", "give"
}
},
{
"Investigation",
new List<string>
{
"seen", "heard", "know", "unusual", "fingerprint", "tour", "inspect", "survey", "look around", "investigate",
"information", "about", "looking for", "where is", "find", "passcode"
}
},
{
"Transaction",
new List<string>
{
"buy", "purchase", "sell", "money", "pay", "cost", "price", "hours", "borrow", "loan",
"debt", "room", "bill", "check out", "item", "trade"
}
},
{
"Confrontation",
new List<string> { "arrest", "murder", "suspect", "threat", "no way", "refuse", "confront", "accuse", "why did", "catch" }
},
{
"Medical",
new List<string>()
},
{
"Other",
new List<string>()
},
{
"All",
new List<string>()
}
};
}
[BepInPlugin("DialogUIRework", "DialogUIRework", "1.0.0")]
public class DialogUIReworkPlugin : BasePlugin
{
public static ManualLogSource PluginLogger;
internal static TabbedDialogUI TabbedDialogUI;
internal static ConfigEntry<bool> _enableWASDNavigation;
internal static ConfigEntry<bool> _enableAllTab;
internal static ConfigEntry<bool> _enableControlGlyphs;
private static ConfigEntry<bool> _enabled;
public override void Load()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
PluginLogger = ((BasePlugin)this).Log;
_enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Is the mod enabled at all? (Game restart required)");
_enableWASDNavigation = ((BasePlugin)this).Config.Bind<bool>("General", "Enable WASD dialog navigation", true, "Enable WASD navigation (W and S to select dialog, A and D to change tab)");
_enableAllTab = ((BasePlugin)this).Config.Bind<bool>("General", "Enable All tab", true, "");
_enableControlGlyphs = ((BasePlugin)this).Config.Bind<bool>("General", "Enable control glyphs", true, "");
if (_enabled.Value)
{
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DialogUIRework");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
Harmony val2 = new Harmony("DialogUIRework");
val2.PatchAll();
ManualLogSource log2 = ((BasePlugin)this).Log;
val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DialogUIRework");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
}
log2.LogInfo(val);
}
}
}
public class DialogUIReworkHooks
{
[HarmonyPatch(typeof(PrefabControls), "Awake")]
public class PrefabControls_Awake
{
public static void Postfix()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (DialogUIReworkPlugin.TabbedDialogUI == null)
{
DialogUIReworkPlugin.TabbedDialogUI = new TabbedDialogUI();
Transform obj = ((Transform)PrefabControls.Instance.dialogOptionContainer).parent.Find("Header");
obj.localPosition += new Vector3(0f, 45f, 0f);
((Component)((Transform)PrefabControls.Instance.dialogOptionContainer).parent.Find("Border")).gameObject.SetActive(false);
ClassInjector.RegisterTypeInIl2Cpp<TabNavigationComponent>();
TabNavigationComponent tabNavigationComponent = ((Component)PrefabControls.Instance.dialogOptionContainer).gameObject.AddComponent<TabNavigationComponent>();
tabNavigationComponent.DialogUI = DialogUIReworkPlugin.TabbedDialogUI;
DialogUIReworkPlugin.TabbedDialogUI.CreateDialogUI();
}
}
}
[HarmonyPatch(typeof(InteractionController), "Update")]
public class InteractionController_Update
{
public static void Prefix()
{
if (DialogUIReworkPlugin.TabbedDialogUI != null)
{
List<DialogButtonController> tabDialogOptions = DialogUIReworkPlugin.TabbedDialogUI.GetTabDialogOptions();
if (tabDialogOptions != null)
{
InteractionController.Instance.dialogOptions = tabDialogOptions;
}
}
}
public static void Postfix()
{
if (DialogUIReworkPlugin.TabbedDialogUI != null)
{
List<DialogButtonController> tabDialogOptions = DialogUIReworkPlugin.TabbedDialogUI.GetTabDialogOptions("All");
if (tabDialogOptions != null)
{
InteractionController.Instance.dialogOptions = tabDialogOptions;
}
}
}
}
[HarmonyPatch(typeof(InteractionController), "SetDialog")]
public class InteractionController_SetDialog
{
public static void Prefix(bool val)
{
if (DialogUIReworkPlugin.TabbedDialogUI != null && !val)
{
DialogUIReworkPlugin.TabbedDialogUI.ClearDialogOptions();
}
}
}
[HarmonyPatch(typeof(InteractionController), "RefreshDialogOptions")]
public class InteractionController_RefreshDialogOptions
{
public static void Postfix()
{
if (((Transform)PrefabControls.Instance.dialogOptionContainer).childCount > 0)
{
DialogUIReworkPlugin.TabbedDialogUI.ModifyDialogContainer();
}
}
}
[HarmonyPatch(typeof(InteractionController), "SetDialogSelection")]
public class InteractionController_SetDialogSelection
{
public static bool Prefix(InteractionController __instance, int newVal)
{
//IL_007e: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
if (DialogUIReworkPlugin.TabbedDialogUI == null || DialogUIReworkPlugin.TabbedDialogUI.GetTabDialogOptions() == null)
{
return true;
}
List<DialogButtonController> tabDialogOptions = DialogUIReworkPlugin.TabbedDialogUI.GetTabDialogOptions();
__instance.dialogSelection = Mathf.Clamp(newVal, 0, tabDialogOptions.Count - 1);
((Component)__instance.moreOptionsScrollUpArrow).gameObject.SetActive(false);
((Component)__instance.moreOptionsScrollDownArrow).gameObject.SetActive(false);
PrefabControls.Instance.dialogOptionContainer.anchoredPosition = new Vector2(PrefabControls.Instance.dialogOptionContainer.anchoredPosition.x, (float)(-58 + Mathf.Max(__instance.dialogSelection - 3, 0) * 52));
for (int i = 0; i < tabDialogOptions.Count; i++)
{
DialogButtonController val = tabDialogOptions[i];
if ((Object)(object)val == (Object)null)
{
return false;
}
if (((Transform)((ButtonController)val).rect).position.y >= ((Transform)__instance.moreOptionsScrollUpArrow).position.y)
{
((Component)val).gameObject.SetActive(false);
((Component)__instance.moreOptionsScrollUpArrow).gameObject.SetActive(true);
}
else if (((Transform)((ButtonController)val).rect).position.y <= ((Transform)__instance.moreOptionsScrollDownArrow).position.y)
{
((Component)val).gameObject.SetActive(false);
((Component)__instance.moreOptionsScrollDownArrow).gameObject.SetActive(true);
}
else
{
((Component)val).gameObject.SetActive(true);
}
}
return false;
}
}
}
public class TabbedDialogUI
{
private GameObject tabContainer;
private GameObject contentContainer;
private GameObject leftArrow;
private GameObject rightArrow;
private GameObject tabSpacerLeft;
private GameObject tabSpacerRight;
private string controlGlyphFormat = "<sprite=\"desktop\" name=\"Keyboard Key\">";
private Dictionary<string, List<DialogButtonController>> categorizedOptions = new Dictionary<string, List<DialogButtonController>>();
private Dictionary<string, GameObject> tabButtons = new Dictionary<string, GameObject>();
private List<string> categoryOrder = new List<string>();
private string currentCategory;
private int currentOptionIndex = 0;
private ColorBlock buttonColors;
public static void AddIDs(string category, params string[] messageIds)
{
if (!DialogCategories.CategoryIDs.ContainsKey(category))
{
DialogCategories.CategoryIDs[category] = new List<string>();
}
DialogCategories.CategoryIDs[category].AddRange(messageIds);
}
public static void AddKeywords(string category, params string[] keywords)
{
if (!DialogCategories.CategoryKeywords.ContainsKey(category))
{
DialogCategories.CategoryKeywords[category] = new List<string>();
}
DialogCategories.CategoryKeywords[category].AddRange(keywords);
}
public void CreateDialogUI()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Expected O, but got Unknown
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Expected O, but got Unknown
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Expected O, but got Unknown
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)PrefabControls.Instance.dialogOptionContainer).gameObject;
tabContainer = new GameObject("TabContainer");
tabContainer.transform.SetParent(gameObject.transform.parent, false);
tabContainer.transform.SetSiblingIndex(2);
HorizontalLayoutGroup val = tabContainer.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val).spacing = 5f;
((LayoutGroup)val).padding = new RectOffset(10, 10, 10, 10);
((LayoutGroup)val).childAlignment = (TextAnchor)3;
RectTransform component = tabContainer.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 1f);
component.anchorMax = new Vector2(1f, 1f);
component.pivot = new Vector2(0.5f, 1f);
component.sizeDelta = new Vector2(0f, 60f);
component.anchoredPosition = new Vector2(0f, 0f);
Image componentInChildren = ((Component)PrefabControls.Instance.dialogRect).GetComponentInChildren<Image>();
Image val2 = tabContainer.AddComponent<Image>();
((Graphic)val2).color = ((Graphic)componentInChildren).color;
val2.sprite = componentInChildren.sprite;
val2.type = componentInChildren.type;
val2.fillMethod = componentInChildren.fillMethod;
val2.fillCenter = componentInChildren.fillCenter;
val2.fillClockwise = componentInChildren.fillClockwise;
((Graphic)val2).color = ((Graphic)componentInChildren).color;
leftArrow = new GameObject("LeftArrow");
leftArrow.transform.SetParent(tabContainer.transform, false);
TextMeshProUGUI val3 = leftArrow.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = controlGlyphFormat;
((TMP_Text)val3).fontSize = 16f;
((TMP_Text)val3).alignment = (TextAlignmentOptions)4097;
((TMP_Text)val3).margin = new Vector4(20f, 0f, 0f, 0f);
LayoutElement val4 = leftArrow.AddComponent<LayoutElement>();
val4.minWidth = 50f;
tabSpacerLeft = new GameObject("TabSpacerLeft");
tabSpacerLeft.transform.SetParent(tabContainer.transform, false);
tabSpacerLeft.AddComponent<LayoutElement>().flexibleWidth = 1f;
tabSpacerRight = new GameObject("TabSpacerRight");
tabSpacerRight.transform.SetParent(tabContainer.transform, false);
tabSpacerRight.AddComponent<LayoutElement>().flexibleWidth = 1f;
rightArrow = new GameObject("RightArrow");
rightArrow.transform.SetParent(tabContainer.transform, false);
TextMeshProUGUI val5 = rightArrow.AddComponent<TextMeshProUGUI>();
((TMP_Text)val5).text = controlGlyphFormat;
((TMP_Text)val5).fontSize = 16f;
((TMP_Text)val5).alignment = (TextAlignmentOptions)4100;
((TMP_Text)val5).margin = new Vector4(0f, 0f, 15f, 0f);
LayoutElement val6 = rightArrow.AddComponent<LayoutElement>();
val6.minWidth = 45f;
DialogUIReworkPlugin._enableControlGlyphs.SettingChanged += delegate
{
UpdateControlGlyphs();
};
DialogUIReworkPlugin._enableWASDNavigation.SettingChanged += delegate
{
UpdateControlGlyphs();
};
UpdateControlGlyphs();
}
private void UpdateControlGlyphs()
{
leftArrow.SetActive(DialogUIReworkPlugin._enableControlGlyphs.Value);
rightArrow.SetActive(DialogUIReworkPlugin._enableControlGlyphs.Value);
((TMP_Text)leftArrow.GetComponent<TextMeshProUGUI>()).text = controlGlyphFormat + (DialogUIReworkPlugin._enableWASDNavigation.Value ? "A" : "←");
((TMP_Text)rightArrow.GetComponent<TextMeshProUGUI>()).text = controlGlyphFormat + (DialogUIReworkPlugin._enableWASDNavigation.Value ? "D" : "→");
}
public void ModifyDialogContainer()
{
CategorizeDialogOptions(((Component)PrefabControls.Instance.dialogOptionContainer).gameObject);
CreateCategorizedUI(((Component)PrefabControls.Instance.dialogOptionContainer).gameObject);
}
private void CategorizeDialogOptions(GameObject dialogContainer)
{
foreach (string key2 in DialogCategories.CategoryKeywords.Keys)
{
categorizedOptions[key2] = new List<DialogButtonController>();
}
for (int i = 0; i < dialogContainer.transform.childCount; i++)
{
DialogButtonController component = ((Component)dialogContainer.transform.GetChild(i)).gameObject.GetComponent<DialogButtonController>();
string key = DetermineCategory(component);
categorizedOptions[key].Add(component);
categorizedOptions["All"].Add(component);
((Component)component).gameObject.SetActive(false);
component.SetSelectable(false);
}
List<string> list = (from kvp in categorizedOptions
where kvp.Value.Count == 0
select kvp.Key).ToList();
foreach (string item in list)
{
categorizedOptions.Remove(item);
}
}
private string DetermineCategory(DialogButtonController option)
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Expected O, but got Unknown
string optionId = GetOptionId(option);
string text = GetOptionText(option).ToLower();
if (!string.IsNullOrEmpty(optionId))
{
foreach (KeyValuePair<string, List<string>> categoryID in DialogCategories.CategoryIDs)
{
if (categoryID.Value.Contains(optionId))
{
return categoryID.Key;
}
}
}
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val;
if (string.IsNullOrEmpty(text))
{
ManualLogSource pluginLogger = DialogUIReworkPlugin.PluginLogger;
val = new BepInExWarningLogInterpolatedStringHandler(21, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Placed ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(optionId);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") by default");
}
pluginLogger.LogWarning(val);
return "Other";
}
foreach (KeyValuePair<string, List<string>> categoryKeyword in DialogCategories.CategoryKeywords)
{
if (categoryKeyword.Key == "Other")
{
continue;
}
foreach (string item in categoryKeyword.Value)
{
if (text.Contains(item.ToLower()))
{
ManualLogSource pluginLogger2 = DialogUIReworkPlugin.PluginLogger;
val = new BepInExWarningLogInterpolatedStringHandler(24, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Placed ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(optionId);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") by keyword (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
pluginLogger2.LogWarning(val);
return categoryKeyword.Key;
}
}
}
ManualLogSource pluginLogger3 = DialogUIReworkPlugin.PluginLogger;
val = new BepInExWarningLogInterpolatedStringHandler(21, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Placed ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(optionId);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") by default");
}
pluginLogger3.LogWarning(val);
return "Other";
}
private string GetOptionId(DialogButtonController option)
{
return option.option.preset.msgID;
}
private string GetOptionText(DialogButtonController option)
{
TextMeshProUGUI componentInChildren = ((Component)option).GetComponentInChildren<TextMeshProUGUI>();
return ((Object)(object)componentInChildren != (Object)null) ? ((TMP_Text)componentInChildren).text : "";
}
private void CreateCategorizedUI(GameObject dialogContainer)
{
CreateTabs();
string category = currentCategory;
if (string.IsNullOrEmpty(currentCategory))
{
category = ((((Transform)PrefabControls.Instance.dialogOptionContainer).childCount <= 0) ? categorizedOptions.Keys.First() : DetermineCategory(((Component)((Transform)PrefabControls.Instance.dialogOptionContainer).GetChild(0)).GetComponent<DialogButtonController>()));
}
ShowCategory(category);
}
private void CreateTabs()
{
categoryOrder.Clear();
foreach (string key in categorizedOptions.Keys)
{
if ((DialogUIReworkPlugin._enableAllTab.Value && categorizedOptions.Count != 2) || !(key == "All"))
{
CreateTab(key);
}
}
}
private void CreateTab(string category)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_01da: 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_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
if (!string.IsNullOrEmpty(category))
{
if (tabButtons.ContainsKey(category) && (Object)(object)tabButtons[category] != (Object)null)
{
Object.Destroy((Object)(object)tabButtons[category]);
}
categoryOrder.Add(category);
GameObject val = new GameObject("Tab_" + category);
val.transform.SetParent(tabContainer.transform, false);
if ((Object)(object)tabSpacerRight != (Object)null)
{
val.transform.SetSiblingIndex(tabSpacerRight.transform.GetSiblingIndex());
}
Button val2 = val.AddComponent<Button>();
Image componentInChildren = PrefabControls.Instance.dialogOption.GetComponentInChildren<Image>();
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = ((Graphic)componentInChildren).color;
val3.sprite = componentInChildren.sprite;
val3.type = componentInChildren.type;
val3.fillMethod = componentInChildren.fillMethod;
val3.fillCenter = componentInChildren.fillCenter;
val3.fillClockwise = componentInChildren.fillClockwise;
((Selectable)val2).colors = buttonColors;
GameObject val4 = new GameObject("Text");
val4.transform.SetParent(val.transform, false);
TextMeshProUGUI componentInChildren2 = PrefabControls.Instance.dialogOption.GetComponentInChildren<TextMeshProUGUI>();
TextMeshProUGUI val5 = val4.AddComponent<TextMeshProUGUI>();
((TMP_Text)val5).text = $"{category} ({categorizedOptions[category].Count})";
((TMP_Text)val5).font = ((TMP_Text)componentInChildren2).font;
((TMP_Text)val5).fontSize = 14f;
((Graphic)val5).color = ((Graphic)componentInChildren2).color;
((TMP_Text)val5).alignment = (TextAlignmentOptions)514;
RectTransform component = val4.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
component.anchoredPosition = Vector2.zero;
RectTransform component2 = val.GetComponent<RectTransform>();
component2.sizeDelta = new Vector2(100f, 30f);
LayoutElement val6 = val.AddComponent<LayoutElement>();
val6.minWidth = 120f;
val6.preferredWidth = 160f;
val6.flexibleWidth = 0f;
val6.minHeight = 40f;
tabButtons[category] = val;
}
}
public void ClearDialogOptions()
{
if (categorizedOptions.ContainsKey("All"))
{
for (int num = categorizedOptions["All"].Count - 1; num >= 0; num--)
{
Object.Destroy((Object)(object)((Component)categorizedOptions["All"][num]).gameObject);
}
}
categorizedOptions.Clear();
foreach (KeyValuePair<string, GameObject> tabButton in tabButtons)
{
if ((Object)(object)tabButton.Value != (Object)null)
{
Object.Destroy((Object)(object)tabButton.Value);
}
}
tabButtons.Clear();
categoryOrder.Clear();
currentCategory = "";
}
private void ShowCategory(string category)
{
//IL_00db: 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)
if (InteractionController.Instance.talkingTo != null && (Object)(object)InteractionController.Instance.talkingTo.speechController != (Object)null && InteractionController.Instance.talkingTo.speechController.speechActive)
{
return;
}
currentCategory = (string.IsNullOrEmpty(category) ? "All" : category);
foreach (KeyValuePair<string, List<DialogButtonController>> categorizedOption in categorizedOptions)
{
Enumerator<DialogButtonController> enumerator2 = categorizedOption.Value.GetEnumerator();
while (enumerator2.MoveNext())
{
DialogButtonController current = enumerator2.Current;
((Component)current).gameObject.SetActive(false);
current.SetSelectable(false);
}
}
PrefabControls.Instance.dialogOptionContainer.anchoredPosition = new Vector2(0f, -58f);
if (categorizedOptions.ContainsKey(category))
{
int num = 0;
Enumerator<DialogButtonController> enumerator3 = categorizedOptions[category].GetEnumerator();
while (enumerator3.MoveNext())
{
DialogButtonController current2 = enumerator3.Current;
((Component)current2).gameObject.SetActive(true);
current2.SetSelectable(true);
((ButtonController)current2).rect.anchoredPosition = new Vector2(0f, (float)num);
num -= 52;
}
}
UpdateTabVisuals();
if ((Object)(object)InteractionController.Instance != (Object)null)
{
InteractionController.Instance.SetDialogSelection(0);
}
}
private void UpdateTabVisuals()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<string, GameObject> tabButton in tabButtons)
{
Image component = tabButton.Value.GetComponent<Image>();
if (tabButton.Key == currentCategory)
{
((Graphic)component).color = ((ColorBlock)(ref buttonColors)).selectedColor;
}
else
{
((Graphic)component).color = ((ColorBlock)(ref buttonColors)).normalColor;
}
}
}
public void SwitchToPreviousTab()
{
if (categoryOrder != null && categoryOrder.Count > 1)
{
int num = categoryOrder.IndexOf(currentCategory);
if (num >= 0)
{
int index = (num - 1 + categoryOrder.Count) % categoryOrder.Count;
ShowCategory(categoryOrder[index]);
}
}
}
public void SwitchToNextTab()
{
if (categoryOrder != null && categoryOrder.Count > 1)
{
int num = categoryOrder.IndexOf(currentCategory);
if (num >= 0)
{
int index = (num + 1) % categoryOrder.Count;
ShowCategory(categoryOrder[index]);
}
}
}
public void SwitchToTab(string category)
{
ShowCategory(category);
}
public List<DialogButtonController> GetTabDialogOptions(string categoryOverride = null)
{
string text = ((categoryOverride == null) ? currentCategory : categoryOverride);
if (categorizedOptions == null || text == null || !categorizedOptions.ContainsKey(text))
{
return null;
}
for (int num = categorizedOptions[text].Count - 1; num >= 0; num--)
{
DialogButtonController val = categorizedOptions[text][num];
if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null)
{
categorizedOptions[text].RemoveAt(num);
}
}
return categorizedOptions[text];
}
public TabbedDialogUI()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
ColorBlock val = default(ColorBlock);
((ColorBlock)(ref val)).normalColor = new Color(0.2519f, 0.2118f, 0.5283f, 1f);
((ColorBlock)(ref val)).highlightedColor = new Color(0.2519f, 0.2118f, 0.5283f, 1f);
((ColorBlock)(ref val)).pressedColor = new Color(0.2519f, 0.2118f, 0.5283f, 1f);
((ColorBlock)(ref val)).selectedColor = new Color(31f / 85f, 26f / 85f, 0.7607843f, 1f);
buttonColors = val;
base..ctor();
}
}
public class TabNavigationComponent : MonoBehaviour
{
internal TabbedDialogUI DialogUI;
private void Update()
{
if (DialogUI == null || !InteractionController.Instance.dialogMode)
{
return;
}
if (Input.GetKeyDown((KeyCode)276) || (DialogUIReworkPlugin._enableWASDNavigation.Value && Input.GetKeyDown((KeyCode)97)))
{
DialogUI.SwitchToPreviousTab();
}
if (Input.GetKeyDown((KeyCode)275) || (DialogUIReworkPlugin._enableWASDNavigation.Value && Input.GetKeyDown((KeyCode)100)))
{
DialogUI.SwitchToNextTab();
}
if (DialogUIReworkPlugin._enableWASDNavigation.Value)
{
if (Input.GetKeyDown((KeyCode)119))
{
InteractionController.Instance.SetDialogSelection(InteractionController.Instance.dialogSelection - 1);
}
else if (Input.GetKeyDown((KeyCode)115))
{
InteractionController.Instance.SetDialogSelection(InteractionController.Instance.dialogSelection + 1);
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DialogUIRework";
public const string PLUGIN_NAME = "DialogUIRework";
public const string PLUGIN_VERSION = "1.0.0";
}
}