Пример #1
0
        private static T CheckAccess <T>(T[] list, StyleValueType type, StyleValueHandle handle)
        {
            T result = default(T);

            if (handle.valueType != type)
            {
                Debug.LogErrorFormat("Trying to read value of type {0} while reading a value of type {1}", new object[]
                {
                    type,
                    handle.valueType
                });
            }
            else if (handle.valueIndex < 0 && handle.valueIndex >= list.Length)
            {
                Debug.LogError("Accessing invalid property");
            }
            else
            {
                result = list[handle.valueIndex];
            }
            return(result);
        }
Пример #2
0
        private static bool TryCheckAccess <T>(T[] list, StyleValueType type, StyleValueHandle[] handles, int index, out T value)
        {
            bool result = false;

            value = default(T);
            if (index < handles.Length)
            {
                StyleValueHandle styleValueHandle = handles[index];
                if (styleValueHandle.valueType == type && styleValueHandle.valueIndex >= 0 && styleValueHandle.valueIndex < list.Length)
                {
                    value  = list[styleValueHandle.valueIndex];
                    result = true;
                }
                else
                {
                    Debug.LogErrorFormat("Trying to read value of type {0} while reading a value of type {1}", new object[]
                    {
                        type,
                        styleValueHandle.valueType
                    });
                }
            }
            return(result);
        }
Пример #3
0
 public string ReadResourcePath(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.ResourcePath, handle));
 }
Пример #4
0
 public string ReadEnum(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.Enum, handle));
 }
Пример #5
0
 public Color ReadColor(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <Color>(this.colors, StyleValueType.Color, handle));
 }
Пример #6
0
 public string ReadResourcePath(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.ResourcePath, handle));
 }
Пример #7
0
 public string ReadEnum(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.Enum, handle));
 }
Пример #8
0
 public Color ReadColor(StyleValueHandle handle)
 {
     return(CheckAccess(colors, StyleValueType.Color, handle));
 }
Пример #9
0
 public bool TryReadResourcePath(StyleValueHandle handle, out string value)
 {
     return(StyleSheet.TryCheckAccess <string>(this.strings, StyleValueType.ResourcePath, handle, out value));
 }
Пример #10
0
 public float ReadFloat(StyleValueHandle handle)
 {
     return(CheckAccess(floats, StyleValueType.Float, handle));
 }
Пример #11
0
 public bool TryReadEnum(StyleValueHandle handle, out string value)
 {
     return(StyleSheet.TryCheckAccess <string>(this.strings, StyleValueType.Enum, handle, out value));
 }
Пример #12
0
 public bool TryReadColor(StyleValueHandle handle, out Color value)
 {
     return(StyleSheet.TryCheckAccess <Color>(this.colors, StyleValueType.Color, handle, out value));
 }
Пример #13
0
 public bool TryReadFloat(StyleValueHandle handle, out float value)
 {
     return(StyleSheet.TryCheckAccess <float>(this.floats, StyleValueType.Float, handle, out value));
 }
Пример #14
0
 public StyleValueKeyword ReadKeyword(StyleValueHandle handle)
 {
     return((StyleValueKeyword)handle.valueIndex);
 }
Пример #15
0
 public string ReadString(StyleValueHandle handle)
 {
     return(CheckAccess(strings, StyleValueType.String, handle));
 }
Пример #16
0
 public float ReadFloat(StyleValueHandle handle)
 {
     return(StyleSheet.CheckAccess <float>(this.floats, StyleValueType.Float, handle));
 }
Пример #17
0
 public Object ReadAssetReference(StyleValueHandle handle)
 {
     return(CheckAccess(assets, StyleValueType.AssetReference, handle));
 }