private void Init() { if (m_IsInit == false) { if (GrayMat == null) { if (m_matKey == "") { Shader s = ResourceManger.LoadShader("UI/UIGrayScale"); if (s != null) { GrayMat = new Material(s); } } else { GrayMat = ShareMaterialM.GetMaterial(m_matKey); if (GrayMat == null) { Shader s = ResourceManger.LoadShader("UI/UIGrayScale"); if (s != null) { GrayMat = new Material(s); } ShareMaterialM.AddMaterial(m_matKey, GrayMat); } } } img = gameObject.GetComponent <Image>(); if (null != img) { MatImg = img.material == null ? null : img.material; } m_IsInit = true; } }
public void Init(string Restype, string ResName) { m_matKey = ShareMaterialM.GetKey(Restype, ResName, m_AtlasName); }