예제 #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));
 }