diff options
author | chai <chaifix@163.com> | 2021-04-07 19:10:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-07 19:10:30 +0800 |
commit | e7dfbec8e8634e767d78959941daf71a96e021cf (patch) | |
tree | 58895a7c60df0bd3f316e6461051eabd1c0a51e1 /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs | |
parent | ff5a3fbf31db349db11bbc5c60ba199d26780f19 (diff) |
*移动目录
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs deleted file mode 100644 index 2228457..0000000 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityEngine.UI -{ - public static class FontUpdateTracker - { - static Dictionary<Font, HashSet<Text>> m_Tracked = new Dictionary<Font, HashSet<Text>>(); - - public static void TrackText(Text t) - { - if (t.font == null) - return; - - HashSet<Text> 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<Text>(); - m_Tracked.Add(t.font, exists); - } - - if (!exists.Contains(t)) - exists.Add(t); - } - - private static void RebuildForFont(Font f) - { - HashSet<Text> texts; - m_Tracked.TryGetValue(f, out texts); - - if (texts == null) - return; - - foreach (var text in texts) - text.FontTextureChanged(); - } - - public static void UntrackText(Text t) - { - if (t.font == null) - return; - - HashSet<Text> 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; - } - } - } -} |