예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="baseMaterial"></param>
        /// <returns></returns>
        public override Material GetModifiedMaterial(Material baseMaterial)
        {
            Material mat = baseMaterial;

            if (m_ShouldRecalculateStencil)
            {
                m_stencilID = TMP_MaterialManager.GetStencilID(gameObject);
                m_ShouldRecalculateStencil = false;
            }

            // Release masking material
            //if (m_MaskMaterial != null)
            //    MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);

            if (m_stencilID > 0)
            {
                mat = TMP_MaterialManager.GetStencilMaterial(baseMaterial, m_stencilID);
                if (m_MaskMaterial != null)
                {
                    TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
                }

                m_MaskMaterial = mat;
            }

            return(mat);
        }
예제 #2
0
        protected override void OnDisable()
        {
            //Debug.Log("*** SubObject OnDisable() ***");
            //base.OnDisable();

            //m_canvasRenderer.Clear();
            //TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);

            if (canvasRenderer != null)
            {
                canvasRenderer.Clear();
            }

            if (m_MaskMaterial != null)
            {
                TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
                m_MaskMaterial = null;
            }

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }
        }
예제 #3
0
        /// <summary>
        /// Function returning the modified material for masking if necessary.
        /// </summary>
        /// <param name="baseMaterial"></param>
        /// <returns></returns>
        public override Material GetModifiedMaterial(Material baseMaterial)
        {
            Material mat = baseMaterial;

            if (m_ShouldRecalculateStencil)
            {
                m_StencilValue             = TMP_MaterialManager.GetStencilID(gameObject);
                m_ShouldRecalculateStencil = false;
            }

            if (m_StencilValue > 0)
            {
                mat = TMP_MaterialManager.GetStencilMaterial(baseMaterial, m_StencilValue);
                if (m_MaskMaterial != null)
                {
                    TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
                }

                m_MaskMaterial = mat;
            }
            else if (m_MaskMaterial != null)
            {
                TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
            }

            return(mat);
        }
예제 #4
0
        protected override void OnDestroy()

        {
            //Debug.Log("*** OnDestroy() ***");



            // Destroy Mesh

            if (m_mesh != null)
            {
                DestroyImmediate(m_mesh);
            }



            if (m_MaskMaterial != null)
            {
                TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
            }



            if (m_fallbackMaterial != null)

            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);

                m_fallbackMaterial = null;
            }



#if UNITY_EDITOR
            // Unregister the event this object was listening to

            TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED);

            //TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED);

            //TMPro_EventManager.TEXTMESHPRO_PROPERTY_EVENT.Remove(ON_TEXTMESHPRO_PROPERTY_CHANGED);

            TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL);

            //TMPro_EventManager.TEXT_STYLE_PROPERTY_EVENT.Remove(ON_TEXT_STYLE_CHANGED);

            TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED);

            //TMPro_EventManager.TMP_SETTINGS_PROPERTY_EVENT.Remove(ON_TMP_SETTINGS_CHANGED);
        #endif



            m_isRegisteredForEvents = false;



            RecalculateClipping();
        }
예제 #5
0
 protected override void OnDisable()
 {
     TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);
     if (this.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial);
         this.m_MaskMaterial = null;
     }
     if (this.m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial);
         this.m_fallbackMaterial = null;
     }
     base.OnDisable();
 }
예제 #6
0
 protected override void OnDisable()
 {
     TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild((ICanvasElement)(object)this);
     if (base.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(base.m_MaskMaterial);
         base.m_MaskMaterial = null;
     }
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
     //((MaskableGraphic)this).OnDisable();
     base.OnDisable();
 }
예제 #7
0
        protected override void OnDisable()
        {
            //Debug.Log("*** SubObject OnDisable() ***");
            base.OnDisable();

            if (m_MaskMaterial != null)
            {
                TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
                m_MaskMaterial = null;
            }

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }
        }
예제 #8
0
 protected override void OnDestroy()
 {
     if (this.m_mesh != null)
     {
         Object.DestroyImmediate(this.m_mesh);
     }
     if (this.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial);
     }
     if (this.m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial);
         this.m_fallbackMaterial = null;
     }
     this.m_isRegisteredForEvents = false;
     this.RecalculateClipping();
 }
예제 #9
0
        public override Material GetModifiedMaterial(Material baseMaterial)
        {
            Material material = baseMaterial;

            if (this.m_ShouldRecalculateStencil)
            {
                this.m_StencilValue             = TMP_MaterialManager.GetStencilID(base.gameObject);
                this.m_ShouldRecalculateStencil = false;
            }
            if (this.m_StencilValue > 0)
            {
                material = TMP_MaterialManager.GetStencilMaterial(baseMaterial, this.m_StencilValue);
                if (this.m_MaskMaterial != null)
                {
                    TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial);
                }
                this.m_MaskMaterial = material;
            }
            return(material);
        }
예제 #10
0
 protected override void OnDestroy()
 {
     if (m_mesh != null)
     {
         UnityEngine.Object.DestroyImmediate(m_mesh);
     }
     if (base.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(base.m_MaskMaterial);
     }
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
     TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED);
     TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED);
     TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL);
     TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED);
     m_isRegisteredForEvents = false;
     //((MaskableGraphic)this).RecalculateClipping();
     RecalculateClipping();
 }