Example #1
0
        virtual protected void UpdateTexture()
        {
            if (_texture != null)
            {
                contentRect.width  = _texture.width;
                contentRect.height = _texture.height;

                if (_texture.root.alphaTexture != null)
                {
                    quadBatch.shader = ShaderConfig.GetGrayedVersion(ShaderConfig.combinedImageShader,
                                                                     ShaderConfig.IsGrayedVersion(quadBatch.shader));
                }
                else
                {
                    quadBatch.shader = ShaderConfig.GetGrayedVersion(ShaderConfig.imageShader,
                                                                     ShaderConfig.IsGrayedVersion(quadBatch.shader));
                }
            }
            else
            {
                contentRect.width  = 0;
                contentRect.height = 0;
            }
            _needRebuild      = true;
            quadBatch.texture = _texture;
            InvalidateBatchingState();
        }
        public void SetGrayed(bool value)
        {
            if (quadBatch == null)
            {
                return;
            }

            string shader = quadBatch.shader;

            quadBatch.shader = ShaderConfig.GetGrayedVersion(shader, value);
        }