Esempio n. 1
0
        protected override bool MatchColor()
        {
            var   value = current;
            Match match = s_HexColorRegex.Match(value);

            if (match.Success)
            {
                return(true);
            }

            match = s_RgbRegex.Match(value);
            if (match.Success)
            {
                return(true);
            }

            match = s_RgbaRegex.Match(value);
            if (match.Success)
            {
                return(true);
            }

            Color c = Color.clear;

            if (StyleSheetColor.TryGetColor(value, out c))
            {
                return(true);
            }

            return(false);
        }
        protected override bool MatchColor()
        {
            StylePropertyValue current = this.current;
            bool flag = current.handle.valueType == StyleValueType.Color;
            bool result;

            if (flag)
            {
                result = true;
            }
            else
            {
                bool flag2 = current.handle.valueType == StyleValueType.Enum;
                if (flag2)
                {
                    Color  clear = Color.clear;
                    string text  = current.sheet.ReadAsString(current.handle);
                    bool   flag3 = StyleSheetColor.TryGetColor(text.ToLower(), out clear);
                    if (flag3)
                    {
                        result = true;
                        return(result);
                    }
                }
                result = false;
            }
            return(result);
        }
Esempio n. 3
0
        private static bool MatchColor(Expression exp, string value)
        {
            Match match = s_HexColorRegex.Match(value);

            if (match.Success)
            {
                return(true);
            }

            match = s_RgbRegex.Match(value);
            if (match.Success)
            {
                return(true);
            }

            match = s_RgbaRegex.Match(value);
            if (match.Success)
            {
                return(true);
            }

            Color c = Color.clear;

            if (StyleSheetColor.TryGetColor(value, out c))
            {
                return(true);
            }

            return(false);
        }
        public StyleColor ReadStyleColor(int index)
        {
            var   value = m_Values[m_CurrentValueIndex + index];
            Color c     = Color.clear;

            if (value.handle.valueType == StyleValueType.Enum)
            {
                var colorName = value.sheet.ReadAsString(value.handle);
                StyleSheetColor.TryGetColor(colorName.ToLower(), out c);
            }
            else
            {
                c = value.sheet.ReadColor(value.handle);
            }
            return(new StyleColor(c));
        }
Esempio n. 5
0
        public StyleColor ReadStyleColor(int index)
        {
            StylePropertyValue stylePropertyValue = this.m_Values[this.m_CurrentValueIndex + index];
            Color v    = Color.clear;
            bool  flag = stylePropertyValue.handle.valueType == StyleValueType.Enum;

            if (flag)
            {
                string text = stylePropertyValue.sheet.ReadAsString(stylePropertyValue.handle);
                StyleSheetColor.TryGetColor(text.ToLower(), out v);
            }
            else
            {
                v = stylePropertyValue.sheet.ReadColor(stylePropertyValue.handle);
            }
            return(new StyleColor(v));
        }
        public static StyleColor ReadStyleColor(this StyleSheet sheet, StyleValueHandle handle, int specificity)
        {
            Color c = Color.clear;

            if (handle.valueType == StyleValueType.Enum)
            {
                var colorName = sheet.ReadAsString(handle);
                StyleSheetColor.TryGetColor(colorName.ToLower(), out c);
            }
            else
            {
                c = sheet.ReadColor(handle);
            }
            return(new StyleColor(c)
            {
                specificity = specificity
            });
        }
Esempio n. 7
0
        protected override bool MatchColor()
        {
            var value = current;

            if (value.handle.valueType == StyleValueType.Color)
            {
                return(true);
            }

            if (value.handle.valueType == StyleValueType.Enum)
            {
                Color c         = Color.clear;
                var   colorName = value.sheet.ReadAsString(value.handle);
                if (StyleSheetColor.TryGetColor(colorName.ToLower(), out c))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 8
0
        protected override bool MatchColor()
        {
            string current = this.current;
            Match  match   = StyleMatcher.s_HexColorRegex.Match(current);
            bool   success = match.Success;
            bool   result;

            if (success)
            {
                result = true;
            }
            else
            {
                match = StyleMatcher.s_RgbRegex.Match(current);
                bool success2 = match.Success;
                if (success2)
                {
                    result = true;
                }
                else
                {
                    match = StyleMatcher.s_RgbaRegex.Match(current);
                    bool success3 = match.Success;
                    if (success3)
                    {
                        result = true;
                    }
                    else
                    {
                        Color clear = Color.clear;
                        bool  flag  = StyleSheetColor.TryGetColor(current, out clear);
                        result = flag;
                    }
                }
            }
            return(result);
        }