92 lines
2.3 KiB
C#
92 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.UI.Collections;
|
|
|
|
namespace UnityEngine.UI
|
|
{
|
|
// Token: 0x0200004C RID: 76
|
|
public class GraphicRegistry
|
|
{
|
|
// Token: 0x0600026C RID: 620 RVA: 0x0000C740 File Offset: 0x0000AB40
|
|
protected GraphicRegistry()
|
|
{
|
|
}
|
|
|
|
// Token: 0x170000A1 RID: 161
|
|
// (get) Token: 0x0600026D RID: 621 RVA: 0x0000C760 File Offset: 0x0000AB60
|
|
public static GraphicRegistry instance
|
|
{
|
|
get
|
|
{
|
|
if (GraphicRegistry.s_Instance == null)
|
|
{
|
|
GraphicRegistry.s_Instance = new GraphicRegistry();
|
|
}
|
|
return GraphicRegistry.s_Instance;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600026E RID: 622 RVA: 0x0000C790 File Offset: 0x0000AB90
|
|
public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
|
|
{
|
|
if (!(c == null))
|
|
{
|
|
IndexedSet<Graphic> indexedSet;
|
|
GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet);
|
|
if (indexedSet != null)
|
|
{
|
|
indexedSet.AddUnique(graphic);
|
|
}
|
|
else
|
|
{
|
|
indexedSet = new IndexedSet<Graphic>();
|
|
indexedSet.Add(graphic);
|
|
GraphicRegistry.instance.m_Graphics.Add(c, indexedSet);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600026F RID: 623 RVA: 0x0000C7F4 File Offset: 0x0000ABF4
|
|
public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic)
|
|
{
|
|
if (!(c == null))
|
|
{
|
|
IndexedSet<Graphic> indexedSet;
|
|
if (GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet))
|
|
{
|
|
indexedSet.Remove(graphic);
|
|
if (indexedSet.Count == 0)
|
|
{
|
|
GraphicRegistry.instance.m_Graphics.Remove(c);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000270 RID: 624 RVA: 0x0000C850 File Offset: 0x0000AC50
|
|
public static IList<Graphic> GetGraphicsForCanvas(Canvas canvas)
|
|
{
|
|
IndexedSet<Graphic> indexedSet;
|
|
IList<Graphic> list;
|
|
if (GraphicRegistry.instance.m_Graphics.TryGetValue(canvas, out indexedSet))
|
|
{
|
|
list = indexedSet;
|
|
}
|
|
else
|
|
{
|
|
list = GraphicRegistry.s_EmptyList;
|
|
}
|
|
return list;
|
|
}
|
|
|
|
// Token: 0x04000125 RID: 293
|
|
private static GraphicRegistry s_Instance;
|
|
|
|
// Token: 0x04000126 RID: 294
|
|
private readonly Dictionary<Canvas, IndexedSet<Graphic>> m_Graphics = new Dictionary<Canvas, IndexedSet<Graphic>>();
|
|
|
|
// Token: 0x04000127 RID: 295
|
|
private static readonly List<Graphic> s_EmptyList = new List<Graphic>();
|
|
}
|
|
}
|