using UnityEngine.UI; 
 | 
using UnityEngine; 
 | 
  
 | 
  
 | 
  
 | 
public class ImageEx : Image 
 | 
{ 
 | 
  
 | 
    CanvasAddition m_CanvasAddition; 
 | 
    public CanvasAddition canvasAddition { 
 | 
        get { 
 | 
            return this.m_CanvasAddition ?? (this.m_CanvasAddition = this.GetComponentInParent<CanvasAddition>()); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    Material materialRecorder; 
 | 
  
 | 
    [SerializeField] 
 | 
    bool m_Gray = false; 
 | 
    public bool gray { 
 | 
        get { 
 | 
            return this.m_Gray; 
 | 
        } 
 | 
        set { 
 | 
            if (this.gray == value) 
 | 
            { 
 | 
                return; 
 | 
            } 
 | 
  
 | 
            this.m_Gray = value; 
 | 
            if (!inited) 
 | 
            { 
 | 
                return; 
 | 
            } 
 | 
  
 | 
            if (this.m_Gray) 
 | 
            { 
 | 
                this.material = this.canvasAddition == null ? MaterialUtility.GetDefaultSpriteGrayMaterial() : this.canvasAddition.spriteGrayMaterial; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                this.material = materialRecorder; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    [SerializeField] string m_IconKey = string.Empty; 
 | 
  
 | 
    bool inited = false; 
 | 
    protected override void Awake() 
 | 
    { 
 | 
        base.Awake(); 
 | 
        materialRecorder = this.material; 
 | 
        inited = true; 
 | 
        if (this.m_Gray) 
 | 
        { 
 | 
            this.material = this.canvasAddition == null ? MaterialUtility.GetDefaultSpriteGrayMaterial() : this.canvasAddition.spriteGrayMaterial; 
 | 
        } 
 | 
  
 | 
        if (!string.IsNullOrEmpty(m_IconKey)) 
 | 
        { 
 | 
            this.SetSprite(m_IconKey); 
 | 
        } 
 | 
    } 
 | 
} 
 |