Ejemplo n.º 1
0
        public static void UntrackText(TText t)
        {
            if (t.font == null)
            {
                return;
            }

            HashSet <TText> texts;

            m_Tracked.TryGetValue(t.font, out texts);

            if (texts == null)
            {
                return;
            }

            texts.Remove(t);

            if (texts.Count == 0)
            {
                m_Tracked.Remove(t.font);

                // There is a global textureRebuilt event for all fonts, so once the last Text reference goes away, remove our delegate
                if (m_Tracked.Count == 0)
                {
                    Font.textureRebuilt -= RebuildForFont;
                }
            }
        }
Ejemplo n.º 2
0
        public static void TrackText(TText t)
        {
            if (t.font == null)
            {
                return;
            }

            HashSet <TText> exists;

            m_Tracked.TryGetValue(t.font, out exists);
            if (exists == null)
            {
                // The textureRebuilt event is global for all fonts, so we add our delegate the first time we register *any* Text
                if (m_Tracked.Count == 0)
                {
                    Font.textureRebuilt += RebuildForFont;
                }

                exists = new HashSet <TText>();
                m_Tracked.Add(t.font, exists);
            }

            if (!exists.Contains(t))
            {
                exists.Add(t);
            }
        }