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); }
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); }
public string ReadResourcePath(StyleValueHandle handle) { return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.ResourcePath, handle)); }
public string ReadEnum(StyleValueHandle handle) { return(StyleSheet.CheckAccess <string>(this.strings, StyleValueType.Enum, handle)); }
public Color ReadColor(StyleValueHandle handle) { return(StyleSheet.CheckAccess <Color>(this.colors, StyleValueType.Color, handle)); }
public string ReadResourcePath(StyleValueHandle handle) { return(CheckAccess(strings, StyleValueType.ResourcePath, handle)); }
public string ReadEnum(StyleValueHandle handle) { return(CheckAccess(strings, StyleValueType.Enum, handle)); }
public Color ReadColor(StyleValueHandle handle) { return(CheckAccess(colors, StyleValueType.Color, handle)); }
public bool TryReadResourcePath(StyleValueHandle handle, out string value) { return(StyleSheet.TryCheckAccess <string>(this.strings, StyleValueType.ResourcePath, handle, out value)); }
public float ReadFloat(StyleValueHandle handle) { return(CheckAccess(floats, StyleValueType.Float, handle)); }
public bool TryReadEnum(StyleValueHandle handle, out string value) { return(StyleSheet.TryCheckAccess <string>(this.strings, StyleValueType.Enum, handle, out value)); }
public bool TryReadColor(StyleValueHandle handle, out Color value) { return(StyleSheet.TryCheckAccess <Color>(this.colors, StyleValueType.Color, handle, out value)); }
public bool TryReadFloat(StyleValueHandle handle, out float value) { return(StyleSheet.TryCheckAccess <float>(this.floats, StyleValueType.Float, handle, out value)); }
public StyleValueKeyword ReadKeyword(StyleValueHandle handle) { return((StyleValueKeyword)handle.valueIndex); }
public string ReadString(StyleValueHandle handle) { return(CheckAccess(strings, StyleValueType.String, handle)); }
public float ReadFloat(StyleValueHandle handle) { return(StyleSheet.CheckAccess <float>(this.floats, StyleValueType.Float, handle)); }
public Object ReadAssetReference(StyleValueHandle handle) { return(CheckAccess(assets, StyleValueType.AssetReference, handle)); }