blob: ea7f527c5b20a96cbf58445ff955cf99a7ddf032 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
using System.Collections.Generic;
using UnityEngine.UI.Collections;
namespace UnityEngine.UI
{
public class ClipperRegistry
{
static ClipperRegistry s_Instance;
readonly IndexedSet<IClipper> m_Clippers = new IndexedSet<IClipper>();
protected ClipperRegistry()
{
// This is needed for AOT platforms. Without it the compile doesn't get the definition of the Dictionarys
#pragma warning disable 168
Dictionary<IClipper, int> emptyIClipperDic;
#pragma warning restore 168
}
public static ClipperRegistry instance
{
get
{
if (s_Instance == null)
s_Instance = new ClipperRegistry();
return s_Instance;
}
}
public void Cull()
{
for (var i = 0; i < m_Clippers.Count; ++i)
{
m_Clippers[i].PerformClipping();
}
}
public static void Register(IClipper c)
{
if (c == null)
return;
instance.m_Clippers.AddUnique(c);
}
public static void Unregister(IClipper c)
{
instance.m_Clippers.Remove(c);
}
}
}
|