The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of PeakTextChat v1.1.0
PeakTextChat.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using UnityEngine.UI.ProceduralImage; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PeakTextChat")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+0c0ba367b7262064bb2c5a3b7d8dbacd8dad8b03")] [assembly: AssemblyProduct("PeakTextChat")] [assembly: AssemblyTitle("PeakTextChat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeakTextChat { [HarmonyPatch(typeof(Character), "Awake")] public static class CharacterPatch { [HarmonyPostfix] public static void AwakePatch(Character __instance) { ((Component)__instance).gameObject.AddComponent<TextChatManager>(); } } [HarmonyPatch(typeof(StaminaBar), "Start")] public static class StaminaBarPatch { public static RectTransform textChatDummyTransform; [HarmonyPostfix] public static void Postfix(StaminaBar __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if ((Object)(object)GUIManager.instance != (Object)null) { GameObject val = new GameObject("TextChatPos"); RectTransform val2 = (RectTransform)((Component)__instance).transform.parent; val2.offsetMax = new Vector2(val2.offsetMax.x, 1000f); val.transform.SetParent((Transform)(object)val2); RectTransform val3 = val.AddComponent<RectTransform>(); ((Transform)val3).SetAsFirstSibling(); val3.sizeDelta = Vector2.zero; textChatDummyTransform = (RectTransform)val.transform; } } } [HarmonyPatch(typeof(GUIManager), "Start")] public static class GUIManagerPatch { public static GameObject textChatCanvasObj; public static TMP_FontAsset darumaDropOneFont; [HarmonyPostfix] public static void Postfix(GUIManager __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown Transform transform = ((Component)__instance).transform; textChatCanvasObj = new GameObject("TextChatCanvas"); textChatCanvasObj.transform.SetParent(transform, false); Canvas val = textChatCanvasObj.AddComponent<Canvas>(); val.renderMode = (RenderMode)1; CanvasScaler val2 = ((Component)val).gameObject.GetComponent<CanvasScaler>() ?? ((Component)val).gameObject.AddComponent<CanvasScaler>(); val2.referencePixelsPerUnit = 100f; val2.matchWidthOrHeight = 1f; val2.referenceResolution = new Vector2(1920f, 1080f); val2.scaleFactor = 1f; val2.screenMatchMode = (ScreenMatchMode)0; val2.uiScaleMode = (ScaleMode)1; GameObject val3 = new GameObject("TextChat"); val3.transform.SetParent(((Component)val).transform, false); val3.AddComponent<TextChatDisplay>(); Canvas hudCanvas = __instance.hudCanvas; object obj; if (hudCanvas == null) { obj = null; } else { Transform obj2 = ((Component)hudCanvas).transform.Find("Notification/Fog"); obj = ((obj2 != null) ? ((Component)obj2).gameObject.GetComponent<TMP_Text>() : null); } TMP_Text val4 = (TMP_Text)obj; if ((Object)(object)val4 != (Object)null) { darumaDropOneFont = val4.font; } } } public static class KeysHelper { public class KeyCodeInfo { public KeyCodeShort shortKey; public KeyCode key; public string keyText; public KeyCodeInfo(KeyCodeShort shortKey, KeyCode key, string keyText) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) this.shortKey = shortKey; this.key = key; this.keyText = keyText; } } public static List<KeyCodeInfo> infos = new List<KeyCodeInfo> { new KeyCodeInfo(KeyCodeShort.A, (KeyCode)97, "A"), new KeyCodeInfo(KeyCodeShort.B, (KeyCode)98, "B"), new KeyCodeInfo(KeyCodeShort.C, (KeyCode)99, "C"), new KeyCodeInfo(KeyCodeShort.D, (KeyCode)100, "D"), new KeyCodeInfo(KeyCodeShort.E, (KeyCode)101, "E"), new KeyCodeInfo(KeyCodeShort.F, (KeyCode)102, "F"), new KeyCodeInfo(KeyCodeShort.G, (KeyCode)103, "G"), new KeyCodeInfo(KeyCodeShort.H, (KeyCode)104, "H"), new KeyCodeInfo(KeyCodeShort.I, (KeyCode)105, "I"), new KeyCodeInfo(KeyCodeShort.J, (KeyCode)106, "J"), new KeyCodeInfo(KeyCodeShort.K, (KeyCode)107, "K"), new KeyCodeInfo(KeyCodeShort.L, (KeyCode)108, "L"), new KeyCodeInfo(KeyCodeShort.M, (KeyCode)109, "M"), new KeyCodeInfo(KeyCodeShort.N, (KeyCode)110, "N"), new KeyCodeInfo(KeyCodeShort.O, (KeyCode)111, "O"), new KeyCodeInfo(KeyCodeShort.P, (KeyCode)112, "P"), new KeyCodeInfo(KeyCodeShort.Q, (KeyCode)113, "Q"), new KeyCodeInfo(KeyCodeShort.R, (KeyCode)114, "R"), new KeyCodeInfo(KeyCodeShort.S, (KeyCode)115, "S"), new KeyCodeInfo(KeyCodeShort.T, (KeyCode)116, "T"), new KeyCodeInfo(KeyCodeShort.U, (KeyCode)117, "U"), new KeyCodeInfo(KeyCodeShort.V, (KeyCode)118, "V"), new KeyCodeInfo(KeyCodeShort.W, (KeyCode)119, "W"), new KeyCodeInfo(KeyCodeShort.X, (KeyCode)120, "X"), new KeyCodeInfo(KeyCodeShort.Y, (KeyCode)121, "Y"), new KeyCodeInfo(KeyCodeShort.Z, (KeyCode)122, "Z"), new KeyCodeInfo(KeyCodeShort.One, (KeyCode)49, "1"), new KeyCodeInfo(KeyCodeShort.Two, (KeyCode)50, "2"), new KeyCodeInfo(KeyCodeShort.Three, (KeyCode)51, "3"), new KeyCodeInfo(KeyCodeShort.Four, (KeyCode)52, "4"), new KeyCodeInfo(KeyCodeShort.Five, (KeyCode)53, "5"), new KeyCodeInfo(KeyCodeShort.Six, (KeyCode)54, "6"), new KeyCodeInfo(KeyCodeShort.Seven, (KeyCode)55, "7"), new KeyCodeInfo(KeyCodeShort.Eight, (KeyCode)56, "8"), new KeyCodeInfo(KeyCodeShort.Nine, (KeyCode)57, "9"), new KeyCodeInfo(KeyCodeShort.Zero, (KeyCode)48, "0"), new KeyCodeInfo(KeyCodeShort.Minus, (KeyCode)45, "-"), new KeyCodeInfo(KeyCodeShort.Equals, (KeyCode)61, "="), new KeyCodeInfo(KeyCodeShort.Tab, (KeyCode)9, "Tab"), new KeyCodeInfo(KeyCodeShort.Quote, (KeyCode)39, "'"), new KeyCodeInfo(KeyCodeShort.Semicolon, (KeyCode)59, ";"), new KeyCodeInfo(KeyCodeShort.LeftBracket, (KeyCode)91, "["), new KeyCodeInfo(KeyCodeShort.RightBracket, (KeyCode)93, "]"), new KeyCodeInfo(KeyCodeShort.Slash, (KeyCode)47, "/"), new KeyCodeInfo(KeyCodeShort.Numpad0, (KeyCode)256, "Num0"), new KeyCodeInfo(KeyCodeShort.Numpad1, (KeyCode)257, "Num1"), new KeyCodeInfo(KeyCodeShort.Numpad2, (KeyCode)258, "Num2"), new KeyCodeInfo(KeyCodeShort.Numpad3, (KeyCode)259, "Num3"), new KeyCodeInfo(KeyCodeShort.Numpad4, (KeyCode)260, "Num4"), new KeyCodeInfo(KeyCodeShort.Numpad5, (KeyCode)261, "Num5"), new KeyCodeInfo(KeyCodeShort.Numpad6, (KeyCode)262, "Num6"), new KeyCodeInfo(KeyCodeShort.Numpad7, (KeyCode)263, "Num7"), new KeyCodeInfo(KeyCodeShort.Numpad8, (KeyCode)264, "Num8"), new KeyCodeInfo(KeyCodeShort.Numpad9, (KeyCode)265, "Num9") }; public static KeyCodeInfo GetKeyCodeShortInfo(KeyCodeShort key) { return infos.Find((KeyCodeInfo i) => i.shortKey == key); } } public enum KeyCodeShort { A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Zero, Minus, Equals, Tab, Quote, Semicolon, LeftBracket, RightBracket, Slash, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9 } [BepInPlugin("com.borealityy.peaktextchat", "PeakTextChat", "1.1.0")] public class PeakTextChatPlugin : BaseUnityPlugin { internal static ManualLogSource Logger; private Harmony harmony; public static ConfigEntry<float> configFontSize; public static ConfigEntry<float> configMessageFadeDelay; public static ConfigEntry<float> configFadeDelay; public static ConfigEntry<float> configHideDelay; public static ConfigEntry<KeyCodeShort> configKey; private void Awake() { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"PeakTextChat is loaded!"); configKey = ((BaseUnityPlugin)this).Config.Bind<KeyCodeShort>("Display", "ChatKey", KeyCodeShort.Slash, "The key that activates typing in chat"); configFontSize = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "ChatFontSize", 20f, "Size of the chat's text"); configFadeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "ChatFadeDelay", 15f, "How long before the chat fades out (a negative number means never)"); configHideDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "ChatHideDelay", 40f, "How long before the chat hides completely (a negative number means never)"); configMessageFadeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "ChatMessageHideDelay", 40f, "How long before a chat message disappears (a negative number means never)"); harmony = new Harmony("com.borealityy.peaktextchat"); harmony.PatchAll(typeof(CharacterPatch)); harmony.PatchAll(typeof(StaminaBarPatch)); harmony.PatchAll(typeof(GUIManagerPatch)); harmony.PatchAll(typeof(TextChatBlockInput)); } private void OnDestroy() { if ((Object)(object)TextChatDisplay.instance != (Object)null) { Object.Destroy((Object)(object)((Component)TextChatDisplay.instance).gameObject); } if ((Object)(object)TextChatManager.instance != (Object)null) { Object.Destroy((Object)(object)TextChatManager.instance); } if ((Object)(object)GUIManagerPatch.textChatCanvasObj != (Object)null) { Object.Destroy((Object)(object)GUIManagerPatch.textChatCanvasObj); } if ((Object)(object)StaminaBarPatch.textChatDummyTransform != (Object)null) { Object.Destroy((Object)(object)((Component)StaminaBarPatch.textChatDummyTransform).gameObject); } harmony.UnpatchSelf(); } } public static class ProceduralImageExtensions { public static T SetModifierType<T>(this ProceduralImage image) where T : ProceduralImageModifier { image.ModifierType = typeof(T); return ((Component)image).gameObject.GetComponent<T>() ?? ((Component)image).gameObject.AddComponent<T>(); } } [HarmonyPatch(typeof(GUIManager), "UpdateWindowStatus")] public static class TextChatBlockInput { private static readonly MethodInfo windowBlockingInput = AccessTools.PropertySetter(typeof(GUIManager), "windowBlockingInput"); [HarmonyPostfix] public static void Postfix() { TextChatDisplay instance = TextChatDisplay.instance; if (instance != null && instance.isBlockingInput) { windowBlockingInput?.Invoke(GUIManager.instance, new object[1] { true }); } } } public class TextChatDisplay : MonoBehaviour { public class ChatMessage { public string message; public GameObject textObj; public TMP_Text text; private Color textColor; private float hideDelay = 40f; private float hideTime = 10f; private float hideTimer = -1f; private float hide = 0f; public void Update() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) hideTimer -= Time.deltaTime; if (hideTimer <= 0f && hide < 1f) { hide += Time.deltaTime / hideTime; ((Graphic)text).color = new Color(textColor.r, textColor.g, textColor.b, 1f - hide); } } public ChatMessage(string message, GameObject textObject, float hideDelay) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) this.message = message; textObj = textObject; text = textObject.GetComponent<TMP_Text>(); textColor = ((Graphic)text).color; this.hideDelay = hideDelay; hideTimer = hideDelay; } } private int maxMessages = 30; private Vector2 boxSize = new Vector2(500f, 300f); private float fadeInTime = 0.03f; private float fadeOutTime = 5f; private float hideTime = 5f; private float fadeOutDelay = 15f; private float hideDelay = 40f; private float messageHideDelay = 40f; private float fontSize = 25f; private TMP_InputField inputField; private RectTransform chatLogViewportTransform; private RectTransform baseTransform; private CanvasGroup canvasGroup; private float fade = 1f; private float fadeTimer = -1f; private float hide = 0f; private float hideTimer = -1f; private KeysHelper.KeyCodeInfo keyInfo; private Color offWhite = new Color(0.87f, 0.85f, 0.76f); private List<ChatMessage> messages = new List<ChatMessage>(); public bool isBlockingInput = false; public static TextChatDisplay instance; private GameObject currentSelection; private void Awake() { instance = this; } private void Start() { keyInfo = KeysHelper.GetKeyCodeShortInfo(PeakTextChatPlugin.configKey.Value); fontSize = ((PeakTextChatPlugin.configFontSize.Value < 0f) ? 1E+09f : PeakTextChatPlugin.configFontSize.Value); hideDelay = ((PeakTextChatPlugin.configHideDelay.Value < 0f) ? float.PositiveInfinity : PeakTextChatPlugin.configHideDelay.Value); fadeOutDelay = Mathf.Min((PeakTextChatPlugin.configFadeDelay.Value < 0f) ? float.PositiveInfinity : PeakTextChatPlugin.configFadeDelay.Value, hideDelay); messageHideDelay = ((PeakTextChatPlugin.configMessageFadeDelay.Value < 0f) ? float.PositiveInfinity : PeakTextChatPlugin.configMessageFadeDelay.Value); ResetTimers(); SetupChatGUI(); } private void Update() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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) if ((Object)(object)currentSelection != (Object)(object)EventSystem.current.currentSelectedGameObject) { currentSelection = EventSystem.current.currentSelectedGameObject; if ((Object)(object)currentSelection != (Object)(object)((Component)inputField).gameObject) { isBlockingInput = false; } } if (Input.GetKeyDown(keyInfo.key) && (Object)(object)inputField != (Object)null && (Object)(object)EventSystem.current != (Object)null && !GUIManager.instance.windowBlockingInput) { EventSystem.current.SetSelectedGameObject(((Component)inputField).gameObject, (BaseEventData)null); inputField.ActivateInputField(); isBlockingInput = true; } if (isBlockingInput) { ResetTimers(); } if ((Object)(object)baseTransform != (Object)null && (Object)(object)StaminaBarPatch.textChatDummyTransform != (Object)null) { ((Transform)baseTransform).position = ((Transform)StaminaBarPatch.textChatDummyTransform).position; RectTransform obj = baseTransform; obj.anchoredPosition += new Vector2(0f, 40f); } fade = Mathf.Clamp((fadeTimer <= 0f) ? (fade - Time.deltaTime / fadeOutTime) : (fade + Time.deltaTime / fadeInTime), 0f, 1f); hide = Mathf.Clamp((hideTimer <= 0f) ? (hide + Time.deltaTime / hideTime) : (hide - Time.deltaTime / fadeInTime), 0f, 1f); fadeTimer -= Time.deltaTime; hideTimer -= Time.deltaTime; if ((Object)(object)canvasGroup != (Object)null) { canvasGroup.alpha = fade * 0.5f + (1f - hide) * 0.5f; } foreach (ChatMessage message in messages) { message.Update(); } } private void SetupChatGUI() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00ee: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_020a: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Expected O, but got Unknown //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) GUIManager val = GUIManager.instance; baseTransform = ((Component)this).gameObject.GetComponent<RectTransform>() ?? ((Component)this).gameObject.AddComponent<RectTransform>(); ((Transform)baseTransform).SetParent(((Component)this).transform, false); baseTransform.anchorMax = Vector2.zero; baseTransform.anchorMin = Vector2.zero; baseTransform.pivot = Vector2.zero; baseTransform.sizeDelta = boxSize; canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>(); canvasGroup.alpha = 1f; canvasGroup.blocksRaycasts = true; canvasGroup.interactable = true; canvasGroup.ignoreParentGroups = false; GameObject val2 = new GameObject("Shadow"); val2.transform.SetParent((Transform)(object)baseTransform, false); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; ProceduralImage val4 = val2.AddComponent<ProceduralImage>(); ((Graphic)val4).color = new Color(0f, 0f, 0f, 0.3f); val4.FalloffDistance = 10f; val4.SetModifierType<UniformModifier>().Radius = 15f; GameObject val5 = new GameObject("ChatLog"); RectTransform val6 = val5.AddComponent<RectTransform>(); ((Transform)val6).SetParent((Transform)(object)baseTransform, false); val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.offsetMin = new Vector2(0f, fontSize + 20f); val6.offsetMax = Vector2.zero; val5.AddComponent<RectMask2D>(); GameObject val7 = new GameObject("Viewport"); chatLogViewportTransform = val7.AddComponent<RectTransform>(); ((Transform)chatLogViewportTransform).SetParent((Transform)(object)val6, false); chatLogViewportTransform.pivot = new Vector2(0.5f, 0f); chatLogViewportTransform.anchorMin = Vector2.zero; chatLogViewportTransform.anchorMax = new Vector2(1f, 0f); chatLogViewportTransform.offsetMin = Vector2.zero; chatLogViewportTransform.offsetMax = new Vector2(0f, 5000f); inputField = CreateInputField(); RectTransform val8 = (RectTransform)((Component)inputField).transform; val8.pivot = new Vector2(0.5f, 0f); val8.anchorMin = new Vector2(0f, 0f); val8.anchorMax = new Vector2(1f, 0f); val8.offsetMin = new Vector2(5f, 5f); val8.offsetMax = new Vector2(-5f, fontSize + 15f); ((Transform)val8).SetParent((Transform)(object)baseTransform, false); VerticalLayoutGroup val9 = val7.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val9).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val9).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val9).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val9).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val9).childScaleWidth = false; ((HorizontalOrVerticalLayoutGroup)val9).childScaleHeight = false; ((LayoutGroup)val9).childAlignment = (TextAnchor)7; ((LayoutGroup)val9).padding = new RectOffset(12, 12, 1, 1); ((HorizontalOrVerticalLayoutGroup)val9).spacing = (0f - fontSize) / 10f; ((UnityEvent<string>)(object)inputField.onSubmit).AddListener((UnityAction<string>)delegate(string e) { inputField.text = ""; TextChatManager.instance?.SendChatMessage(e); }); ((UnityEvent<string>)(object)inputField.onEndEdit).AddListener((UnityAction<string>)delegate { EventSystem.current.SetSelectedGameObject((GameObject)null); isBlockingInput = false; }); GameObject val10 = new GameObject("Border"); val10.transform.SetParent((Transform)(object)baseTransform, false); RectTransform val11 = val10.AddComponent<RectTransform>(); val11.anchorMin = Vector2.zero; val11.anchorMax = Vector2.one; val11.offsetMin = Vector2.zero; val11.offsetMax = Vector2.zero; ProceduralImage val12 = val10.AddComponent<ProceduralImage>(); ((Graphic)val12).color = offWhite; val12.BorderWidth = 2f; val12.SetModifierType<UniformModifier>().Radius = 10f; } private TMP_InputField CreateInputField() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0031: 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_0058: Expected O, but got Unknown //IL_0062: 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_0086: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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) GameObject val = new GameObject("InputField"); TMP_InputField val2 = val.AddComponent<TMP_InputField>(); ((Behaviour)val2).enabled = false; ProceduralImage val4 = (ProceduralImage)(object)(((Selectable)val2).targetGraphic = (Graphic)(object)((Component)val2).gameObject.AddComponent<ProceduralImage>()); ((Graphic)val4).color = offWhite; val4.SetModifierType<UniformModifier>().Radius = 5f; GameObject val5 = new GameObject("Text Area"); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMax = Vector2.one; val6.anchorMin = Vector2.zero; val6.offsetMax = new Vector2(-10f, -7f); val6.offsetMin = new Vector2(10f, 6f); ((Transform)val6).SetParent(((Component)val2).transform, false); RectMask2D val7 = val5.AddComponent<RectMask2D>(); val7.padding = new Vector4(-8f, -5f, -8f, -5f); TMP_Text val8 = CreateText((Transform)(object)val6); ((Graphic)val8).color = new Color(0f, 0f, 0f, 0.6f); val8.text = "Press " + keyInfo.keyText + " to chat"; ((Object)val8).name = "Placeholder"; TMP_Text val9 = CreateText((Transform)(object)val6); ((Graphic)val9).color = new Color(0f, 0f, 0f, 1f); val9.richText = false; val2.textViewport = val6; val2.textComponent = val9; val2.placeholder = (Graphic)(object)val8; ((Behaviour)val2).enabled = true; return val2; } private TMP_Text CreateText(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text"); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMax = Vector2.one; val2.anchorMin = Vector2.zero; val2.offsetMax = new Vector2(-2f, 0f); val2.offsetMin = new Vector2(2f, 4f); ((Transform)val2).SetParent(parent, false); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).text = "New Text"; if ((Object)(object)GUIManagerPatch.darumaDropOneFont != (Object)null) { ((TMP_Text)val3).font = GUIManagerPatch.darumaDropOneFont; } ((TMP_Text)val3).fontSize = fontSize; ((TMP_Text)val3).horizontalAlignment = (HorizontalAlignmentOptions)1; ((TMP_Text)val3).verticalAlignment = (VerticalAlignmentOptions)512; return (TMP_Text)(object)val3; } public void AddMessage(string message) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) if (!((Object)(object)chatLogViewportTransform != (Object)null)) { return; } TMP_Text val = CreateText((Transform)(object)chatLogViewportTransform); val.text = message; ((Graphic)val).color = offWhite; val.lineSpacing = -40f; Vector2 preferredValues = val.GetPreferredValues(message, boxSize.x - 14f, 1000f); ((RectTransform)val.transform).sizeDelta = new Vector2(0f, preferredValues.y); ChatMessage item = new ChatMessage(message, ((Component)val).gameObject, messageHideDelay); messages.Add(item); if (messages.Count > maxMessages) { ChatMessage chatMessage = messages[0]; if (chatMessage != null && (Object)(object)chatMessage.textObj != (Object)null) { Object.Destroy((Object)(object)chatMessage.textObj); } messages.RemoveAt(0); } ResetTimers(); } private void ResetTimers() { fadeTimer = fadeOutDelay; hideTimer = hideDelay; } } public class TextChatManager : MonoBehaviour { public static TextChatManager instance; private Character character; private void Start() { instance = this; character = ((Component)this).GetComponent<Character>(); } [PunRPC] public void ReceiveChatMessage(string senderName, string message) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TextChatDisplay.instance != (Object)null) { Character val = Character.AllCharacters.Find((Character c) => c.characterName == senderName); string text = "#fff"; if ((Object)(object)val != (Object)null) { text = "#" + ColorUtility.ToHtmlStringRGB(val.refs.customization.PlayerColor); } TextChatDisplay.instance.AddMessage("<color=" + text + ">[" + senderName + "]</color>: " + message); } } public void SendChatMessage(string message) { if (!string.IsNullOrWhiteSpace(message) && (Object)(object)character != (Object)null) { ((MonoBehaviourPun)character).photonView.RPC("ReceiveChatMessage", (RpcTarget)0, new object[2] { PhotonNetwork.NickName, message }); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "PeakTextChat"; public const string PLUGIN_NAME = "PeakTextChat"; public const string PLUGIN_VERSION = "1.1.0"; } }