72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UnityEngine.UI
|
|
{
|
|
// Token: 0x02000048 RID: 72
|
|
public static class FontUpdateTracker
|
|
{
|
|
// Token: 0x06000223 RID: 547 RVA: 0x0000AFB8 File Offset: 0x000093B8
|
|
public static void TrackText(Text t)
|
|
{
|
|
if (!(t.font == null))
|
|
{
|
|
HashSet<Text> hashSet;
|
|
FontUpdateTracker.m_Tracked.TryGetValue(t.font, out hashSet);
|
|
if (hashSet == null)
|
|
{
|
|
if (FontUpdateTracker.m_Tracked.Count == 0)
|
|
{
|
|
Font.textureRebuilt += FontUpdateTracker.RebuildForFont;
|
|
}
|
|
hashSet = new HashSet<Text>();
|
|
FontUpdateTracker.m_Tracked.Add(t.font, hashSet);
|
|
}
|
|
if (!hashSet.Contains(t))
|
|
{
|
|
hashSet.Add(t);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000224 RID: 548 RVA: 0x0000B054 File Offset: 0x00009454
|
|
private static void RebuildForFont(Font f)
|
|
{
|
|
HashSet<Text> hashSet;
|
|
FontUpdateTracker.m_Tracked.TryGetValue(f, out hashSet);
|
|
if (hashSet != null)
|
|
{
|
|
foreach (Text text in hashSet)
|
|
{
|
|
text.FontTextureChanged();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000225 RID: 549 RVA: 0x0000B0C8 File Offset: 0x000094C8
|
|
public static void UntrackText(Text t)
|
|
{
|
|
if (!(t.font == null))
|
|
{
|
|
HashSet<Text> hashSet;
|
|
FontUpdateTracker.m_Tracked.TryGetValue(t.font, out hashSet);
|
|
if (hashSet != null)
|
|
{
|
|
hashSet.Remove(t);
|
|
if (hashSet.Count == 0)
|
|
{
|
|
FontUpdateTracker.m_Tracked.Remove(t.font);
|
|
if (FontUpdateTracker.m_Tracked.Count == 0)
|
|
{
|
|
Font.textureRebuilt -= FontUpdateTracker.RebuildForFont;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000104 RID: 260
|
|
private static Dictionary<Font, HashSet<Text>> m_Tracked = new Dictionary<Font, HashSet<Text>>();
|
|
}
|
|
}
|