From e7dfbec8e8634e767d78959941daf71a96e021cf Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 7 Apr 2021 19:10:30 +0800 Subject: =?UTF-8?q?*=E7=A7=BB=E5=8A=A8=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UnityEngine.UI/UI/Core/FontUpdateTracker.cs | 67 ---------------------- 1 file changed, 67 deletions(-) delete mode 100644 Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/FontUpdateTracker.cs') 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> m_Tracked = new Dictionary>(); - - public static void TrackText(Text t) - { - if (t.font == null) - return; - - HashSet 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(); - m_Tracked.Add(t.font, exists); - } - - if (!exists.Contains(t)) - exists.Add(t); - } - - private static void RebuildForFont(Font f) - { - HashSet 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 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; - } - } - } -} -- cgit v1.1-26-g67d0