diff options
author | chai <chaifix@163.com> | 2021-04-29 21:11:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-29 21:11:10 +0800 |
commit | 744b605cb80fe6d199e4f2cb8d2315990afbd365 (patch) | |
tree | c81f12297d0a473986f5ca060eb6b7f91645b088 /Assets/uGUI-2017.1 | |
parent | d345feed67b425495dc3b757785a346797da7267 (diff) |
*misc
Diffstat (limited to 'Assets/uGUI-2017.1')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontData.cs | 2 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontUpdateTracker.cs | 10 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/Text.cs (renamed from Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Text.cs) | 7 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/Text.cs.meta (renamed from Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Text.cs.meta) | 0 |
4 files changed, 14 insertions, 5 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontData.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontData.cs index 760c9ee..3a85af1 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontData.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontData.cs @@ -82,7 +82,7 @@ namespace UnityEngine.UI public int fontSize { get { return m_FontSize; } - set { m_FontSize = value; } + set { Debug.Log("FontData.fontSize"); m_FontSize = value; } } public FontStyle fontStyle diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontUpdateTracker.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontUpdateTracker.cs index 2228457..a63d62b 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontUpdateTracker.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/FontUpdateTracker.cs @@ -4,6 +4,8 @@ using UnityEngine; namespace UnityEngine.UI { + // ȫ�ּ�¼ʹ����ij��Font���������Text�������Font��GlyphAtlas��С�ı��ʱ��֪ͨ��ЩText�ؽ�mesh(����UV�� + // ��ΪGlyphAtlas��С�ı��ˣ�ԭ�ȵ�UV�Ѿ������� public static class FontUpdateTracker { static Dictionary<Font, HashSet<Text>> m_Tracked = new Dictionary<Font, HashSet<Text>>(); @@ -16,10 +18,12 @@ namespace UnityEngine.UI 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 + {
+ // font texture�������ɵ�ʱ��������ص���Ȼ����ҪText����ؽ�mesh��UV���ݣ���Ϊԭ�ȵ�fontGlyph���UV�Ѿ�����
+ // https://docs.unity3d.com/ScriptReference/Font-textureRebuilt.html
+ // 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; + Font.textureRebuilt += RebuildForFont; exists = new HashSet<Text>(); m_Tracked.Add(t.font, exists); diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Text.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/Text.cs index c087983..3d3d17b 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Text.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/Text.cs @@ -32,6 +32,7 @@ namespace UnityEngine.UI useLegacyMeshGeneration = false; } + // text generator���õ��ַ�����glyph atlas�е�UV������mesh /// <summary> /// Get or set the material used by this Text. /// </summary> @@ -260,6 +261,7 @@ namespace UnityEngine.UI } set { + // font size�ı��ʱ���ؽ�mesh if (m_FontData.fontSize == value) return; m_FontData.fontSize = value; @@ -391,6 +393,7 @@ namespace UnityEngine.UI font = Resources.GetBuiltinResource<Font>("Arial.ttf"); } + // ����FontData����TextGenerationSettings public TextGenerationSettings GetGenerationSettings(Vector2 extents) { var settings = new TextGenerationSettings(); @@ -407,7 +410,7 @@ namespace UnityEngine.UI settings.textAnchor = m_FontData.alignment; settings.alignByGeometry = m_FontData.alignByGeometry; settings.scaleFactor = pixelsPerUnit; - settings.color = color; + settings.color = color; // �����Ƕ�����ɫ settings.font = font; settings.pivot = rectTransform.pivot; settings.richText = m_FontData.richText; @@ -451,6 +454,7 @@ namespace UnityEngine.UI Vector2 extents = rectTransform.rect.size; + // ���ɶ�Ӧ���������ݣ����㡢UV�� var settings = GetGenerationSettings(extents); cachedTextGenerator.PopulateWithErrors(text, settings, gameObject); @@ -543,6 +547,7 @@ namespace UnityEngine.UI base.OnRebuildRequested(); } + // ���༭�������˲���ֵ��ʱ�������ص���setDirty�������ؽ�mesh // The Text inspector editor can change the font, and we need a way to track changes so that we get the appropriate rebuild callbacks // We can intercept changes in OnValidate, and keep track of the previous font reference protected override void OnValidate() diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Text.cs.meta b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/Text.cs.meta index ea6d1d8..ea6d1d8 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/Text.cs.meta +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Font/Text.cs.meta |