using System; using UnityEngine.StyleSheets; namespace UnityEngine.Experimental.UIElements.StyleSheets { // Token: 0x02000371 RID: 881 internal static class StyleSheetExtensions { // Token: 0x06003556 RID: 13654 RVA: 0x0005920C File Offset: 0x0005740C public static void Apply(this StyleSheet sheet, StyleValueHandle handle, int specificity, ref Style property) { if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2) { StyleSheetExtensions.Apply(0f, specificity, ref property); } else { StyleSheetExtensions.Apply(sheet.ReadFloat(handle), specificity, ref property); } } // Token: 0x06003557 RID: 13655 RVA: 0x0005924C File Offset: 0x0005744C public static void Apply(this StyleSheet sheet, StyleValueHandle handle, int specificity, ref Style property) { if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2) { StyleSheetExtensions.Apply(default(Color), specificity, ref property); } else { StyleSheetExtensions.Apply(sheet.ReadColor(handle), specificity, ref property); } } // Token: 0x06003558 RID: 13656 RVA: 0x0005929C File Offset: 0x0005749C public static void Apply(this StyleSheet sheet, StyleValueHandle handle, int specificity, ref Style property) { if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2) { StyleSheetExtensions.Apply(0, specificity, ref property); } else { StyleSheetExtensions.Apply((int)sheet.ReadFloat(handle), specificity, ref property); } } // Token: 0x06003559 RID: 13657 RVA: 0x000592D8 File Offset: 0x000574D8 public static void Apply(this StyleSheet sheet, StyleValueHandle handle, int specificity, ref Style property) { bool flag = sheet.ReadKeyword(handle) == StyleValueKeyword.True; if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2) { StyleSheetExtensions.Apply(false, specificity, ref property); } else { StyleSheetExtensions.Apply(flag, specificity, ref property); } } // Token: 0x0600355A RID: 13658 RVA: 0x00059324 File Offset: 0x00057524 public static void Apply(this StyleSheet sheet, StyleValueHandle handle, int specificity, ref Style property) where T : struct { if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2) { StyleSheetExtensions.Apply(0, specificity, ref property); } else { StyleSheetExtensions.Apply(StyleSheetCache.GetEnumValue(sheet, handle), specificity, ref property); } } // Token: 0x0600355B RID: 13659 RVA: 0x00059360 File Offset: 0x00057560 public static void Apply(this StyleSheet sheet, StyleValueHandle handle, int specificity, LoadResourceFunction loadResourceFunc, ref Style property) where T : Object { if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 5) { StyleSheetExtensions.Apply((T)((object)null), specificity, ref property); } else { string text = sheet.ReadResourcePath(handle); if (!string.IsNullOrEmpty(text)) { T t = loadResourceFunc(text, typeof(T)) as T; if (t != null) { StyleSheetExtensions.Apply(t, specificity, ref property); } else { Debug.LogWarning(string.Format("{0} resource not found for path: {1}", typeof(T).Name, text)); } } } } // Token: 0x0600355C RID: 13660 RVA: 0x00059410 File Offset: 0x00057610 private static void Apply(T val, int specificity, ref Style property) { property.Apply(new Style(val, specificity), StylePropertyApplyMode.CopyIfMoreSpecific); } // Token: 0x0600355D RID: 13661 RVA: 0x00059424 File Offset: 0x00057624 public static string ReadAsString(this StyleSheet sheet, StyleValueHandle handle) { string text = string.Empty; switch (handle.valueType) { case StyleValueType.Keyword: text = sheet.ReadKeyword(handle).ToString(); break; case StyleValueType.Float: text = sheet.ReadFloat(handle).ToString(); break; case StyleValueType.Color: text = sheet.ReadColor(handle).ToString(); break; case StyleValueType.ResourcePath: text = sheet.ReadResourcePath(handle); break; case StyleValueType.Enum: text = sheet.ReadEnum(handle); break; case StyleValueType.String: text = sheet.ReadString(handle); break; default: throw new ArgumentException("Unhandled type " + handle.valueType); } return text; } } }