protected override void OnEnable()
        {
            base.OnEnable();

            m_ShouldRecalculateStencil = true;
            UpdateClipParent();
            SetMaterialDirty();

            if (GetComponent <Mask>() != null)
            {
                MaskUtilities.NotifyStencilStateChanged(this);
            }
        }
Ejemplo n.º 2
0
        protected override void OnEnable()
        {
            base.OnEnable();

            if (graphic != null)
            {
                graphic.canvasRenderer.hasPopInstruction = true;
                // WG 这里会导致材质的创建
                graphic.SetMaterialDirty();
            }

            // WG 启用裁剪之后这个节点下面的字元素都需要重新计算材质的模板值
            // 由于所有的UI元素都继承与MaskableGraphic,所以这个重新计算写在里面
            MaskUtilities.NotifyStencilStateChanged(this);
        }
Ejemplo n.º 3
0
        protected override void OnValidate()
        {
            base.OnValidate();

            if (!IsActive())
            {
                return;
            }

            if (graphic != null)
            {
                graphic.SetMaterialDirty();
            }

            MaskUtilities.NotifyStencilStateChanged(this);
        }
Ejemplo n.º 4
0
        protected override void OnDisable()
        {
            base.OnDisable();

            if (graphic != null)
            {
                graphic.SetMaterialDirty();
                graphic.canvasRenderer.hasPopInstruction = false;
                graphic.canvasRenderer.popMaterialCount  = 0;
            }

            StencilMaterial.Remove(m_MaskMaterial);
            m_MaskMaterial = null;
            StencilMaterial.Remove(m_UnmaskMaterial);
            m_UnmaskMaterial = null;

            MaskUtilities.NotifyStencilStateChanged(this);
        }