コード例 #1
0
 /// <summary>
 ///
 /// <para>
 /// Called by the [FontUpdateTracker] when the texture associated with a font is modified.
 /// </para>
 ///
 /// </summary>
 public void FontTextureChanged()
 {
     if (!(bool)((UnityEngine.Object) this))
     {
         FontUpdateTracker.UntrackText(this);
     }
     else
     {
         if (this.m_DisableFontTextureRebuiltCallback)
         {
             return;
         }
         this.cachedTextGenerator.Invalidate();
         if (!this.IsActive())
         {
             return;
         }
         if (CanvasUpdateRegistry.IsRebuildingGraphics() || CanvasUpdateRegistry.IsRebuildingLayout())
         {
             this.UpdateGeometry();
         }
         else
         {
             this.SetAllDirty();
         }
     }
 }
コード例 #2
0
ファイル: Text.cs プロジェクト: Geri-Borbas/Unity.UI
        public void FontTextureChanged()
        {
            // Only invoke if we are not destroyed.
            if (!this)
            {
                FontUpdateTracker.UntrackText(this);
                return;
            }

            if (m_DisableFontTextureChangedCallback)
            {
                return;
            }

            cachedTextGenerator.Invalidate();

            if (!IsActive())
            {
                return;
            }

            // this is a bit hacky, but it is currently the
            // cleanest solution....
            // if we detect the font texture has changed and are in a rebuild loop
            // we just regenerate the verts for the new UV's
            if (CanvasUpdateRegistry.IsRebuildingGraphics() || CanvasUpdateRegistry.IsRebuildingLayout())
            {
                UpdateGeometry();
            }
            else
            {
                SetAllDirty();
            }
        }
コード例 #3
0
 public override void OnRebuildRequested()
 {
     FontUpdateTracker.UntrackText(this);
     FontUpdateTracker.TrackText(this);
     this.cachedTextGenerator.Invalidate();
     base.OnRebuildRequested();
 }
コード例 #4
0
        // 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()
        {
            if (!IsActive())
            {
                base.OnValidate();
                return;
            }

            if (m_FontData.font != m_LastTrackedFont)
            {
                Font newFont = m_FontData.font;
                m_FontData.font = m_LastTrackedFont;

                if (isActiveAndEnabled)
                {
                    FontUpdateTracker.UntrackText(this);
                }

                m_FontData.font = newFont;

                if (isActiveAndEnabled)
                {
                    FontUpdateTracker.TrackText(this);
                }

                m_LastTrackedFont = newFont;
            }
            base.OnValidate();
        }
コード例 #5
0
 public void FontTextureChanged()
 {
     if (!this)
     {
         FontUpdateTracker.UntrackText(this);
     }
     else
     {
         if (m_DisableFontTextureRebuiltCallback)
         {
             return;
         }
         cachedTextGenerator.Invalidate();
         if (IsActive())
         {
             if (CanvasUpdateRegistry.IsRebuildingGraphics() || CanvasUpdateRegistry.IsRebuildingLayout())
             {
                 UpdateGeometry();
             }
             else
             {
                 SetAllDirty();
             }
         }
     }
 }
コード例 #6
0
ファイル: Text.cs プロジェクト: Geri-Borbas/Unity.UI
        public override void OnRebuildRequested()
        {
            // After a Font asset gets re-imported the managed side gets deleted and recreated,
            // that means the delegates are not persisted.
            // so we need to properly enforce a consistent state here.
            FontUpdateTracker.UntrackText(this);
            FontUpdateTracker.TrackText(this);

            // Also the textgenerator is no longer valid.
            cachedTextGenerator.Invalidate();

            base.OnRebuildRequested();
        }
コード例 #7
0
ファイル: Text.cs プロジェクト: zlhtech/unity-decompiled
 protected override void OnValidate()
 {
     if ((UnityEngine.Object) this.m_FontData.font != (UnityEngine.Object) this.m_LastTrackedFont)
     {
         Font font = this.m_FontData.font;
         this.m_FontData.font = this.m_LastTrackedFont;
         FontUpdateTracker.UntrackText(this);
         this.m_FontData.font = font;
         FontUpdateTracker.TrackText(this);
         this.m_LastTrackedFont = font;
     }
     base.OnValidate();
 }
コード例 #8
0
ファイル: Text.cs プロジェクト: shicheju1/ugui
        // 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()
        {
            if (m_FontData.font != m_LastTrackedFont)
            {
                Font newFont = m_FontData.font;
                m_FontData.font = m_LastTrackedFont;
                FontUpdateTracker.UntrackText(this);
                m_FontData.font = newFont;
                FontUpdateTracker.TrackText(this);

                m_LastTrackedFont = newFont;
            }
            base.OnValidate();
        }
コード例 #9
0
ファイル: Text.cs プロジェクト: twenty0ne/UnityDecompiled
 protected override void OnValidate()
 {
     if (!this.IsActive())
     {
         base.OnValidate();
     }
     else
     {
         if (this.m_FontData.font != this.m_LastTrackedFont)
         {
             Font font = this.m_FontData.font;
             this.m_FontData.font = this.m_LastTrackedFont;
             FontUpdateTracker.UntrackText(this);
             this.m_FontData.font = font;
             FontUpdateTracker.TrackText(this);
             this.m_LastTrackedFont = font;
         }
         base.OnValidate();
     }
 }
コード例 #10
0
ファイル: Text.cs プロジェクト: Geri-Borbas/Unity.UI
 protected override void OnDisable()
 {
     FontUpdateTracker.UntrackText(this);
     base.OnDisable();
 }
コード例 #11
0
ファイル: Text.cs プロジェクト: Geri-Borbas/Unity.UI
 protected override void OnEnable()
 {
     base.OnEnable();
     cachedTextGenerator.Invalidate();
     FontUpdateTracker.TrackText(this);
 }