源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

49 行
1.4 KiB

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.Rendering;
using System;
using UnityEngine.Serialization;
public class EffectMask : Mask {
[NonSerialized]
private Material c_MaskMaterial;
[NonSerialized]
private Material c_UnmaskMaterial;
protected override void OnDisable()
{
// we call base OnDisable first here
// as we need to have the IsActive return the
// correct value when we notify the children
// that the mask state has changed.
base.OnDisable();
if (graphic != null)
{
graphic.SetMaterialDirty();
graphic.canvasRenderer.hasPopInstruction = false;
graphic.canvasRenderer.popMaterialCount = 0;
}
StencilMaterial.Remove(c_MaskMaterial);
c_MaskMaterial = null;
StencilMaterial.Remove(c_UnmaskMaterial);
c_UnmaskMaterial = null;
MaskUtilities.NotifyStencilStateChanged(this);
}
public override Material GetModifiedMaterial(Material baseMaterial)
{
if (!MaskEnabled())
return baseMaterial;
var maskMaterial = StencilMaterial.Add(baseMaterial, 1, StencilOp.Replace, CompareFunction.Always, showMaskGraphic ? ColorWriteMask.All : 0);
StencilMaterial.Remove(c_MaskMaterial);
c_MaskMaterial = maskMaterial;
return c_MaskMaterial;
}
}