using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnboundLib.GameModes;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CooldownUI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("CooldownUI")]
[assembly: AssemblyTitle("CooldownUI")]
[assembly: AssemblyVersion("1.0.1.0")]
[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 CooldownUILib
{
public enum IconPosition
{
Left,
Right
}
public enum IconType
{
None,
Text,
Sprite
}
public class CooldownUI : MonoBehaviour
{
private TextMeshPro mainText;
private GameObject textContainer;
private GameObject iconTextObject;
private TextMeshPro iconTextComponent;
private GameObject iconSpriteObject;
private SpriteRenderer iconSpriteRenderer;
private IconType currentIconType = IconType.None;
private string currentIconText = "";
private Sprite currentIconSprite = null;
private Color iconColor = Color.white;
private IconPosition iconPosition = IconPosition.Left;
private bool syncIconColor = false;
private bool hideIconOnReady = false;
private float iconScale = 1f;
private bool isShowingReady = false;
private const float BODY_RADIUS = 0.8f;
private const float GAP_FROM_BODY = 0.2f;
private const float STACK_OFFSET_Y = 0.6f;
private const float TMP_FONT_SIZE = 5f;
private const float ICON_TEXT_FONT_SIZE = 5f;
private const float ICON_GAP = 0.25f;
private const float CHAR_WIDTH_APPROX = 0.065f;
private const float SPRITE_BASE_SIZE = 0.4f;
private const float OUTLINE_WIDTH = 0.5f;
private const float TEXT_Z = 0f;
private const float ICON_Z = 0f;
private Color cooldownColor = new Color(0.8f, 0f, 0f);
private Color readyColor = new Color(0f, 0.8f, 0.2f);
private Color activeColor = new Color(0f, 0.6f, 1f);
private Color outlineColor = new Color(0f, 0f, 0f, 1f);
private Transform parentTransform;
private float lastParentScale = 1f;
private float customScaleMultiplier = 1f;
private static Dictionary<Transform, List<CooldownUI>> activeUIsByTarget = new Dictionary<Transform, List<CooldownUI>>();
private Transform registeredTarget;
private int visibleStackIndex = 0;
private bool isCurrentlyVisible = false;
private string lastDisplayedText = "";
private float lastCalculatedTextWidth = 0f;
private bool fontConfigured = false;
public static CooldownUI Create(Transform parent, float customScale = 1f)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if ((Object)(object)parent == (Object)null)
{
Debug.LogError("[CooldownUI] Cannot create UI with null parent");
return null;
}
GameObject val = new GameObject("CooldownUI");
val.transform.SetParent(parent);
CooldownUI cooldownUI = val.AddComponent<CooldownUI>();
cooldownUI.parentTransform = parent;
cooldownUI.registeredTarget = parent;
cooldownUI.customScaleMultiplier = customScale;
cooldownUI.UpdateScaleCompensation();
cooldownUI.RegisterUI(parent);
return cooldownUI;
}
private void Awake()
{
CreateVisuals();
}
private void LateUpdate()
{
UpdateScaleCompensation();
}
private void OnDestroy()
{
UnregisterUI();
CleanupComponents();
}
private void CreateVisuals()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0033: 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_005f: Unknown result type (might be due to invalid IL or missing references)
textContainer = new GameObject("TextContainer");
textContainer.transform.SetParent(((Component)this).transform);
textContainer.transform.localPosition = Vector3.zero;
textContainer.transform.localRotation = Quaternion.identity;
textContainer.transform.localScale = Vector3.one;
mainText = textContainer.AddComponent<TextMeshPro>();
ConfigureTextMeshPro(mainText, 5f);
CreateTextIcon();
CreateSpriteIcon();
((Component)this).gameObject.SetActive(false);
}
private void ConfigureTextMeshPro(TextMeshPro tmp, float fontSize)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)tmp).fontSize = fontSize;
((TMP_Text)tmp).alignment = (TextAlignmentOptions)514;
((TMP_Text)tmp).fontStyle = (FontStyles)1;
((Graphic)tmp).color = readyColor;
((TMP_Text)tmp).outlineWidth = 0.5f;
((TMP_Text)tmp).outlineColor = Color32.op_Implicit(outlineColor);
tmp.sortingLayerID = SortingLayer.NameToID("MostFront");
tmp.sortingOrder = 200;
((Graphic)tmp).raycastTarget = false;
ApplySymbolsFontFallback(tmp);
}
private void ApplySymbolsFontFallback(TextMeshPro tmp)
{
if ((Object)(object)tmp == (Object)null || fontConfigured)
{
return;
}
TMP_FontAsset symbolsFont = CooldownUIPlugin.SymbolsFont;
if ((Object)(object)symbolsFont == (Object)null)
{
return;
}
if ((Object)(object)((TMP_Text)tmp).font != (Object)null && ((TMP_Text)tmp).font.fallbackFontAssetTable != null)
{
if (!((TMP_Text)tmp).font.fallbackFontAssetTable.Contains(symbolsFont))
{
((TMP_Text)tmp).font.fallbackFontAssetTable.Add(symbolsFont);
}
}
else
{
((TMP_Text)tmp).font = symbolsFont;
}
fontConfigured = true;
}
private void CreateTextIcon()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0033: 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_005f: 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)
iconTextObject = new GameObject("IconText");
iconTextObject.transform.SetParent(((Component)this).transform);
iconTextObject.transform.localPosition = Vector3.zero;
iconTextObject.transform.localRotation = Quaternion.identity;
iconTextObject.transform.localScale = Vector3.one;
iconTextComponent = iconTextObject.AddComponent<TextMeshPro>();
ConfigureTextMeshPro(iconTextComponent, 5f);
((Graphic)iconTextComponent).color = iconColor;
iconTextObject.SetActive(false);
}
private void CreateSpriteIcon()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0033: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
iconSpriteObject = new GameObject("IconSprite");
iconSpriteObject.transform.SetParent(((Component)this).transform);
iconSpriteObject.transform.localPosition = Vector3.zero;
iconSpriteObject.transform.localRotation = Quaternion.identity;
iconSpriteObject.transform.localScale = Vector3.one * 0.4f;
iconSpriteRenderer = iconSpriteObject.AddComponent<SpriteRenderer>();
((Renderer)iconSpriteRenderer).sortingLayerName = "MostFront";
((Renderer)iconSpriteRenderer).sortingOrder = 200;
iconSpriteRenderer.color = iconColor;
iconSpriteObject.SetActive(false);
}
private void CleanupComponents()
{
if ((Object)(object)textContainer != (Object)null)
{
Object.Destroy((Object)(object)textContainer);
}
if ((Object)(object)iconTextObject != (Object)null)
{
Object.Destroy((Object)(object)iconTextObject);
}
if ((Object)(object)iconSpriteObject != (Object)null)
{
Object.Destroy((Object)(object)iconSpriteObject);
}
}
private void UpdateScaleCompensation()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)parentTransform == (Object)null)
{
return;
}
float num = Mathf.Max(parentTransform.lossyScale.x, parentTransform.lossyScale.y);
if (num < 0.01f)
{
num = 1f;
}
if (Mathf.Abs(num - lastParentScale) > 0.001f)
{
lastParentScale = num;
float num2 = customScaleMultiplier / num;
((Component)this).transform.localScale = Vector3.one * num2;
if (isCurrentlyVisible)
{
ApplyPosition();
}
}
}
private void RegisterUI(Transform target)
{
if (!((Object)(object)target == (Object)null))
{
if (!activeUIsByTarget.ContainsKey(target))
{
activeUIsByTarget[target] = new List<CooldownUI>();
}
List<CooldownUI> list = activeUIsByTarget[target];
if (!list.Contains(this))
{
list.Add(this);
}
}
}
private void UnregisterUI()
{
if (!((Object)(object)registeredTarget == (Object)null) && activeUIsByTarget.ContainsKey(registeredTarget))
{
activeUIsByTarget[registeredTarget].Remove(this);
if (activeUIsByTarget[registeredTarget].Count == 0)
{
activeUIsByTarget.Remove(registeredTarget);
}
else
{
RecalculateVisiblePositions(registeredTarget);
}
}
}
private static void RecalculateVisiblePositions(Transform target)
{
if ((Object)(object)target == (Object)null || !activeUIsByTarget.ContainsKey(target))
{
return;
}
List<CooldownUI> list = activeUIsByTarget[target];
list.RemoveAll((CooldownUI ui) => (Object)(object)ui == (Object)null);
if (list.Count == 0)
{
activeUIsByTarget.Remove(target);
return;
}
int num = 0;
for (int i = 0; i < list.Count; i++)
{
CooldownUI cooldownUI = list[i];
if (!((Object)(object)cooldownUI == (Object)null) && cooldownUI.isCurrentlyVisible)
{
cooldownUI.visibleStackIndex = num;
cooldownUI.ApplyPosition();
num++;
}
}
}
private void ApplyPosition()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
float num = ((lastParentScale > 0.01f) ? (1f / lastParentScale) : 1f);
float num2 = -0.8f - (0.2f + (float)visibleStackIndex * 0.6f) * num;
((Component)this).transform.localPosition = new Vector3(0f, num2, 0f);
UpdateSortingOrder();
}
private void UpdateSortingOrder()
{
int sortingOrder = 200 + visibleStackIndex * 2;
if ((Object)(object)mainText != (Object)null)
{
mainText.sortingOrder = sortingOrder;
}
if ((Object)(object)iconTextComponent != (Object)null)
{
iconTextComponent.sortingOrder = sortingOrder;
}
if ((Object)(object)iconSpriteRenderer != (Object)null)
{
((Renderer)iconSpriteRenderer).sortingOrder = sortingOrder;
}
}
public void ShowCooldown(float remaining, float total)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_0065: Unknown result type (might be due to invalid IL or missing references)
isShowingReady = false;
SetVisible(visible: true);
string text = FormatTime(remaining);
SetMainText(text);
float num = ((total > 0f) ? (1f - remaining / total) : 1f);
Color color = Color.Lerp(cooldownColor, readyColor, num);
((Graphic)mainText).color = color;
if (syncIconColor)
{
ApplyIconColor(color);
}
UpdateIconPosition();
UpdateIconVisibility();
}
public void ShowActive(float remaining)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
isShowingReady = false;
SetVisible(visible: true);
string text = FormatTime(remaining);
SetMainText(text);
((Graphic)mainText).color = activeColor;
if (syncIconColor)
{
ApplyIconColor(activeColor);
}
UpdateIconPosition();
UpdateIconVisibility();
}
public void ShowText(string text, Color color)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
isShowingReady = false;
SetVisible(visible: true);
SetMainText(text);
((Graphic)mainText).color = color;
if (syncIconColor)
{
ApplyIconColor(color);
}
UpdateIconPosition();
UpdateIconVisibility();
}
public void ShowReady()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
isShowingReady = true;
SetVisible(visible: true);
SetMainText("READY");
((Graphic)mainText).color = readyColor;
if (syncIconColor)
{
ApplyIconColor(readyColor);
}
UpdateIconPosition();
UpdateIconVisibility();
}
public void ShowStacks(int count, Color? color = null)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
Color color2 = (Color)(((??)color) ?? Color.white);
ShowText($"x{count}", color2);
}
public void Hide()
{
isShowingReady = false;
HideAllIcons();
SetVisible(visible: false);
}
public void SetIcon(string icon, Color? color = null)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
if (currentIconType == IconType.Sprite)
{
ClearSpriteIconInternal();
}
currentIconText = icon ?? "";
iconColor = (Color)(((??)color) ?? Color.white);
if (string.IsNullOrEmpty(currentIconText))
{
currentIconType = IconType.None;
if ((Object)(object)iconTextObject != (Object)null)
{
iconTextObject.SetActive(false);
}
}
else
{
currentIconType = IconType.Text;
if ((Object)(object)iconTextComponent != (Object)null)
{
((TMP_Text)iconTextComponent).text = currentIconText;
if (!syncIconColor)
{
((Graphic)iconTextComponent).color = iconColor;
}
else if ((Object)(object)mainText != (Object)null)
{
((Graphic)iconTextComponent).color = ((Graphic)mainText).color;
}
}
ApplyIconScale();
UpdateIconPosition();
}
UpdateIconVisibility();
}
public void ClearIcon()
{
currentIconType = IconType.None;
currentIconText = "";
currentIconSprite = null;
if ((Object)(object)iconTextObject != (Object)null)
{
iconTextObject.SetActive(false);
}
if ((Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.SetActive(false);
}
}
public void SetIconSprite(Sprite sprite, Color? color = null)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
if (currentIconType == IconType.Text)
{
ClearTextIconInternal();
}
currentIconSprite = sprite;
iconColor = (Color)(((??)color) ?? Color.white);
if ((Object)(object)sprite == (Object)null)
{
currentIconType = IconType.None;
if ((Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.SetActive(false);
}
}
else
{
currentIconType = IconType.Sprite;
if ((Object)(object)iconSpriteRenderer != (Object)null)
{
iconSpriteRenderer.sprite = sprite;
if (!syncIconColor)
{
iconSpriteRenderer.color = iconColor;
}
else if ((Object)(object)mainText != (Object)null)
{
iconSpriteRenderer.color = ((Graphic)mainText).color;
}
}
ApplyIconScale();
UpdateIconPosition();
}
UpdateIconVisibility();
}
public void ClearIconSprite()
{
if (currentIconType == IconType.Sprite)
{
ClearIcon();
}
}
private void ClearTextIconInternal()
{
currentIconText = "";
if ((Object)(object)iconTextObject != (Object)null)
{
iconTextObject.SetActive(false);
}
}
private void ClearSpriteIconInternal()
{
currentIconSprite = null;
if ((Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.SetActive(false);
}
}
public void SetIconPosition(IconPosition position)
{
iconPosition = position;
UpdateIconPosition();
}
public void SetIconColorSync(bool sync)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
syncIconColor = sync;
if (sync && (Object)(object)mainText != (Object)null)
{
ApplyIconColor(((Graphic)mainText).color);
}
else if (!sync)
{
ApplyIconColor(iconColor);
}
}
public void SetHideIconOnReady(bool hide)
{
hideIconOnReady = hide;
UpdateIconVisibility();
}
public void SetIconScale(float scale)
{
iconScale = Mathf.Clamp(scale, 0.1f, 3f);
ApplyIconScale();
UpdateIconPosition();
}
public IconType GetIconType()
{
return currentIconType;
}
public bool HasIcon()
{
return currentIconType != IconType.None;
}
private void ApplyIconScale()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007f: Unknown result type (might be due to invalid IL or missing references)
if (currentIconType == IconType.Text && (Object)(object)iconTextObject != (Object)null)
{
iconTextObject.transform.localScale = Vector3.one * iconScale;
}
else if (currentIconType == IconType.Sprite && (Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.transform.localScale = Vector3.one * 0.4f * iconScale;
}
}
private void ApplyIconColor(Color color)
{
//IL_0024: 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)
if (currentIconType == IconType.Text && (Object)(object)iconTextComponent != (Object)null)
{
((Graphic)iconTextComponent).color = color;
}
else if (currentIconType == IconType.Sprite && (Object)(object)iconSpriteRenderer != (Object)null)
{
iconSpriteRenderer.color = color;
}
}
private void UpdateIconPosition()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
if (currentIconType != 0 && !((Object)(object)mainText == (Object)null))
{
float num = CalculateTextWidth(lastDisplayedText) / 2f;
float iconHalfSize = GetIconHalfSize();
float num2 = num + 0.25f + iconHalfSize;
Vector3 localPosition = default(Vector3);
if (iconPosition == IconPosition.Left)
{
((Vector3)(ref localPosition))..ctor(0f - num2, 0f, 0f);
}
else
{
((Vector3)(ref localPosition))..ctor(num2, 0f, 0f);
}
if (currentIconType == IconType.Text && (Object)(object)iconTextObject != (Object)null)
{
iconTextObject.transform.localPosition = localPosition;
}
else if (currentIconType == IconType.Sprite && (Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.transform.localPosition = localPosition;
}
}
}
private float GetIconHalfSize()
{
if (currentIconType == IconType.Text)
{
return 0.065f * iconScale;
}
if (currentIconType == IconType.Sprite && (Object)(object)currentIconSprite != (Object)null)
{
return 0.4f * iconScale / 2f;
}
return 0f;
}
private void UpdateIconVisibility()
{
bool flag = currentIconType != 0 && ((Component)this).gameObject.activeSelf && (!hideIconOnReady || !isShowingReady);
if ((Object)(object)iconTextObject != (Object)null)
{
iconTextObject.SetActive(flag && currentIconType == IconType.Text);
}
if ((Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.SetActive(flag && currentIconType == IconType.Sprite);
}
}
private void HideAllIcons()
{
if ((Object)(object)iconTextObject != (Object)null)
{
iconTextObject.SetActive(false);
}
if ((Object)(object)iconSpriteObject != (Object)null)
{
iconSpriteObject.SetActive(false);
}
}
public void SetColors(Color ready, Color cooldown, Color active)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//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)
readyColor = ready;
cooldownColor = cooldown;
activeColor = active;
}
public void SetOutlineColor(Color color)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_0025: 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)
outlineColor = color;
if ((Object)(object)mainText != (Object)null)
{
((TMP_Text)mainText).outlineColor = Color32.op_Implicit(outlineColor);
}
if ((Object)(object)iconTextComponent != (Object)null)
{
((TMP_Text)iconTextComponent).outlineColor = Color32.op_Implicit(outlineColor);
}
}
public void SetOutlineWidth(float width)
{
float outlineWidth = Mathf.Clamp01(width);
if ((Object)(object)mainText != (Object)null)
{
((TMP_Text)mainText).outlineWidth = outlineWidth;
}
if ((Object)(object)iconTextComponent != (Object)null)
{
((TMP_Text)iconTextComponent).outlineWidth = outlineWidth;
}
}
public void SetShadowColor(Color color)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
SetOutlineColor(color);
}
public void SetFont(TMP_FontAsset font)
{
if ((Object)(object)mainText != (Object)null)
{
((TMP_Text)mainText).font = font;
}
if ((Object)(object)iconTextComponent != (Object)null)
{
((TMP_Text)iconTextComponent).font = font;
}
if ((Object)(object)font != (Object)null)
{
fontConfigured = false;
ApplySymbolsFontFallback(mainText);
ApplySymbolsFontFallback(iconTextComponent);
}
}
public void AddFallbackFont(TMP_FontAsset fallbackFont)
{
if (!((Object)(object)fallbackFont == (Object)null))
{
AddFallbackToTextMesh(mainText, fallbackFont);
AddFallbackToTextMesh(iconTextComponent, fallbackFont);
}
}
private void AddFallbackToTextMesh(TextMeshPro tmp, TMP_FontAsset fallbackFont)
{
if (!((Object)(object)tmp == (Object)null) && !((Object)(object)((TMP_Text)tmp).font == (Object)null) && ((TMP_Text)tmp).font.fallbackFontAssetTable != null && !((TMP_Text)tmp).font.fallbackFontAssetTable.Contains(fallbackFont))
{
((TMP_Text)tmp).font.fallbackFontAssetTable.Add(fallbackFont);
}
}
private string FormatTime(float seconds)
{
if (seconds < 0f)
{
seconds = 0f;
}
if (seconds >= 10f)
{
return seconds.ToString("F0", CultureInfo.InvariantCulture);
}
if (seconds >= 3f)
{
return seconds.ToString("F0", CultureInfo.InvariantCulture);
}
return seconds.ToString("F1", CultureInfo.InvariantCulture);
}
private void SetMainText(string text)
{
if (!((Object)(object)mainText == (Object)null))
{
lastDisplayedText = text;
((TMP_Text)mainText).text = text;
lastCalculatedTextWidth = CalculateTextWidth(text);
}
}
private float CalculateTextWidth(string text)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0079: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrEmpty(text))
{
return 0f;
}
if ((Object)(object)mainText != (Object)null && ((TMP_Text)mainText).textInfo != null && ((TMP_Text)mainText).textInfo.characterCount > 0)
{
((TMP_Text)mainText).ForceMeshUpdate();
Vector2 renderedValues = ((TMP_Text)mainText).GetRenderedValues(false);
if (renderedValues.x > 0.01f)
{
return renderedValues.x;
}
}
return (float)text.Length * 0.065f * 1f;
}
private void SetVisible(bool visible)
{
if (isCurrentlyVisible != visible)
{
isCurrentlyVisible = visible;
((Component)this).gameObject.SetActive(visible);
if (visible)
{
EnsureRegistered();
lastParentScale = 0f;
UpdateScaleCompensation();
}
RecalculateVisiblePositions(registeredTarget);
}
}
private void EnsureRegistered()
{
if (!((Object)(object)registeredTarget == (Object)null))
{
if (!activeUIsByTarget.ContainsKey(registeredTarget))
{
activeUIsByTarget[registeredTarget] = new List<CooldownUI>();
}
List<CooldownUI> list = activeUIsByTarget[registeredTarget];
if (!list.Contains(this))
{
list.Add(this);
}
}
}
public static void ClearAllRegistrations()
{
activeUIsByTarget.Clear();
}
public static int GetActiveUICount(Transform target)
{
if ((Object)(object)target == (Object)null)
{
return 0;
}
if (!activeUIsByTarget.ContainsKey(target))
{
return 0;
}
return activeUIsByTarget[target].Count;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.rounds.cooldownui", "CooldownUI", "1.0.1")]
[BepInProcess("Rounds.exe")]
public class CooldownUIPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <ClearRegistrations>d__34 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CooldownUIPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ClearRegistrations>d__34(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
CooldownUI.ClearAllRegistrations();
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public const string ModId = "com.rounds.cooldownui";
public const string ModName = "CooldownUI";
public const string Version = "1.0.1";
private static CooldownUIPlugin instance;
private AssetBundle loadedBundle;
public static CooldownUIPlugin Instance => instance;
public static TMP_FontAsset SymbolsFont { get; private set; }
public static bool SymbolsFontLoaded => (Object)(object)SymbolsFont != (Object)null;
public static FontGlyphExtractor.ExtractionResult ExtractedGlyphs { get; private set; }
private void Awake()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
instance = this;
LoadAssets();
Harmony val = new Harmony("com.rounds.cooldownui");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"CooldownUI v1.0.1 loaded!");
}
private void LogFontInfo()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"=== Symbol Font Info ===");
((BaseUnityPlugin)this).Logger.LogInfo((object)("Font name: " + ((Object)SymbolsFont).name));
if ((Object)(object)SymbolsFont.atlasTexture != (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Atlas size: {((Texture)SymbolsFont.atlasTexture).width}x{((Texture)SymbolsFont.atlasTexture).height}");
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Use F8 in game to visually test all symbols");
((BaseUnityPlugin)this).Logger.LogInfo((object)"========================");
}
private void Start()
{
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => ClearRegistrations()));
GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => ClearRegistrations()));
}
private void Update()
{
}
private void OnDestroy()
{
UnloadAssets();
}
private void LoadAssets()
{
if (!LoadFromEmbeddedResource())
{
LoadFromFile();
}
}
private bool LoadFromEmbeddedResource()
{
try
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
string text = null;
string[] array = manifestResourceNames;
foreach (string text2 in array)
{
if (text2.EndsWith("cooldownui_assets") || text2.EndsWith("cooldownui_assets.bytes") || text2.Contains("cooldownui_assets"))
{
text = text2;
break;
}
}
if (text == null)
{
return false;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading AssetBundle from embedded resource: " + text));
using Stream stream = executingAssembly.GetManifestResourceStream(text);
if (stream == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not open embedded resource stream");
return false;
}
byte[] array2 = new byte[stream.Length];
stream.Read(array2, 0, array2.Length);
loadedBundle = AssetBundle.LoadFromMemory(array2);
if ((Object)(object)loadedBundle == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load AssetBundle from memory");
return false;
}
return LoadFontFromBundle();
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Error loading embedded resource: " + ex.Message));
return false;
}
}
private void LoadFromFile()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string[] array = new string[2] { "cooldownui_assets", "cooldownui_assets.bundle" };
string text = null;
string[] array2 = array;
foreach (string path in array2)
{
string text2 = Path.Combine(directoryName, path);
if (File.Exists(text2))
{
text = text2;
break;
}
}
if (text == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Asset bundle not found. Extended symbols will not be available.");
((BaseUnityPlugin)this).Logger.LogWarning((object)("Expected location: " + directoryName));
return;
}
try
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading AssetBundle from file: " + text));
loadedBundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)loadedBundle == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load AssetBundle from file");
}
else
{
LoadFontFromBundle();
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Error loading AssetBundle: " + ex.Message));
}
}
private bool LoadFontFromBundle()
{
if ((Object)(object)loadedBundle == (Object)null)
{
return false;
}
TMP_FontAsset[] array = loadedBundle.LoadAllAssets<TMP_FontAsset>();
if (array != null && array.Length != 0)
{
SymbolsFont = array[0];
((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded font: " + ((Object)SymbolsFont).name));
return true;
}
((BaseUnityPlugin)this).Logger.LogWarning((object)"No TMP_FontAsset found in AssetBundle");
LogBundleContents();
return false;
}
private void LogBundleContents()
{
if ((Object)(object)loadedBundle == (Object)null)
{
return;
}
try
{
string[] allAssetNames = loadedBundle.GetAllAssetNames();
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Bundle contains {allAssetNames.Length} assets:");
string[] array = allAssetNames;
foreach (string text in array)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)(" - " + text));
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Error listing bundle: " + ex.Message));
}
}
private void UnloadAssets()
{
if ((Object)(object)loadedBundle != (Object)null)
{
loadedBundle.Unload(true);
loadedBundle = null;
SymbolsFont = null;
}
}
private void ExtractGlyphsInternal(bool autoSave)
{
if ((Object)(object)SymbolsFont == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot extract glyphs: font not loaded");
return;
}
ExtractedGlyphs = FontGlyphExtractor.ExtractGlyphs(SymbolsFont);
if (ExtractedGlyphs == null)
{
return;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Extracted {ExtractedGlyphs.ValidGlyphs} valid glyphs from {((Object)SymbolsFont).name}");
foreach (KeyValuePair<string, List<string>> item in ExtractedGlyphs.GlyphsByCategory)
{
if (item.Value.Count > 0)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)$" {item.Key}: {item.Value.Count} glyphs");
}
}
}
public static void ExtractAndSaveGlyphs()
{
if ((Object)(object)instance == (Object)null)
{
Debug.LogError("[CooldownUI] Plugin instance not found");
return;
}
if ((Object)(object)SymbolsFont == (Object)null)
{
((BaseUnityPlugin)instance).Logger.LogWarning((object)"Cannot extract glyphs: font not loaded");
return;
}
ExtractedGlyphs = FontGlyphExtractor.ExtractGlyphs(SymbolsFont);
if (ExtractedGlyphs == null)
{
((BaseUnityPlugin)instance).Logger.LogError((object)"Glyph extraction failed");
return;
}
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "extracted_glyphs.json");
string text2 = Path.Combine(directoryName, "extracted_glyphs.cs");
FontGlyphExtractor.SaveToJson(ExtractedGlyphs, text);
FontGlyphExtractor.SaveAsCSharpCode(ExtractedGlyphs, text2);
((BaseUnityPlugin)instance).Logger.LogInfo((object)"Glyphs saved to:");
((BaseUnityPlugin)instance).Logger.LogInfo((object)(" JSON: " + text));
((BaseUnityPlugin)instance).Logger.LogInfo((object)(" C#: " + text2));
}
public static bool HasGlyph(char character)
{
if ((Object)(object)SymbolsFont == (Object)null)
{
return false;
}
return FontGlyphExtractor.HasValidGlyph(SymbolsFont, character);
}
public static bool HasGlyph(uint unicode)
{
if ((Object)(object)SymbolsFont == (Object)null)
{
return false;
}
return FontGlyphExtractor.HasValidGlyph(SymbolsFont, unicode);
}
public static string[] GetGlyphsForCategory(string category)
{
if (ExtractedGlyphs == null || ExtractedGlyphs.GlyphsByCategory == null)
{
return new string[0];
}
if (ExtractedGlyphs.GlyphsByCategory.TryGetValue(category, out var value))
{
return value.ToArray();
}
return new string[0];
}
public static string[] GetGlyphCategories()
{
if (ExtractedGlyphs == null || ExtractedGlyphs.GlyphsByCategory == null)
{
return new string[0];
}
List<string> list = new List<string>(ExtractedGlyphs.GlyphsByCategory.Keys);
list.Sort();
return list.ToArray();
}
[IteratorStateMachine(typeof(<ClearRegistrations>d__34))]
private IEnumerator ClearRegistrations()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ClearRegistrations>d__34(0)
{
<>4__this = this
};
}
public static void ShowSymbolTester()
{
SymbolTester.Show();
}
public static void HideSymbolTester()
{
SymbolTester.Hide();
}
public static void ToggleSymbolTester()
{
SymbolTester.Toggle();
}
public static Dictionary<string, string[]> GetSupportedSymbols()
{
if (ExtractedGlyphs != null && ExtractedGlyphs.GlyphsByCategory != null)
{
Dictionary<string, string[]> dictionary = new Dictionary<string, string[]>();
foreach (KeyValuePair<string, List<string>> item in ExtractedGlyphs.GlyphsByCategory)
{
dictionary[item.Key] = item.Value.ToArray();
}
return dictionary;
}
Dictionary<string, string[]> dictionary2 = new Dictionary<string, string[]>();
dictionary2.Add("Combat", new string[10] { "⚔", "⚒", "⚓", "☠", "⚙", "⚗", "⚖", "⛏", "⛓", "⛊" });
dictionary2.Add("Magic", new string[11]
{
"⚡", "❄", "☀", "☁", "☂", "☃", "✴", "❋", "☼", "☽",
"☾"
});
dictionary2.Add("Hearts", new string[7] { "❤", "♥", "♡", "❥", "❣", "❦", "❧" });
dictionary2.Add("Status", new string[12]
{
"✓", "✔", "✗", "✘", "⚠", "⛔", "❌", "❗", "❓", "☐",
"☑", "☒"
});
dictionary2.Add("Stars", new string[12]
{
"★", "☆", "✦", "✧", "✩", "✪", "✫", "✬", "✭", "✮",
"✯", "✰"
});
dictionary2.Add("Arrows", new string[12]
{
"←", "→", "↑", "↓", "⇐", "⇒", "➤", "⬅", "⬆", "⬇",
"↩", "↪"
});
dictionary2.Add("Shapes", new string[14]
{
"●", "○", "■", "□", "▲", "△", "▼", "▽", "◆", "◇",
"◐", "◑", "◔", "◕"
});
dictionary2.Add("Numbers", new string[15]
{
"①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩",
"❶", "❷", "❸", "❹", "❺"
});
dictionary2.Add("Cards", new string[8] { "♠", "♡", "♢", "♣", "♤", "♥", "♦", "♧" });
dictionary2.Add("Chess", new string[12]
{
"♔", "♕", "♖", "♗", "♘", "♙", "♚", "♛", "♜", "♝",
"♞", "♟"
});
dictionary2.Add("Music", new string[7] { "♩", "♪", "♫", "♬", "♭", "♮", "♯" });
dictionary2.Add("Zodiac", new string[12]
{
"♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑",
"♒", "♓"
});
dictionary2.Add("Math", new string[12]
{
"+", "−", "±", "×", "÷", "=", "≠", "≈", "∞", "√",
"∑", "∏"
});
dictionary2.Add("Progress", new string[7] { "░", "▒", "▓", "█", "⏱", "⌛", "⏳" });
dictionary2.Add("Misc", new string[11]
{
"☯", "☮", "⚛", "☢", "☣", "⚕", "⚜", "✠", "☦", "☪",
"☸"
});
return dictionary2;
}
}
public static class FontGlyphExtractor
{
public class ExtractionResult
{
public string FontName;
public int TotalGlyphs;
public int ValidGlyphs;
public Dictionary<string, List<string>> GlyphsByCategory;
public List<uint> AllUnicodePoints;
}
public static ExtractionResult ExtractGlyphs(TMP_FontAsset font)
{
if ((Object)(object)font == (Object)null)
{
Debug.LogError("[FontGlyphExtractor] Font is null");
return null;
}
ExtractionResult extractionResult = new ExtractionResult
{
FontName = ((Object)font).name,
GlyphsByCategory = new Dictionary<string, List<string>>(),
AllUnicodePoints = new List<uint>()
};
uint num = ((font.glyphTable == null || font.glyphTable.Count <= 0) ? uint.MaxValue : 0u);
if (font.characterLookupTable != null && font.characterLookupTable.TryGetValue(0u, out var value))
{
num = ((TMP_TextElement)value).glyphIndex;
}
int num2 = 0;
int num3 = 0;
if (font.characterLookupTable != null)
{
foreach (KeyValuePair<uint, TMP_Character> item2 in font.characterLookupTable)
{
uint key = item2.Key;
TMP_Character value2 = item2.Value;
num2++;
if (key >= 32 && (((TMP_TextElement)value2).glyphIndex != num || key == 0) && (font.glyphLookupTable == null || font.glyphLookupTable.ContainsKey(((TMP_TextElement)value2).glyphIndex)))
{
num3++;
extractionResult.AllUnicodePoints.Add(key);
string unicodeCategory = GetUnicodeCategory(key);
if (!extractionResult.GlyphsByCategory.ContainsKey(unicodeCategory))
{
extractionResult.GlyphsByCategory[unicodeCategory] = new List<string>();
}
string item = char.ConvertFromUtf32((int)key);
extractionResult.GlyphsByCategory[unicodeCategory].Add(item);
}
}
}
extractionResult.TotalGlyphs = num2;
extractionResult.ValidGlyphs = num3;
Debug.Log($"[FontGlyphExtractor] {((Object)font).name}: {num3}/{num2} valid glyphs");
return extractionResult;
}
private static string GetUnicodeCategory(uint codePoint)
{
if (codePoint >= 32 && codePoint <= 127)
{
return "BasicLatin";
}
if (codePoint >= 128 && codePoint <= 255)
{
return "Latin1Supplement";
}
if (codePoint >= 256 && codePoint <= 383)
{
return "LatinExtendedA";
}
if (codePoint >= 384 && codePoint <= 591)
{
return "LatinExtendedB";
}
if (codePoint >= 1024 && codePoint <= 1279)
{
return "Cyrillic";
}
if (codePoint >= 880 && codePoint <= 1023)
{
return "Greek";
}
if (codePoint >= 8592 && codePoint <= 8703)
{
return "Arrows";
}
if (codePoint >= 10224 && codePoint <= 10239)
{
return "SupplementalArrowsA";
}
if (codePoint >= 10496 && codePoint <= 10623)
{
return "SupplementalArrowsB";
}
if (codePoint >= 8704 && codePoint <= 8959)
{
return "MathOperators";
}
if (codePoint >= 10752 && codePoint <= 11007)
{
return "SupplementalMathOperators";
}
if (codePoint >= 8960 && codePoint <= 9215)
{
return "MiscTechnical";
}
if (codePoint >= 9472 && codePoint <= 9599)
{
return "BoxDrawing";
}
if (codePoint >= 9600 && codePoint <= 9631)
{
return "BlockElements";
}
if (codePoint >= 9632 && codePoint <= 9727)
{
return "GeometricShapes";
}
if (codePoint >= 9728 && codePoint <= 9983)
{
return "MiscSymbols";
}
if (codePoint >= 9984 && codePoint <= 10175)
{
return "Dingbats";
}
if (codePoint >= 9312 && codePoint <= 9471)
{
return "EnclosedAlphanumerics";
}
if (codePoint >= 8528 && codePoint <= 8591)
{
return "NumberForms";
}
if (codePoint >= 8192 && codePoint <= 8303)
{
return "GeneralPunctuation";
}
if (codePoint >= 8352 && codePoint <= 8399)
{
return "CurrencySymbols";
}
if (codePoint >= 8448 && codePoint <= 8527)
{
return "LetterlikeSymbols";
}
if (codePoint >= 127136 && codePoint <= 127231)
{
return "PlayingCards";
}
if (codePoint >= 127744 && codePoint <= 128511)
{
return "MiscSymbolsPictographs";
}
if (codePoint >= 128512 && codePoint <= 128591)
{
return "Emoticons";
}
if (codePoint >= 128640 && codePoint <= 128767)
{
return "TransportMapSymbols";
}
if (codePoint >= 128768 && codePoint <= 128895)
{
return "AlchemicalSymbols";
}
if (codePoint >= 127232 && codePoint <= 127487)
{
return "EnclosedAlphanumericSupplement";
}
if (codePoint >= 127024 && codePoint <= 127135)
{
return "DominoTiles";
}
if (codePoint >= 126976 && codePoint <= 127023)
{
return "MahjongTiles";
}
if (codePoint >= 129536 && codePoint <= 129647)
{
return "ChessSymbols";
}
if (codePoint >= 65536)
{
return "SupplementaryPlanes";
}
return "Other";
}
public static void SaveToJson(ExtractionResult result, string filePath)
{
if (result == null)
{
return;
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("{");
stringBuilder.AppendLine(" \"fontName\": \"" + EscapeJson(result.FontName) + "\",");
stringBuilder.AppendLine($" \"totalGlyphs\": {result.TotalGlyphs},");
stringBuilder.AppendLine($" \"validGlyphs\": {result.ValidGlyphs},");
stringBuilder.AppendLine(" \"categories\": {");
List<string> list = new List<string>(result.GlyphsByCategory.Keys);
list.Sort();
for (int i = 0; i < list.Count; i++)
{
string text = list[i];
List<string> list2 = result.GlyphsByCategory[text];
stringBuilder.Append(" \"" + text + "\": [");
for (int j = 0; j < list2.Count; j++)
{
stringBuilder.Append("\"" + EscapeJson(list2[j]) + "\"");
if (j < list2.Count - 1)
{
stringBuilder.Append(", ");
}
}
stringBuilder.Append("]");
if (i < list.Count - 1)
{
stringBuilder.AppendLine(",");
}
else
{
stringBuilder.AppendLine();
}
}
stringBuilder.AppendLine(" },");
stringBuilder.Append(" \"allGlyphs\": [");
List<string> list3 = new List<string>();
foreach (List<string> value in result.GlyphsByCategory.Values)
{
list3.AddRange(value);
}
for (int k = 0; k < list3.Count; k++)
{
stringBuilder.Append("\"" + EscapeJson(list3[k]) + "\"");
if (k < list3.Count - 1)
{
stringBuilder.Append(", ");
}
}
stringBuilder.AppendLine("]");
stringBuilder.AppendLine("}");
File.WriteAllText(filePath, stringBuilder.ToString(), Encoding.UTF8);
Debug.Log("[FontGlyphExtractor] Saved to: " + filePath);
}
public static void SaveAsCSharpCode(ExtractionResult result, string filePath)
{
if (result == null)
{
return;
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("// Auto-generated valid glyphs for " + result.FontName);
stringBuilder.AppendLine("// Total: " + result.ValidGlyphs + " glyphs");
stringBuilder.AppendLine();
stringBuilder.AppendLine("private static readonly Dictionary<string, string[]> symbolCategories = new Dictionary<string, string[]>");
stringBuilder.AppendLine("{");
List<string> list = new List<string>(result.GlyphsByCategory.Keys);
list.Sort();
foreach (string item in list)
{
List<string> list2 = result.GlyphsByCategory[item];
if (list2.Count == 0)
{
continue;
}
stringBuilder.Append(" { \"" + item + "\", new[] { ");
for (int i = 0; i < list2.Count; i++)
{
stringBuilder.Append("\"" + EscapeJson(list2[i]) + "\"");
if (i < list2.Count - 1)
{
stringBuilder.Append(", ");
}
}
stringBuilder.AppendLine(" } },");
}
stringBuilder.AppendLine("};");
File.WriteAllText(filePath, stringBuilder.ToString(), Encoding.UTF8);
Debug.Log("[FontGlyphExtractor] Saved C# code to: " + filePath);
}
private static string EscapeJson(string s)
{
if (string.IsNullOrEmpty(s))
{
return "";
}
StringBuilder stringBuilder = new StringBuilder();
foreach (char c in s)
{
switch (c)
{
case '\\':
stringBuilder.Append("\\\\");
continue;
case '"':
stringBuilder.Append("\\\"");
continue;
case '\n':
stringBuilder.Append("\\n");
continue;
case '\r':
stringBuilder.Append("\\r");
continue;
case '\t':
stringBuilder.Append("\\t");
continue;
}
if (c < ' ')
{
stringBuilder.Append($"\\u{(int)c:X4}");
}
else
{
stringBuilder.Append(c);
}
}
return stringBuilder.ToString();
}
public static bool HasValidGlyph(TMP_FontAsset font, char character)
{
if ((Object)(object)font == (Object)null)
{
return false;
}
return font.HasCharacter(character, false);
}
public static bool HasValidGlyph(TMP_FontAsset font, uint unicode)
{
if ((Object)(object)font == (Object)null)
{
return false;
}
if (font.characterLookupTable == null)
{
return false;
}
if (!font.characterLookupTable.TryGetValue(unicode, out var value))
{
return false;
}
if (font.glyphLookupTable == null)
{
return false;
}
return font.glyphLookupTable.ContainsKey(((TMP_TextElement)value).glyphIndex);
}
}
public class SymbolTester : MonoBehaviour
{
private static SymbolTester instance;
private GameObject testCanvas;
private bool isVisible = false;
private static readonly Dictionary<string, string[]> symbolCategories = new Dictionary<string, string[]>
{
{
"Arrows",
new string[7] { "←", "↑", "→", "↓", "↔", "↕", "➤" }
},
{
"NumberForms",
new string[10] { "Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", "Ⅶ", "Ⅷ", "Ⅸ", "Ⅹ" }
},
{
"Combat",
new string[12]
{
"⚔", "⚒", "⚓", "☠", "⚙", "⚗", "⚖", "⛏", "⛓", "⛊",
"⚰", "⛨"
}
},
{
"Magic",
new string[9] { "⚡", "❄", "☀", "☁", "☂", "☃", "✴", "❋", "☼" }
},
{
"Hearts",
new string[4] { "❤", "♥", "♡", "❥" }
},
{
"Status",
new string[5] { "✓", "✔", "✗", "✘", "⚠" }
},
{
"Stars",
new string[10] { "★", "☆", "✦", "✧", "✪", "✫", "✬", "✭", "✮", "✯" }
},
{
"Shapes",
new string[9] { "●", "○", "■", "▲", "△", "▼", "▽", "◆", "◇" }
},
{
"Numbers",
new string[10] { "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩" }
},
{
"Cards",
new string[8] { "♠", "♡", "♢", "♣", "♤", "♥", "♦", "♧" }
},
{
"Music",
new string[4] { "♩", "♪", "♫", "♬" }
},
{
"Math",
new string[6] { "+", "±", "×", "÷", "=", "-" }
},
{
"Progress",
new string[2] { "⏱", "⌛" }
},
{
"Misc",
new string[7] { "☯", "☮", "⚛", "☢", "☣", "⚕", "⚜" }
}
};
public static void Initialize()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if (!((Object)(object)instance != (Object)null))
{
GameObject val = new GameObject("CooldownUI_SymbolTester");
Object.DontDestroyOnLoad((Object)(object)val);
instance = val.AddComponent<SymbolTester>();
}
}
public static void Toggle()
{
if ((Object)(object)instance == (Object)null)
{
Initialize();
}
instance.ToggleDisplay();
}
public static void Show()
{
if ((Object)(object)instance == (Object)null)
{
Initialize();
}
instance.ShowDisplay();
}
public static void Hide()
{
if ((Object)(object)instance != (Object)null)
{
instance.HideDisplay();
}
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)289))
{
ToggleDisplay();
}
}
private void ToggleDisplay()
{
if (isVisible)
{
HideDisplay();
}
else
{
ShowDisplay();
}
}
private void ShowDisplay()
{
if ((Object)(object)testCanvas != (Object)null)
{
testCanvas.SetActive(true);
isVisible = true;
}
else
{
CreateTestCanvas();
isVisible = true;
}
}
private void HideDisplay()
{
if ((Object)(object)testCanvas != (Object)null)
{
testCanvas.SetActive(false);
}
isVisible = false;
}
private void CreateTestCanvas()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
if ((Object)(object)Object.FindObjectOfType<EventSystem>() == (Object)null)
{
GameObject val = new GameObject("EventSystem");
val.transform.SetParent(((Component)this).transform);
val.AddComponent<EventSystem>();
val.AddComponent<StandaloneInputModule>();
}
testCanvas = new GameObject("SymbolTestCanvas");
testCanvas.transform.SetParent(((Component)this).transform);
Canvas val2 = testCanvas.AddComponent<Canvas>();
val2.renderMode = (RenderMode)0;
val2.sortingOrder = 9999;
CanvasScaler val3 = testCanvas.AddComponent<CanvasScaler>();
val3.uiScaleMode = (ScaleMode)1;
val3.referenceResolution = new Vector2(1920f, 1080f);
testCanvas.AddComponent<GraphicRaycaster>();
GameObject val4 = new GameObject("Background");
val4.transform.SetParent(testCanvas.transform);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMin = Vector2.zero;
val5.anchorMax = Vector2.one;
val5.offsetMin = Vector2.zero;
val5.offsetMax = Vector2.zero;
Image val6 = val4.AddComponent<Image>();
((Graphic)val6).color = new Color(0.1f, 0.1f, 0.15f, 0.95f);
CreateTitle();
CreateScrollView();
CreateCloseHint();
LogFontStatus();
}
private void CreateTitle()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Title");
val.transform.SetParent(testCanvas.transform);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.anchorMin = new Vector2(0f, 1f);
val2.anchorMax = new Vector2(1f, 1f);
val2.pivot = new Vector2(0.5f, 1f);
val2.anchoredPosition = new Vector2(0f, -10f);
val2.sizeDelta = new Vector2(0f, 50f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = "CooldownUILib — Symbol Test (Press F8 to close)";
((TMP_Text)val3).fontSize = 28f;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
((Graphic)val3).color = Color.white;
((TMP_Text)val3).fontStyle = (FontStyles)1;
if ((Object)(object)CooldownUIPlugin.SymbolsFont != (Object)null && (Object)(object)((TMP_Text)val3).font != (Object)null)
{
if (((TMP_Text)val3).font.fallbackFontAssetTable == null)
{
((TMP_Text)val3).font.fallbackFontAssetTable = new List<TMP_FontAsset>();
}
if (!((TMP_Text)val3).font.fallbackFontAssetTable.Contains(CooldownUIPlugin.SymbolsFont))
{
((TMP_Text)val3).font.fallbackFontAssetTable.Add(CooldownUIPlugin.SymbolsFont);
}
}
}
private void CreateScrollView()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: 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_0100: Expected O, but got Unknown
//IL_0128: 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_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
GameObject val = new GameObject("ScrollView");
val.transform.SetParent(testCanvas.transform);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.anchorMin = new Vector2(0.05f, 0.05f);
val2.anchorMax = new Vector2(0.95f, 0.9f);
val2.offsetMin = Vector2.zero;
val2.offsetMax = Vector2.zero;
ScrollRect val3 = val.AddComponent<ScrollRect>();
GameObject val4 = new GameObject("Viewport");
val4.transform.SetParent(val.transform);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMin = Vector2.zero;
val5.anchorMax = Vector2.one;
val5.offsetMin = Vector2.zero;
val5.offsetMax = Vector2.zero;
Mask val6 = val4.AddComponent<Mask>();
val6.showMaskGraphic = false;
Image val7 = val4.AddComponent<Image>();
((Graphic)val7).color = Color.white;
GameObject val8 = new GameObject("Content");
val8.transform.SetParent(val4.transform);
RectTransform val9 = val8.AddComponent<RectTransform>();
val9.anchorMin = new Vector2(0f, 1f);
val9.anchorMax = new Vector2(1f, 1f);
val9.pivot = new Vector2(0.5f, 1f);
val9.anchoredPosition = Vector2.zero;
VerticalLayoutGroup val10 = val8.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val10).spacing = 15f;
((LayoutGroup)val10).padding = new RectOffset(60, 40, 20, 20);
((LayoutGroup)val10).childAlignment = (TextAnchor)0;
((HorizontalOrVerticalLayoutGroup)val10).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val10).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val10).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val10).childForceExpandHeight = false;
ContentSizeFitter val11 = val8.AddComponent<ContentSizeFitter>();
val11.verticalFit = (FitMode)2;
val3.viewport = val5;
val3.content = val9;
val3.horizontal = false;
val3.vertical = true;
val3.scrollSensitivity = 30f;
CreateFontStatusRow(val8.transform);
foreach (KeyValuePair<string, string[]> symbolCategory in symbolCategories)
{
CreateCategoryRow(val8.transform, symbolCategory.Key, symbolCategory.Value);
}
}
private void CreateFontStatusRow(Transform parent)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_002b: 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)
GameObject val = new GameObject("FontStatus");
val.transform.SetParent(parent);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 40f);
LayoutElement val3 = val.AddComponent<LayoutElement>();
val3.minHeight = 40f;
val3.preferredHeight = 40f;
TextMeshProUGUI val4 = val.AddComponent<TextMeshProUGUI>();
bool symbolsFontLoaded = CooldownUIPlugin.SymbolsFontLoaded;
string text = (symbolsFontLoaded ? ((Object)CooldownUIPlugin.SymbolsFont).name : "NOT LOADED");
((TMP_Text)val4).text = "Font Status: " + (symbolsFontLoaded ? "<color=#4f4>LOADED</color>" : "<color=#f44>NOT LOADED</color>") + " — " + text;
((TMP_Text)val4).fontSize = 20f;
((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
((Graphic)val4).color = Color.white;
}
private void CreateCategoryRow(Transform parent, string categoryName, string[] symbols)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_0112: 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_0136: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected O, but got Unknown
GameObject val = new GameObject("Category_" + categoryName);
val.transform.SetParent(parent);
RectTransform val2 = val.AddComponent<RectTransform>();
VerticalLayoutGroup val3 = val.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val3).spacing = 5f;
((LayoutGroup)val3).childAlignment = (TextAnchor)0;
((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false;
LayoutElement val4 = val.AddComponent<LayoutElement>();
val4.flexibleHeight = 0f;
ContentSizeFitter val5 = val.AddComponent<ContentSizeFitter>();
val5.verticalFit = (FitMode)2;
GameObject val6 = new GameObject("Label");
val6.transform.SetParent(val.transform);
RectTransform val7 = val6.AddComponent<RectTransform>();
LayoutElement val8 = val6.AddComponent<LayoutElement>();
val8.minHeight = 25f;
val8.preferredHeight = 25f;
TextMeshProUGUI val9 = val6.AddComponent<TextMeshProUGUI>();
((TMP_Text)val9).text = $"<b>{categoryName}</b> ({symbols.Length})";
((TMP_Text)val9).fontSize = 18f;
((Graphic)val9).color = new Color(0.7f, 0.85f, 1f);
((TMP_Text)val9).alignment = (TextAlignmentOptions)513;
GameObject val10 = new GameObject("Symbols");
val10.transform.SetParent(val.transform);
RectTransform val11 = val10.AddComponent<RectTransform>();
GridLayoutGroup val12 = val10.AddComponent<GridLayoutGroup>();
val12.cellSize = new Vector2(48f, 48f);
val12.spacing = new Vector2(6f, 6f);
((LayoutGroup)val12).padding = new RectOffset(15, 15, 5, 5);
val12.startCorner = (Corner)0;
val12.startAxis = (Axis)0;
((LayoutGroup)val12).childAlignment = (TextAnchor)0;
val12.constraint = (Constraint)0;
LayoutElement val13 = val10.AddComponent<LayoutElement>();
int num = Mathf.CeilToInt((float)symbols.Length / 16f);
val13.minHeight = num * 54;
val13.preferredHeight = num * 54;
foreach (string symbol in symbols)
{
CreateSymbolBox(val10.transform, symbol);
}
}
private void CreateSymbolBox(Transform parent, string symbol)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_003b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject($"Symbol_{symbol.GetHashCode()}");
val.transform.SetParent(parent);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(48f, 48f);
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = new Color(0.2f, 0.2f, 0.25f, 1f);
GameObject val4 = new GameObject("Text");
val4.transform.SetParent(val.transform);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMin = Vector2.zero;
val5.anchorMax = Vector2.one;
val5.offsetMin = Vector2.zero;
val5.offsetMax = Vector2.zero;
TextMeshProUGUI val6 = val4.AddComponent<TextMeshProUGUI>();
((TMP_Text)val6).text = symbol;
((TMP_Text)val6).fontSize = 26f;
((TMP_Text)val6).alignment = (TextAlignmentOptions)514;
((Graphic)val6).color = Color.white;
ApplySymbolsFont(val6);
int num = char.ConvertToUtf32(symbol, 0);
SymbolTooltip symbolTooltip = val.AddComponent<SymbolTooltip>();
symbolTooltip.Initialize(symbol, $"U+{num:X4}");
}
private void ApplySymbolsFont(TextMeshProUGUI tmp)
{
if (!((Object)(object)CooldownUIPlugin.SymbolsFont == (Object)null) && !((Object)(object)((TMP_Text)tmp).font == (Object)null))
{
if (((TMP_Text)tmp).font.fallbackFontAssetTable == null)
{
((TMP_Text)tmp).font.fallbackFontAssetTable = new List<TMP_FontAsset>();
}
if (!((TMP_Text)tmp).font.fallbackFontAssetTable.Contains(CooldownUIPlugin.SymbolsFont))
{
((TMP_Text)tmp).font.fallbackFontAssetTable.Add(CooldownUIPlugin.SymbolsFont);
}
}
}
private void CreateCloseHint()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("CloseHint");
val.transform.SetParent(testCanvas.transform);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.anchorMin = new Vector2(1f, 0f);
val2.anchorMax = new Vector2(1f, 0f);
val2.pivot = new Vector2(1f, 0f);
val2.anchoredPosition = new Vector2(-20f, 20f);
val2.sizeDelta = new Vector2(300f, 30f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = "Press F8 to close | Scroll to see all";
((TMP_Text)val3).fontSize = 16f;
((TMP_Text)val3).alignment = (TextAlignmentOptions)516;
((Graphic)val3).color = new Color(0.6f, 0.6f, 0.6f);
}
private void LogFontStatus()
{
Debug.Log("[CooldownUI SymbolTester] Symbol test display opened");
Debug.Log($"[CooldownUI SymbolTester] Symbols font loaded: {CooldownUIPlugin.SymbolsFontLoaded}");
if ((Object)(object)CooldownUIPlugin.SymbolsFont != (Object)null)
{
Debug.Log("[CooldownUI SymbolTester] Font name: " + ((Object)CooldownUIPlugin.SymbolsFont).name);
}
int num = 0;
foreach (KeyValuePair<string, string[]> symbolCategory in symbolCategories)
{
num += symbolCategory.Value.Length;
}
Debug.Log($"[CooldownUI SymbolTester] Total symbols to test: {num}");
}
private void OnDestroy()
{
if ((Object)(object)testCanvas != (Object)null)
{
Object.Destroy((Object)(object)testCanvas);
}
}
}
public class SymbolTooltip : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
{
private string symbol;
private string codePoint;
private GameObject tooltipObj;
public void Initialize(string symbol, string codePoint)
{
this.symbol = symbol;
this.codePoint = codePoint;
}
public void OnPointerEnter(PointerEventData eventData)
{
ShowTooltip();
}
public void OnPointerExit(PointerEventData eventData)
{
HideTooltip();
}
private void ShowTooltip()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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_0173: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)tooltipObj != (Object)null))
{
tooltipObj = new GameObject("Tooltip");
tooltipObj.transform.SetParent(((Component)this).transform.root);
RectTransform val = tooltipObj.AddComponent<RectTransform>();
val.sizeDelta = new Vector2(120f, 50f);
Vector3 position = ((Component)this).transform.position + Vector3.up * 60f;
((Transform)val).position = position;
Image val2 = tooltipObj.AddComponent<Image>();
((Graphic)val2).color = new Color(0f, 0f, 0f, 0.9f);
GameObject val3 = new GameObject("Text");
val3.transform.SetParent(tooltipObj.transform);
RectTransform val4 = val3.AddComponent<RectTransform>();
val4.anchorMin = Vector2.zero;
val4.anchorMax = Vector2.one;
val4.offsetMin = new Vector2(5f, 5f);
val4.offsetMax = new Vector2(-5f, -5f);
TextMeshProUGUI val5 = val3.AddComponent<TextMeshProUGUI>();
((TMP_Text)val5).text = symbol + "\n<size=12>" + codePoint + "</size>";
((TMP_Text)val5).fontSize = 18f;
((TMP_Text)val5).alignment = (TextAlignmentOptions)514;
((Graphic)val5).color = Color.white;
}
}
private void HideTooltip()
{
if ((Object)(object)tooltipObj != (Object)null)
{
Object.Destroy((Object)(object)tooltipObj);
tooltipObj = null;
}
}
private void OnDestroy()
{
HideTooltip();
}
}
}