Esempio n. 1
0
        static T CheckAccess <T>(T[] list, StyleValueType type, StyleValueHandle handle)
        {
            T value = default(T);

            if (handle.valueType != type)
            {
                Debug.LogErrorFormat("Trying to read value of type {0} while reading a value of type {1}", type, handle.valueType);
            }
            else if (list == null || handle.valueIndex < 0 || handle.valueIndex >= list.Length)
            {
                Debug.LogError("Accessing invalid property");
            }
            else
            {
                value = list[handle.valueIndex];
            }
            return(value);
        }
Esempio n. 2
0
        private static bool TryCheckAccess <T>(T[] list, StyleValueType type, StyleValueHandle handle, out T value)
        {
            bool result = false;

            value = default(T);
            bool flag = handle.valueType == type && handle.valueIndex >= 0 && handle.valueIndex < list.Length;

            if (flag)
            {
                value  = list[handle.valueIndex];
                result = true;
            }
            else
            {
                Debug.LogErrorFormat("Trying to read value of type {0} while reading a value of type {1}", new object[]
                {
                    type,
                    handle.valueType
                });
            }
            return(result);
        }
Esempio n. 3
0
 internal StyleValueKeyword ReadKeyword(StyleValueHandle handle)
 {
     return((StyleValueKeyword)handle.valueIndex);
 }
Esempio n. 4
0
 internal StyleValueFunction ReadFunction(StyleValueHandle handle)
 {
     return((StyleValueFunction)handle.valueIndex);
 }
Esempio n. 5
0
 internal string ReadFunctionName(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.Function, handle));
 }
Esempio n. 6
0
 internal bool TryReadResourcePath(StyleValueHandle handle, out string value)
 {
     return(StyleSheet.TryCheckAccess <string>(this.strings, StyleValueType.ResourcePath, handle, out value));
 }
Esempio n. 7
0
 internal string ReadMissingAssetReferenceUrl(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.MissingAssetReference, handle));
 }
Esempio n. 8
0
 internal string ReadEnum(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.Enum, handle));
 }
Esempio n. 9
0
 internal bool TryReadVariable(StyleValueHandle handle, out string value)
 {
     return(StyleSheet.TryCheckAccess <string>(this.strings, StyleValueType.Variable, handle, out value));
 }
Esempio n. 10
0
 internal string ReadVariable(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.Variable, handle));
 }
Esempio n. 11
0
 internal bool TryReadVariable(StyleValueHandle handle, out string value)
 {
     return(TryCheckAccess(strings, StyleValueType.Variable, handle, out value));
 }
Esempio n. 12
0
 internal string ReadEnum(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.Enum, handle));
 }
Esempio n. 13
0
 internal bool TryReadEnum(StyleValueHandle handle, out string value)
 {
     return(TryCheckAccess(strings, StyleValueType.Enum, handle, out value));
 }
Esempio n. 14
0
 internal string ReadString(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.String, handle));
 }
Esempio n. 15
0
 internal bool TryReadColor(StyleValueHandle handle, out Color value)
 {
     return(TryCheckAccess(colors, StyleValueType.Color, handle, out value));
 }
Esempio n. 16
0
 internal Color ReadColor(StyleValueHandle handle)
 {
     return(CheckAccess(colors, StyleValueType.Color, handle));
 }
Esempio n. 17
0
 internal Color ReadColor(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <Color>(this.colors, StyleValueType.Color, handle));
 }
Esempio n. 18
0
 internal string ReadResourcePath(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.ResourcePath, handle));
 }
Esempio n. 19
0
 internal bool TryReadColor(StyleValueHandle handle, out Color value)
 {
     return(StyleSheet.TryCheckAccess <Color>(this.colors, StyleValueType.Color, handle, out value));
 }
Esempio n. 20
0
 internal bool TryReadResourcePath(StyleValueHandle handle, out string value)
 {
     return(TryCheckAccess(strings, StyleValueType.ResourcePath, handle, out value));
 }
Esempio n. 21
0
 internal string ReadVariable(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.Variable, handle));
 }
Esempio n. 22
0
 internal Object ReadAssetReference(StyleValueHandle handle)
 {
     return(CheckAccess(assets, StyleValueType.AssetReference, handle));
 }
Esempio n. 23
0
 internal string ReadResourcePath(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.ResourcePath, handle));
 }
Esempio n. 24
0
 internal bool TryReadAssetReference(StyleValueHandle handle, out Object value)
 {
     return(TryCheckAccess(assets, StyleValueType.AssetReference, handle, out value));
 }
Esempio n. 25
0
 internal UnityEngine.Object ReadAssetReference(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <UnityEngine.Object>(this.assets, StyleValueType.AssetReference, handle));
 }
Esempio n. 26
0
 internal string ReadMissingAssetReferenceUrl(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.MissingAssetReference, handle));
 }
Esempio n. 27
0
 internal bool TryReadAssetReference(StyleValueHandle handle, out UnityEngine.Object value)
 {
     return(StyleSheet.TryCheckAccess <UnityEngine.Object>(this.assets, StyleValueType.AssetReference, handle, out value));
 }
Esempio n. 28
0
        private void SetupReferences()
        {
            bool flag = this.complexSelectors == null || this.rules == null;

            if (!flag)
            {
                StyleRule[] rules = this.rules;
                for (int i = 0; i < rules.Length; i++)
                {
                    StyleRule       styleRule  = rules[i];
                    StyleProperty[] properties = styleRule.properties;
                    for (int j = 0; j < properties.Length; j++)
                    {
                        StyleProperty styleProperty = properties[j];
                        bool          flag2         = StyleSheet.CustomStartsWith(styleProperty.name, StyleSheet.kCustomPropertyMarker);
                        if (flag2)
                        {
                            styleRule.customPropertiesCount++;
                            styleProperty.isCustomProperty = true;
                        }
                        StyleValueHandle[] values = styleProperty.values;
                        for (int k = 0; k < values.Length; k++)
                        {
                            StyleValueHandle handle = values[k];
                            bool             flag3  = handle.IsVarFunction();
                            if (flag3)
                            {
                                styleProperty.requireVariableResolve = true;
                                break;
                            }
                        }
                    }
                }
                int l   = 0;
                int num = this.complexSelectors.Length;
                while (l < num)
                {
                    this.complexSelectors[l].CachePseudoStateMasks();
                    l++;
                }
                this.orderedClassSelectors = new Dictionary <string, StyleComplexSelector>(StringComparer.Ordinal);
                this.orderedNameSelectors  = new Dictionary <string, StyleComplexSelector>(StringComparer.Ordinal);
                this.orderedTypeSelectors  = new Dictionary <string, StyleComplexSelector>(StringComparer.Ordinal);
                int m = 0;
                while (m < this.complexSelectors.Length)
                {
                    StyleComplexSelector styleComplexSelector = this.complexSelectors[m];
                    bool flag4 = styleComplexSelector.ruleIndex < this.rules.Length;
                    if (flag4)
                    {
                        styleComplexSelector.rule = this.rules[styleComplexSelector.ruleIndex];
                    }
                    styleComplexSelector.orderInStyleSheet = m;
                    StyleSelector     styleSelector     = styleComplexSelector.selectors[styleComplexSelector.selectors.Length - 1];
                    StyleSelectorPart styleSelectorPart = styleSelector.parts[0];
                    string            key = styleSelectorPart.value;
                    Dictionary <string, StyleComplexSelector> dictionary = null;
                    switch (styleSelectorPart.type)
                    {
                    case StyleSelectorType.Wildcard:
                    case StyleSelectorType.Type:
                        key        = (styleSelectorPart.value ?? "*");
                        dictionary = this.orderedTypeSelectors;
                        break;

                    case StyleSelectorType.Class:
                        dictionary = this.orderedClassSelectors;
                        break;

                    case StyleSelectorType.PseudoClass:
                        key        = "*";
                        dictionary = this.orderedTypeSelectors;
                        break;

                    case StyleSelectorType.RecursivePseudoClass:
                        goto IL_22B;

                    case StyleSelectorType.ID:
                        dictionary = this.orderedNameSelectors;
                        break;

                    default:
                        goto IL_22B;
                    }
IL_249:
                    bool flag5 = dictionary != null;
                    if (flag5)
                    {
                        StyleComplexSelector nextInTable;
                        bool flag6 = dictionary.TryGetValue(key, out nextInTable);
                        if (flag6)
                        {
                            styleComplexSelector.nextInTable = nextInTable;
                        }
                        dictionary[key] = styleComplexSelector;
                    }
                    m++;
                    continue;
IL_22B:
                    Debug.LogError(string.Format("Invalid first part type {0}", styleSelectorPart.type));
                    goto IL_249;
                }
            }
        }
Esempio n. 29
0
 internal ScalableImage ReadScalableImage(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <ScalableImage>(this.scalableImages, StyleValueType.ScalableImage, handle));
 }
Esempio n. 30
0
 internal ScalableImage ReadScalableImage(StyleValueHandle handle)
 {
     return(CheckAccess(scalableImages, StyleValueType.ScalableImage, handle));
 }