using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PeakTextChat;
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.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.atomic.peakchatemojis")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("com.atomic.peakchatemojis")]
[assembly: AssemblyTitle("PEAKChatEmojis")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace PEAKChatEmojis
{
public class EmojiPicker : MonoBehaviour
{
private class EmojiRow : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerEnterHandler
{
private EmojiPicker picker;
private int index;
private Image background;
private RawImage icon;
private AspectRatioFitter aspect;
private TMP_Text label;
private Color selectedColor;
public static EmojiRow Create(EmojiPicker owner, int index, Transform parent, float height, float fontSize, Color textColor, Color panelColor)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0041: 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)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_0114: 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_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: 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: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Expected O, but got Unknown
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Expected O, but got Unknown
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: 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_02db: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent, false);
EmojiRow emojiRow = val.AddComponent<EmojiRow>();
emojiRow.picker = owner;
emojiRow.index = index;
emojiRow.selectedColor = new Color(panelColor.r * 0.82f, panelColor.g * 0.82f, panelColor.b * 0.82f, panelColor.a);
ProceduralImage modifierType = val.AddComponent<ProceduralImage>();
ProceduralImageExtensions.SetModifierType<UniformModifier>(modifierType).Radius = fontSize / 4f;
emojiRow.background = (Image)(object)modifierType;
((Graphic)emojiRow.background).color = Color.clear;
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.minHeight = height;
val2.preferredHeight = height;
float num = height - 4f;
GameObject val3 = new GameObject("IconCell", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(val.transform, false);
RectTransform val4 = (RectTransform)val3.transform;
val4.anchorMin = new Vector2(0f, 0f);
val4.anchorMax = new Vector2(0f, 1f);
val4.pivot = new Vector2(0f, 0.5f);
val4.offsetMin = new Vector2(6f, 2f);
val4.offsetMax = new Vector2(6f + num, -2f);
GameObject val5 = new GameObject("Icon", new Type[1] { typeof(RectTransform) });
val5.transform.SetParent(val3.transform, false);
emojiRow.icon = val5.AddComponent<RawImage>();
((Graphic)emojiRow.icon).raycastTarget = false;
emojiRow.aspect = val5.AddComponent<AspectRatioFitter>();
emojiRow.aspect.aspectMode = (AspectMode)3;
GameObject val6 = new GameObject("Label", new Type[1] { typeof(RectTransform) });
val6.transform.SetParent(val.transform, false);
TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
if ((Object)(object)GUIManagerPatch.darumaDropOneFont != (Object)null)
{
((TMP_Text)val7).font = GUIManagerPatch.darumaDropOneFont;
}
((TMP_Text)val7).fontSize = fontSize * 0.8f;
((Graphic)val7).color = textColor;
((Graphic)val7).raycastTarget = false;
((TMP_Text)val7).horizontalAlignment = (HorizontalAlignmentOptions)1;
((TMP_Text)val7).verticalAlignment = (VerticalAlignmentOptions)512;
((TMP_Text)val7).textWrappingMode = (TextWrappingModes)1;
((TMP_Text)val7).overflowMode = (TextOverflowModes)1;
RectTransform val8 = (RectTransform)val6.transform;
val8.anchorMin = new Vector2(0f, 0f);
val8.anchorMax = new Vector2(1f, 1f);
val8.offsetMin = new Vector2(6f + num + 10f, 0f);
val8.offsetMax = new Vector2(-6f, 0f);
emojiRow.label = (TMP_Text)(object)val7;
return emojiRow;
}
public void Show(string name, TMP_SpriteAsset asset, bool highlighted)
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
((Component)this).gameObject.SetActive(true);
Texture spriteSheet = asset.spriteSheet;
icon.texture = spriteSheet;
if ((Object)(object)spriteSheet != (Object)null && spriteSheet.height > 0)
{
aspect.aspectRatio = (float)spriteSheet.width / (float)spriteSheet.height;
}
label.text = ":" + name + ":";
label.ForceMeshUpdate(false, false);
((Graphic)background).color = (highlighted ? selectedColor : Color.clear);
}
public void Hide()
{
((Component)this).gameObject.SetActive(false);
}
public void OnPointerDown(PointerEventData eventData)
{
picker.Accept(index, refocus: true);
}
public void OnPointerEnter(PointerEventData eventData)
{
picker.Hover(index);
}
}
private const int MaxRows = 8;
private TextChatDisplay display;
private TMP_InputField input;
private RectTransform panel;
private readonly List<EmojiRow> rows = new List<EmojiRow>();
private readonly List<string> matches = new List<string>();
private bool dirty;
private bool open;
private int selected;
private int tokenStart;
private int tokenEnd;
private string lastText = "";
private static T Read<T>(object owner, string field)
{
return (T)AccessTools.Field(typeof(TextChatDisplay), field).GetValue(owner);
}
public void Init(TextChatDisplay owner)
{
//IL_0068: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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_00fc: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Expected O, but got Unknown
//IL_0254: 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_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Expected O, but got Unknown
display = owner;
input = Read<TMP_InputField>(owner, "inputField");
RectTransform val = Read<RectTransform>(owner, "baseTransform");
float num = Read<float>(owner, "fontSize");
Color val2 = (((Object)(object)((Selectable)input).targetGraphic != (Object)null) ? ((Selectable)input).targetGraphic.color : Read<Color>(owner, "offWhite"));
Color textColor = (((Object)(object)input.textComponent != (Object)null) ? ((Graphic)input.textComponent).color : Color.black);
textColor.a = 1f;
float height = num * 1.3f;
Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>();
if ((Object)(object)componentInParent != (Object)null && (Object)(object)((Component)componentInParent).GetComponent<GraphicRaycaster>() == (Object)null)
{
((Component)componentInParent).gameObject.AddComponent<GraphicRaycaster>();
}
GameObject val3 = new GameObject("EmojiPicker", new Type[1] { typeof(RectTransform) });
panel = (RectTransform)val3.transform;
((Transform)panel).SetParent((Transform)(object)val, false);
panel.anchorMin = new Vector2(0f, 0f);
panel.anchorMax = new Vector2(1f, 0f);
panel.pivot = new Vector2(0.5f, 0f);
panel.anchoredPosition = new Vector2(0f, num * 1.75f + 4f);
panel.sizeDelta = new Vector2(-10f, 0f);
ProceduralImage val4 = val3.AddComponent<ProceduralImage>();
((Graphic)val4).color = val2;
ProceduralImageExtensions.SetModifierType<UniformModifier>(val4).Radius = num / 4f;
Canvas val5 = val3.AddComponent<Canvas>();
val5.overrideSorting = true;
val5.sortingOrder = 100;
val3.AddComponent<GraphicRaycaster>();
VerticalLayoutGroup val6 = val3.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val6).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false;
((LayoutGroup)val6).padding = new RectOffset(4, 4, 4, 4);
ContentSizeFitter val7 = val3.AddComponent<ContentSizeFitter>();
val7.verticalFit = (FitMode)2;
val7.horizontalFit = (FitMode)0;
for (int i = 0; i < 8; i++)
{
rows.Add(EmojiRow.Create(this, i, (Transform)(object)panel, height, num, textColor, val2));
}
val3.SetActive(false);
OnValidateInput previous = input.onValidateInput;
input.onValidateInput = (OnValidateInput)delegate(string text, int index, char c)
{
if (c == '\t')
{
return '\0';
}
return (previous == null) ? c : previous.Invoke(text, index, c);
};
((UnityEvent<string>)(object)input.onValueChanged).AddListener((UnityAction<string>)delegate
{
dirty = true;
});
}
private static bool IsNameChar(char c)
{
if (!char.IsLetterOrDigit(c) && c != '_' && c != '-')
{
return c == '~';
}
return true;
}
private void Refresh()
{
dirty = false;
string text = (lastText = input.text ?? "");
int num = Mathf.Clamp(input.caretPosition, 0, text.Length);
int num2 = -1;
for (int num3 = num - 1; num3 >= 0; num3--)
{
char c = text[num3];
if (c == ':')
{
num2 = num3;
break;
}
if (!IsNameChar(c))
{
break;
}
}
if (num2 < 0 || (num2 > 0 && char.IsLetterOrDigit(text[num2 - 1])))
{
Hide();
return;
}
string query = text.Substring(num2 + 1, num - num2 - 1);
matches.Clear();
matches.AddRange((from k in Plugin.EmojiAssets.Keys
where k.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0
orderby (!k.StartsWith(query, StringComparison.OrdinalIgnoreCase)) ? 1 : 0
select k).ThenBy<string, string>((string k) => k, StringComparer.OrdinalIgnoreCase).Take(8));
if (matches.Count == 0)
{
Hide();
return;
}
tokenStart = num2;
tokenEnd = num;
selected = 0;
open = true;
((Component)panel).gameObject.SetActive(true);
UpdateRows();
}
private void UpdateRows()
{
for (int i = 0; i < rows.Count; i++)
{
if (i < matches.Count)
{
rows[i].Show(matches[i], Plugin.EmojiAssets[matches[i]], i == selected);
}
else
{
rows[i].Hide();
}
}
}
private void Hide()
{
open = false;
if ((Object)(object)panel != (Object)null)
{
((Component)panel).gameObject.SetActive(false);
}
}
public void Hover(int index)
{
if (open && index != selected && index < matches.Count)
{
selected = index;
UpdateRows();
}
}
public void Accept(int index, bool refocus)
{
if (!open || index < 0 || index >= matches.Count)
{
return;
}
string text = input.text ?? "";
if (!(text != lastText) && tokenEnd <= text.Length)
{
string text2 = text.Substring(tokenEnd);
bool flag = text2.StartsWith(" ");
string text3 = ":" + matches[index] + ":" + (flag ? "" : " ");
int num = tokenStart + text3.Length + (flag ? 1 : 0);
input.SetTextWithoutNotify(text.Substring(0, tokenStart) + text3 + text2);
input.caretPosition = num;
lastText = input.text;
Hide();
if (refocus)
{
display.isBlockingInput = true;
EventSystem.current.SetSelectedGameObject(((Component)input).gameObject);
input.ActivateInputField();
}
((MonoBehaviour)this).StartCoroutine(SetCaretNextFrame(num));
}
}
private IEnumerator SetCaretNextFrame(int caret)
{
yield return null;
if ((Object)(object)input != (Object)null)
{
input.caretPosition = caret;
}
}
private void Update()
{
if ((Object)(object)input == (Object)null)
{
return;
}
if (dirty)
{
Refresh();
}
if (open)
{
if (!display.isBlockingInput)
{
Hide();
}
else if (Input.GetKeyDown((KeyCode)274))
{
selected = (selected + 1) % matches.Count;
UpdateRows();
}
else if (Input.GetKeyDown((KeyCode)273))
{
selected = (selected - 1 + matches.Count) % matches.Count;
UpdateRows();
}
else if (Input.GetKeyDown((KeyCode)9))
{
Accept(selected, refocus: false);
}
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.atomic.peakchatemojis", "PEAKChatEmojis", "0.1.1")]
public class Plugin : BaseUnityPlugin
{
internal static readonly Dictionary<string, TMP_SpriteAsset> EmojiAssets = new Dictionary<string, TMP_SpriteAsset>();
internal static TMP_SpriteAsset PrimarySpriteAsset;
private const float EmojiSize = 1f;
private const float BaselineRatio = 0.8f;
public const string Id = "com.atomic.peakchatemojis";
internal static ManualLogSource Log { get; private set; } = null;
public static string Name => "PEAKChatEmojis";
public static string Version => "0.1.1";
private void Awake()
{
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
string[] directories = Directory.GetDirectories(Paths.PluginPath, "Emojis", SearchOption.AllDirectories);
foreach (string path in directories)
{
string[] files = Directory.GetFiles(path);
foreach (string path2 in files)
{
switch (Path.GetExtension(path2).ToLowerInvariant())
{
case ".png":
case ".jpg":
case ".jpeg":
Register(path2);
break;
}
}
}
if (EmojiAssets.Count > 0)
{
PrimarySpriteAsset = EmojiAssets.Values.First();
PrimarySpriteAsset.fallbackSpriteAssets = EmojiAssets.Values.Skip(1).ToList();
}
new Harmony("com.atomic.peakchatemojis").PatchAll();
Log.LogInfo((object)$"Loaded {EmojiAssets.Count} emojis");
}
private static void Register(string path)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00aa: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00ec: 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_0117: 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_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
try
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
if (!EmojiAssets.ContainsKey(fileNameWithoutExtension))
{
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true);
if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path)))
{
Log.LogError((object)("Failed to load " + path));
return;
}
((Texture)val).filterMode = (FilterMode)2;
((Texture)val).wrapMode = (TextureWrapMode)1;
Shader val2 = Shader.Find("TextMeshPro/Sprite") ?? Shader.Find("UI/Default");
TMP_SpriteAsset val3 = ScriptableObject.CreateInstance<TMP_SpriteAsset>();
((Object)val3).name = "Emoji_" + fileNameWithoutExtension;
val3.spriteSheet = (Texture)(object)val;
((TMP_Asset)val3).material = new Material(val2)
{
mainTexture = (Texture)(object)val
};
val3.spriteInfoList = new List<TMP_Sprite>
{
new TMP_Sprite
{
id = 0,
name = fileNameWithoutExtension,
hashCode = TMP_TextUtilities.GetSimpleHashCode(fileNameWithoutExtension),
x = 0f,
y = 0f,
width = ((Texture)val).width,
height = ((Texture)val).height,
xOffset = 0f,
yOffset = (float)((Texture)val).height * 0.8f,
xAdvance = ((Texture)val).width,
scale = 1f,
pivot = new Vector2(0f, 0f)
}
};
val3.UpdateLookupTables();
EmojiAssets.Add(fileNameWithoutExtension, val3);
}
}
catch (Exception arg)
{
Log.LogError((object)$"Error registering {path}: {arg}");
}
}
}
[HarmonyPatch]
public static class ChatPatches
{
private static readonly Regex EmojiIdentifier = new Regex(":([a-zA-Z0-9_\\-~]+):", RegexOptions.Compiled);
private static readonly Regex SpriteTag = new Regex("<sprite name=\"[^\"]*\">", RegexOptions.Compiled);
private static readonly FieldInfo ViewportField = AccessTools.Field(typeof(TextChatDisplay), "chatLogViewportTransform");
private static readonly FieldInfo BoxSizeField = AccessTools.Field(typeof(TextChatDisplay), "boxSize");
[HarmonyPostfix]
[HarmonyPatch(typeof(TextChatDisplay), "Start")]
public static void StartPostfix(TextChatDisplay __instance)
{
if (Plugin.EmojiAssets.Count != 0 && !(bool)AccessTools.Field(typeof(TextChatDisplay), "usingIMGUI").GetValue(__instance))
{
((Component)__instance).gameObject.AddComponent<EmojiPicker>().Init(__instance);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(TextChatDisplay), "CreateText")]
public static void CreateTextPostfix(TMP_Text __result)
{
if ((Object)(object)__result != (Object)null && (Object)(object)Plugin.PrimarySpriteAsset != (Object)null)
{
__result.spriteAsset = Plugin.PrimarySpriteAsset;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TextChatDisplay), "AddMessage", new Type[] { typeof(string) })]
public static void AddMessagePrefix(ref string message)
{
if (!string.IsNullOrEmpty(message) && !((Object)(object)Plugin.PrimarySpriteAsset == (Object)null))
{
message = EmojiIdentifier.Replace(message, (Match m) => (!Plugin.EmojiAssets.ContainsKey(m.Groups[1].Value)) ? m.Value : ("<sprite name=\"" + m.Groups[1].Value + "\">"));
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(TextChatDisplay), "AddMessage", new Type[] { typeof(string) })]
public static void AddMessagePostfix(TextChatDisplay __instance)
{
//IL_0076: 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_0096: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
try
{
object? value = ViewportField.GetValue(__instance);
RectTransform val = (RectTransform)((value is RectTransform) ? value : null);
if (!((Object)(object)val == (Object)null) && ((Transform)val).childCount != 0)
{
Transform child = ((Transform)val).GetChild(((Transform)val).childCount - 1);
RectTransform val2 = (RectTransform)(object)((child is RectTransform) ? child : null);
TMP_Text val3 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<TMP_Text>() : null);
if (!((Object)(object)val3 == (Object)null) && val3.text.Contains("<sprite"))
{
Vector2 val4 = (Vector2)BoxSizeField.GetValue(__instance);
string text = SpriteTag.Replace(val3.text, "W");
float y = val3.GetPreferredValues(text, val4.x - 24f, 1000f).y;
val2.sizeDelta = new Vector2(0f, y);
}
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}