Esempio n. 1
0
    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;
        }
    }
Esempio n. 2
0
 public void Init(string Restype, string ResName)
 {
     m_matKey = ShareMaterialM.GetKey(Restype, ResName, m_AtlasName);
 }