public bool Apply(Material m)
        {
            Shader sh = Shader.Find(shader);

            if (sh == null)
            {
                return(false);
            }

            m.shader = sh;
            var type = ShaderType.Resolve(sh.name);

            if (type == ShaderType.UNKNOWN)
            {
                return(false);
            }

            foreach (var colProp in type.colProps)
            {
                CCColor cc = null;
                switch (colProp.key)
                {
                case PropKey._Color:
                    cc = color;
                    break;

                case PropKey._ShadowColor:
                    cc = shadowColor;
                    break;

                case PropKey._RimColor:
                    cc = rimColor;
                    break;

                case PropKey._OutlineColor:
                    cc = outlineColor;
                    break;
//        _SpecColor,
//        _ReflectColor,
//        _Emission,
                }
                if (cc != null)
                {
                    m.SetColor(colProp.propId, cc.ToColor());
                }
            }

            foreach (var prop in type.fProps)
            {
                float?fVal = null;
                switch (prop.key)
                {
                case PropKey._Shininess:
                    fVal = shininess;
                    break;

                case PropKey._OutlineWidth:
                    fVal = outlineWidth;
                    break;

                case PropKey._RimPower:
                    fVal = rimPower;
                    break;

                case PropKey._RimShift:
                    fVal = rimShift;
                    break;

                case PropKey._HiRate:
                    fVal = hiRate;
                    break;

                case PropKey._HiPow:
                    fVal = hiPow;
                    break;

                case PropKey._Cutoff:
                    fVal = cutoff;
                    break;

                case PropKey._FloatValue1:
                    fVal = floatVal1;
                    break;

                case PropKey._FloatValue2:
                    fVal = floatVal2;
                    break;

                case PropKey._FloatValue3:
                    fVal = floatVal3;
                    break;
                }
                if (fVal.HasValue)
                {
                    m.SetFloat(prop.propId, fVal.Value);
                }
            }
            return(true);
        }
        public CCMaterial(Material m, ShaderType type) {
            name = m.name;
            shader = m.shader.name;
            
            foreach (var colProp in type.colProps) {
                var ccc = new CCColor(m.GetColor(colProp.propId));
                switch(colProp.key) {
                    case PropKey._Color:
                        color = ccc;
                        break;
                    case PropKey._ShadowColor:
                        shadowColor = ccc;
                        break;
                    case PropKey._RimColor:
                        rimColor = ccc;
                        break;
                    case PropKey._OutlineColor:
                        outlineColor = ccc;
                        break;
//        _SpecColor,
//        _ReflectColor,
//        _Emission,                        
                }                        
            }

            foreach (var prop in type.fProps) {
                var fVal = m.GetFloat(prop.propId);
                switch(prop.key) {
                    case PropKey._Shininess:
                        shininess = fVal;
                        break;
                    case PropKey._OutlineWidth:
                        outlineWidth = fVal;
                        break;
                    case PropKey._RimPower:
                        rimPower = fVal;
                        break;
                    case PropKey._RimShift:
                        rimShift = fVal;
                        break;
                    case PropKey._HiRate:
                        hiRate = fVal;
                        break;
                    case PropKey._HiPow:
                        hiPow = fVal;
                        break;
                    case PropKey._FloatValue1:
                        floatVal1 = fVal;
                        break;
                    case PropKey._FloatValue2:
                        floatVal2 = fVal;
                        break;
                    case PropKey._FloatValue3:
                        floatVal3 = fVal;
                        break;
                }                        
            }
        }        
        public CCMaterial(Material m, ShaderType type)
        {
            name   = m.name;
            shader = m.shader.name;

            foreach (var colProp in type.colProps)
            {
                var ccc = new CCColor(m.GetColor(colProp.propId));
                switch (colProp.key)
                {
                case PropKey._Color:
                    color = ccc;
                    break;

                case PropKey._ShadowColor:
                    shadowColor = ccc;
                    break;

                case PropKey._RimColor:
                    rimColor = ccc;
                    break;

                case PropKey._OutlineColor:
                    outlineColor = ccc;
                    break;
//        _SpecColor,
//        _ReflectColor,
//        _Emission,
                }
            }

            foreach (var prop in type.fProps)
            {
                var fVal = m.GetFloat(prop.propId);
                switch (prop.key)
                {
                case PropKey._Shininess:
                    shininess = fVal;
                    break;

                case PropKey._OutlineWidth:
                    outlineWidth = fVal;
                    break;

                case PropKey._RimPower:
                    rimPower = fVal;
                    break;

                case PropKey._RimShift:
                    rimShift = fVal;
                    break;

                case PropKey._HiRate:
                    hiRate = fVal;
                    break;

                case PropKey._HiPow:
                    hiPow = fVal;
                    break;

                case PropKey._Cutoff:
                    cutoff = fVal;
                    break;

                case PropKey._FloatValue1:
                    floatVal1 = fVal;
                    break;

                case PropKey._FloatValue2:
                    floatVal2 = fVal;
                    break;

                case PropKey._FloatValue3:
                    floatVal3 = fVal;
                    break;
                }
            }
        }
        // Token: 0x060001BA RID: 442 RVA: 0x000107BC File Offset: 0x0000E9BC
        public CCMaterial(Material m, ShaderType type)
        {
            this.name   = m.name;
            this.shader = m.shader.name;
            foreach (ShaderPropColor shaderPropColor in type.colProps)
            {
                CCColor cccolor = new CCColor(m.GetColor(shaderPropColor.propId));
                switch (shaderPropColor.key)
                {
                case PropKey._Color:
                    this.color = cccolor;
                    break;

                case PropKey._ShadowColor:
                    this.shadowColor = cccolor;
                    break;

                case PropKey._RimColor:
                    this.rimColor = cccolor;
                    break;

                case PropKey._OutlineColor:
                    this.outlineColor = cccolor;
                    break;
                }
            }
            foreach (ShaderPropFloat shaderPropFloat in type.fProps)
            {
                float @float = m.GetFloat(shaderPropFloat.propId);
                switch (shaderPropFloat.key)
                {
                case PropKey._Shininess:
                    this.shininess = new float?(@float);
                    break;

                case PropKey._OutlineWidth:
                    this.outlineWidth = new float?(@float);
                    break;

                case PropKey._RimPower:
                    this.rimPower = new float?(@float);
                    break;

                case PropKey._RimShift:
                    this.rimShift = new float?(@float);
                    break;

                case PropKey._HiRate:
                    this.hiRate = new float?(@float);
                    break;

                case PropKey._HiPow:
                    this.hiPow = new float?(@float);
                    break;

                case PropKey._FloatValue1:
                    this.floatVal1 = new float?(@float);
                    break;

                case PropKey._FloatValue2:
                    this.floatVal2 = new float?(@float);
                    break;

                case PropKey._FloatValue3:
                    this.floatVal3 = new float?(@float);
                    break;

                case PropKey._Cutoff:
                    this.cutoff = new float?(@float);
                    break;

                case PropKey._Cutout:
                    this.cutout = new float?(@float);
                    break;

                case PropKey._ZTest:
                    this.ztest = new float?(@float);
                    break;

                case PropKey._ZTest2:
                    this.ztest2 = new float?(@float);
                    break;

                case PropKey._ZTest2Alpha:
                    this.ztest2Alpha = new float?(@float);
                    break;
                }
            }
        }