using System; using System.Collections.Generic; using UnityEngine.Experimental.UIElements.StyleEnums; using UnityEngine.StyleSheets; namespace UnityEngine.Experimental.UIElements.StyleSheets { // Token: 0x02000370 RID: 880 internal class VisualElementStyles : ICustomStyles { // Token: 0x06003546 RID: 13638 RVA: 0x000582E4 File Offset: 0x000564E4 internal VisualElementStyles(bool isShared) { this.isShared = isShared; } // Token: 0x06003547 RID: 13639 RVA: 0x000582F4 File Offset: 0x000564F4 public VisualElementStyles(VisualElementStyles other, bool isShared) : this(isShared) { this.Apply(other, StylePropertyApplyMode.Copy); } // Token: 0x06003548 RID: 13640 RVA: 0x00058308 File Offset: 0x00056508 internal void Apply(VisualElementStyles other, StylePropertyApplyMode mode) { this.m_CustomProperties = other.m_CustomProperties; this.width.Apply(other.width, mode); this.height.Apply(other.height, mode); this.maxWidth.Apply(other.maxWidth, mode); this.maxHeight.Apply(other.maxHeight, mode); this.minWidth.Apply(other.minWidth, mode); this.minHeight.Apply(other.minHeight, mode); this.flex.Apply(other.flex, mode); this.overflow.Apply(other.overflow, mode); this.positionLeft.Apply(other.positionLeft, mode); this.positionTop.Apply(other.positionTop, mode); this.positionRight.Apply(other.positionRight, mode); this.positionBottom.Apply(other.positionBottom, mode); this.marginLeft.Apply(other.marginLeft, mode); this.marginTop.Apply(other.marginTop, mode); this.marginRight.Apply(other.marginRight, mode); this.marginBottom.Apply(other.marginBottom, mode); this.borderLeft.Apply(other.borderLeft, mode); this.borderTop.Apply(other.borderTop, mode); this.borderRight.Apply(other.borderRight, mode); this.borderBottom.Apply(other.borderBottom, mode); this.paddingLeft.Apply(other.paddingLeft, mode); this.paddingTop.Apply(other.paddingTop, mode); this.paddingRight.Apply(other.paddingRight, mode); this.paddingBottom.Apply(other.paddingBottom, mode); this.positionType.Apply(other.positionType, mode); this.alignSelf.Apply(other.alignSelf, mode); this.textAlignment.Apply(other.textAlignment, mode); this.fontStyle.Apply(other.fontStyle, mode); this.textClipping.Apply(other.textClipping, mode); this.fontSize.Apply(other.fontSize, mode); this.font.Apply(other.font, mode); this.wordWrap.Apply(other.wordWrap, mode); this.textColor.Apply(other.textColor, mode); this.flexDirection.Apply(other.flexDirection, mode); this.backgroundColor.Apply(other.backgroundColor, mode); this.borderColor.Apply(other.borderColor, mode); this.backgroundImage.Apply(other.backgroundImage, mode); this.backgroundSize.Apply(other.backgroundSize, mode); this.alignItems.Apply(other.alignItems, mode); this.alignContent.Apply(other.alignContent, mode); this.justifyContent.Apply(other.justifyContent, mode); this.flexWrap.Apply(other.flexWrap, mode); this.borderWidth.Apply(other.borderWidth, mode); this.borderRadius.Apply(other.borderRadius, mode); this.sliceLeft.Apply(other.sliceLeft, mode); this.sliceTop.Apply(other.sliceTop, mode); this.sliceRight.Apply(other.sliceRight, mode); this.sliceBottom.Apply(other.sliceBottom, mode); this.opacity.Apply(other.opacity, mode); } // Token: 0x06003549 RID: 13641 RVA: 0x00058694 File Offset: 0x00056894 public void WriteToGUIStyle(GUIStyle style) { style.alignment = (TextAnchor)this.textAlignment.GetSpecifiedValueOrDefault((int)style.alignment); style.wordWrap = this.wordWrap.GetSpecifiedValueOrDefault(style.wordWrap); style.clipping = (TextClipping)this.textClipping.GetSpecifiedValueOrDefault((int)style.clipping); if (this.font.value != null) { style.font = this.font.value; } style.fontSize = this.fontSize.GetSpecifiedValueOrDefault(style.fontSize); style.fontStyle = (FontStyle)this.fontStyle.GetSpecifiedValueOrDefault((int)style.fontStyle); this.AssignRect(style.margin, ref this.marginLeft, ref this.marginTop, ref this.marginRight, ref this.marginBottom); this.AssignRect(style.padding, ref this.paddingLeft, ref this.paddingTop, ref this.paddingRight, ref this.paddingBottom); this.AssignRect(style.border, ref this.sliceLeft, ref this.sliceTop, ref this.sliceRight, ref this.sliceBottom); this.AssignState(style.normal); this.AssignState(style.focused); this.AssignState(style.hover); this.AssignState(style.active); this.AssignState(style.onNormal); this.AssignState(style.onFocused); this.AssignState(style.onHover); this.AssignState(style.onActive); } // Token: 0x0600354A RID: 13642 RVA: 0x0005880C File Offset: 0x00056A0C private void AssignState(GUIStyleState state) { state.textColor = this.textColor.GetSpecifiedValueOrDefault(state.textColor); if (this.backgroundImage.value != null) { state.background = this.backgroundImage.value; } } // Token: 0x0600354B RID: 13643 RVA: 0x0005885C File Offset: 0x00056A5C private void AssignRect(RectOffset rect, ref Style left, ref Style top, ref Style right, ref Style bottom) { rect.left = left.GetSpecifiedValueOrDefault(rect.left); rect.top = top.GetSpecifiedValueOrDefault(rect.top); rect.right = right.GetSpecifiedValueOrDefault(rect.right); rect.bottom = bottom.GetSpecifiedValueOrDefault(rect.bottom); } // Token: 0x0600354C RID: 13644 RVA: 0x000588B4 File Offset: 0x00056AB4 private void AssignRect(RectOffset rect, ref Style left, ref Style top, ref Style right, ref Style bottom) { rect.left = (int)left.GetSpecifiedValueOrDefault((float)rect.left); rect.top = (int)top.GetSpecifiedValueOrDefault((float)rect.top); rect.right = (int)right.GetSpecifiedValueOrDefault((float)rect.right); rect.bottom = (int)bottom.GetSpecifiedValueOrDefault((float)rect.bottom); } // Token: 0x0600354D RID: 13645 RVA: 0x00058914 File Offset: 0x00056B14 internal void ApplyRule(StyleSheet registry, int specificity, StyleRule rule, StylePropertyID[] propertyIDs, LoadResourceFunction loadResourceFunc) { for (int i = 0; i < rule.properties.Length; i++) { StyleProperty styleProperty = rule.properties[i]; StylePropertyID stylePropertyID = propertyIDs[i]; StyleValueHandle styleValueHandle = styleProperty.values[0]; switch (stylePropertyID) { case StylePropertyID.MarginLeft: registry.Apply(styleValueHandle, specificity, ref this.marginLeft); break; case StylePropertyID.MarginTop: registry.Apply(styleValueHandle, specificity, ref this.marginTop); break; case StylePropertyID.MarginRight: registry.Apply(styleValueHandle, specificity, ref this.marginRight); break; case StylePropertyID.MarginBottom: registry.Apply(styleValueHandle, specificity, ref this.marginBottom); break; case StylePropertyID.PaddingLeft: registry.Apply(styleValueHandle, specificity, ref this.paddingLeft); break; case StylePropertyID.PaddingTop: registry.Apply(styleValueHandle, specificity, ref this.paddingTop); break; case StylePropertyID.PaddingRight: registry.Apply(styleValueHandle, specificity, ref this.paddingRight); break; case StylePropertyID.PaddingBottom: registry.Apply(styleValueHandle, specificity, ref this.paddingBottom); break; case StylePropertyID.BorderLeft: registry.Apply(styleValueHandle, specificity, ref this.borderLeft); break; case StylePropertyID.BorderTop: registry.Apply(styleValueHandle, specificity, ref this.borderTop); break; case StylePropertyID.BorderRight: registry.Apply(styleValueHandle, specificity, ref this.borderRight); break; case StylePropertyID.BorderBottom: registry.Apply(styleValueHandle, specificity, ref this.borderBottom); break; case StylePropertyID.PositionType: registry.Apply(styleValueHandle, specificity, ref this.positionType); break; case StylePropertyID.PositionLeft: registry.Apply(styleValueHandle, specificity, ref this.positionLeft); break; case StylePropertyID.PositionTop: registry.Apply(styleValueHandle, specificity, ref this.positionTop); break; case StylePropertyID.PositionRight: registry.Apply(styleValueHandle, specificity, ref this.positionRight); break; case StylePropertyID.PositionBottom: registry.Apply(styleValueHandle, specificity, ref this.positionBottom); break; case StylePropertyID.Width: registry.Apply(styleValueHandle, specificity, ref this.width); break; case StylePropertyID.Height: registry.Apply(styleValueHandle, specificity, ref this.height); break; case StylePropertyID.MinWidth: registry.Apply(styleValueHandle, specificity, ref this.minWidth); break; case StylePropertyID.MinHeight: registry.Apply(styleValueHandle, specificity, ref this.minHeight); break; case StylePropertyID.MaxWidth: registry.Apply(styleValueHandle, specificity, ref this.maxWidth); break; case StylePropertyID.MaxHeight: registry.Apply(styleValueHandle, specificity, ref this.maxHeight); break; case StylePropertyID.Flex: registry.Apply(styleValueHandle, specificity, ref this.flex); break; case StylePropertyID.BorderWidth: registry.Apply(styleValueHandle, specificity, ref this.borderWidth); break; case StylePropertyID.BorderRadius: registry.Apply(styleValueHandle, specificity, ref this.borderRadius); break; case StylePropertyID.FlexDirection: registry.Apply(styleValueHandle, specificity, ref this.flexDirection); break; case StylePropertyID.FlexWrap: registry.Apply(styleValueHandle, specificity, ref this.flexWrap); break; case StylePropertyID.JustifyContent: registry.Apply(styleValueHandle, specificity, ref this.justifyContent); break; case StylePropertyID.AlignContent: registry.Apply(styleValueHandle, specificity, ref this.alignContent); break; case StylePropertyID.AlignSelf: registry.Apply(styleValueHandle, specificity, ref this.alignSelf); break; case StylePropertyID.AlignItems: registry.Apply(styleValueHandle, specificity, ref this.alignItems); break; case StylePropertyID.TextAlignment: registry.Apply(styleValueHandle, specificity, ref this.textAlignment); break; case StylePropertyID.TextClipping: registry.Apply(styleValueHandle, specificity, ref this.textClipping); break; case StylePropertyID.Font: registry.Apply(styleValueHandle, specificity, loadResourceFunc, ref this.font); break; case StylePropertyID.FontSize: registry.Apply(styleValueHandle, specificity, ref this.fontSize); break; case StylePropertyID.FontStyle: registry.Apply(styleValueHandle, specificity, ref this.fontStyle); break; case StylePropertyID.BackgroundSize: registry.Apply(styleValueHandle, specificity, ref this.backgroundSize); break; case StylePropertyID.WordWrap: registry.Apply(styleValueHandle, specificity, ref this.wordWrap); break; case StylePropertyID.BackgroundImage: registry.Apply(styleValueHandle, specificity, loadResourceFunc, ref this.backgroundImage); break; case StylePropertyID.TextColor: registry.Apply(styleValueHandle, specificity, ref this.textColor); break; case StylePropertyID.BackgroundColor: registry.Apply(styleValueHandle, specificity, ref this.backgroundColor); break; case StylePropertyID.BorderColor: registry.Apply(styleValueHandle, specificity, ref this.borderColor); break; case StylePropertyID.Overflow: registry.Apply(styleValueHandle, specificity, ref this.overflow); break; case StylePropertyID.SliceLeft: registry.Apply(styleValueHandle, specificity, ref this.sliceLeft); break; case StylePropertyID.SliceTop: registry.Apply(styleValueHandle, specificity, ref this.sliceTop); break; case StylePropertyID.SliceRight: registry.Apply(styleValueHandle, specificity, ref this.sliceRight); break; case StylePropertyID.SliceBottom: registry.Apply(styleValueHandle, specificity, ref this.sliceBottom); break; case StylePropertyID.Opacity: registry.Apply(styleValueHandle, specificity, ref this.opacity); break; case StylePropertyID.Custom: { if (this.m_CustomProperties == null) { this.m_CustomProperties = new Dictionary(); } CustomProperty customProperty = default(CustomProperty); if (!this.m_CustomProperties.TryGetValue(styleProperty.name, out customProperty) || specificity >= customProperty.specificity) { customProperty.handle = styleValueHandle; customProperty.data = registry; customProperty.specificity = specificity; this.m_CustomProperties[styleProperty.name] = customProperty; } break; } default: throw new ArgumentException(string.Format("Non exhaustive switch statement (value={0})", stylePropertyID)); } } } // Token: 0x0600354E RID: 13646 RVA: 0x00058E68 File Offset: 0x00057068 public void ApplyCustomProperty(string propertyName, ref Style target) { Style style = new Style(0f); CustomProperty customProperty; if (this.m_CustomProperties != null && this.m_CustomProperties.TryGetValue(propertyName, out customProperty)) { if (customProperty.handle.valueType == StyleValueType.Float) { customProperty.data.Apply(customProperty.handle, customProperty.specificity, ref style); } else { Debug.LogWarning(string.Format("Trying to read value as float while parsed type is {0}", customProperty.handle.valueType)); } } target.Apply(style, StylePropertyApplyMode.CopyIfNotInline); } // Token: 0x0600354F RID: 13647 RVA: 0x00058F04 File Offset: 0x00057104 public void ApplyCustomProperty(string propertyName, ref Style target) { Style style = new Style(0); CustomProperty customProperty; if (this.m_CustomProperties != null && this.m_CustomProperties.TryGetValue(propertyName, out customProperty)) { if (customProperty.handle.valueType == StyleValueType.Float) { customProperty.data.Apply(customProperty.handle, customProperty.specificity, ref style); } else { Debug.LogWarning(string.Format("Trying to read value as int while parsed type is {0}", customProperty.handle.valueType)); } } target.Apply(style, StylePropertyApplyMode.CopyIfNotInline); } // Token: 0x06003550 RID: 13648 RVA: 0x00058F9C File Offset: 0x0005719C public void ApplyCustomProperty(string propertyName, ref Style target) { Style style = new Style(false); CustomProperty customProperty; if (this.m_CustomProperties != null && this.m_CustomProperties.TryGetValue(propertyName, out customProperty)) { if (customProperty.handle.valueType == StyleValueType.Keyword) { customProperty.data.Apply(customProperty.handle, customProperty.specificity, ref style); } else { Debug.LogWarning(string.Format("Trying to read value as bool while parsed type is {0}", customProperty.handle.valueType)); } } target.Apply(style, StylePropertyApplyMode.CopyIfNotInline); } // Token: 0x06003551 RID: 13649 RVA: 0x00059030 File Offset: 0x00057230 public void ApplyCustomProperty(string propertyName, ref Style target) { Style style = new Style(Color.clear); CustomProperty customProperty; if (this.m_CustomProperties != null && this.m_CustomProperties.TryGetValue(propertyName, out customProperty)) { if (customProperty.handle.valueType == StyleValueType.Color) { customProperty.data.Apply(customProperty.handle, customProperty.specificity, ref style); } else { Debug.LogWarning(string.Format("Trying to read value as Color while parsed type is {0}", customProperty.handle.valueType)); } } target.Apply(style, StylePropertyApplyMode.CopyIfNotInline); } // Token: 0x06003552 RID: 13650 RVA: 0x000590CC File Offset: 0x000572CC public void ApplyCustomProperty(string propertyName, ref Style target) where T : Object { this.ApplyCustomProperty(propertyName, new LoadResourceFunction(Resources.Load), ref target); } // Token: 0x06003553 RID: 13651 RVA: 0x000590F4 File Offset: 0x000572F4 public void ApplyCustomProperty(string propertyName, LoadResourceFunction function, ref Style target) where T : Object { Style style = new Style((T)((object)null)); CustomProperty customProperty; if (this.m_CustomProperties != null && this.m_CustomProperties.TryGetValue(propertyName, out customProperty)) { if (customProperty.handle.valueType == StyleValueType.ResourcePath) { customProperty.data.Apply(customProperty.handle, customProperty.specificity, function, ref style); } else { Debug.LogWarning(string.Format("Trying to read value as Object while parsed type is {0}", customProperty.handle.valueType)); } } target.Apply(style, StylePropertyApplyMode.CopyIfNotInline); } // Token: 0x06003554 RID: 13652 RVA: 0x00059190 File Offset: 0x00057390 public void ApplyCustomProperty(string propertyName, ref Style target) { Style style = new Style(string.Empty); CustomProperty customProperty; if (this.m_CustomProperties != null && this.m_CustomProperties.TryGetValue(propertyName, out customProperty)) { style.value = customProperty.data.ReadAsString(customProperty.handle); style.specificity = customProperty.specificity; } target.Apply(style, StylePropertyApplyMode.CopyIfNotInline); } // Token: 0x04000B92 RID: 2962 public static VisualElementStyles none = new VisualElementStyles(true); // Token: 0x04000B93 RID: 2963 internal readonly bool isShared; // Token: 0x04000B94 RID: 2964 private Dictionary m_CustomProperties; // Token: 0x04000B95 RID: 2965 [StyleProperty("width", StylePropertyID.Width)] public Style width; // Token: 0x04000B96 RID: 2966 [StyleProperty("height", StylePropertyID.Height)] public Style height; // Token: 0x04000B97 RID: 2967 [StyleProperty("max-width", StylePropertyID.MaxWidth)] public Style maxWidth; // Token: 0x04000B98 RID: 2968 [StyleProperty("max-height", StylePropertyID.MaxHeight)] public Style maxHeight; // Token: 0x04000B99 RID: 2969 [StyleProperty("min-width", StylePropertyID.MinWidth)] public Style minWidth; // Token: 0x04000B9A RID: 2970 [StyleProperty("min-height", StylePropertyID.MinHeight)] public Style minHeight; // Token: 0x04000B9B RID: 2971 [StyleProperty("flex", StylePropertyID.Flex)] public Style flex; // Token: 0x04000B9C RID: 2972 [StyleProperty("overflow", StylePropertyID.Overflow)] public Style overflow; // Token: 0x04000B9D RID: 2973 [StyleProperty("position-left", StylePropertyID.PositionLeft)] public Style positionLeft; // Token: 0x04000B9E RID: 2974 [StyleProperty("position-top", StylePropertyID.PositionTop)] public Style positionTop; // Token: 0x04000B9F RID: 2975 [StyleProperty("position-right", StylePropertyID.PositionRight)] public Style positionRight; // Token: 0x04000BA0 RID: 2976 [StyleProperty("position-bottom", StylePropertyID.PositionBottom)] public Style positionBottom; // Token: 0x04000BA1 RID: 2977 [StyleProperty("margin-left", StylePropertyID.MarginLeft)] public Style marginLeft; // Token: 0x04000BA2 RID: 2978 [StyleProperty("margin-top", StylePropertyID.MarginTop)] public Style marginTop; // Token: 0x04000BA3 RID: 2979 [StyleProperty("margin-right", StylePropertyID.MarginRight)] public Style marginRight; // Token: 0x04000BA4 RID: 2980 [StyleProperty("margin-bottom", StylePropertyID.MarginBottom)] public Style marginBottom; // Token: 0x04000BA5 RID: 2981 [StyleProperty("border-left", StylePropertyID.BorderLeft)] public Style borderLeft; // Token: 0x04000BA6 RID: 2982 [StyleProperty("border-top", StylePropertyID.BorderTop)] public Style borderTop; // Token: 0x04000BA7 RID: 2983 [StyleProperty("border-right", StylePropertyID.BorderRight)] public Style borderRight; // Token: 0x04000BA8 RID: 2984 [StyleProperty("border-bottom", StylePropertyID.BorderBottom)] public Style borderBottom; // Token: 0x04000BA9 RID: 2985 [StyleProperty("padding-left", StylePropertyID.PaddingLeft)] public Style paddingLeft; // Token: 0x04000BAA RID: 2986 [StyleProperty("padding-top", StylePropertyID.PaddingTop)] public Style paddingTop; // Token: 0x04000BAB RID: 2987 [StyleProperty("padding-right", StylePropertyID.PaddingRight)] public Style paddingRight; // Token: 0x04000BAC RID: 2988 [StyleProperty("padding-bottom", StylePropertyID.PaddingBottom)] public Style paddingBottom; // Token: 0x04000BAD RID: 2989 [StyleProperty("position-type", StylePropertyID.PositionType)] public Style positionType; // Token: 0x04000BAE RID: 2990 [StyleProperty("align-self", StylePropertyID.AlignSelf)] public Style alignSelf; // Token: 0x04000BAF RID: 2991 [StyleProperty("text-alignment", StylePropertyID.TextAlignment)] public Style textAlignment; // Token: 0x04000BB0 RID: 2992 [StyleProperty("font-style", StylePropertyID.FontStyle)] public Style fontStyle; // Token: 0x04000BB1 RID: 2993 [StyleProperty("text-clipping", StylePropertyID.TextClipping)] public Style textClipping; // Token: 0x04000BB2 RID: 2994 [StyleProperty("font", StylePropertyID.Font)] public Style font; // Token: 0x04000BB3 RID: 2995 [StyleProperty("font-size", StylePropertyID.FontSize)] public Style fontSize; // Token: 0x04000BB4 RID: 2996 [StyleProperty("word-wrap", StylePropertyID.WordWrap)] public Style wordWrap; // Token: 0x04000BB5 RID: 2997 [StyleProperty("text-color", StylePropertyID.TextColor)] public Style textColor; // Token: 0x04000BB6 RID: 2998 [StyleProperty("flex-direction", StylePropertyID.FlexDirection)] public Style flexDirection; // Token: 0x04000BB7 RID: 2999 [StyleProperty("background-color", StylePropertyID.BackgroundColor)] public Style backgroundColor; // Token: 0x04000BB8 RID: 3000 [StyleProperty("border-color", StylePropertyID.BorderColor)] public Style borderColor; // Token: 0x04000BB9 RID: 3001 [StyleProperty("background-image", StylePropertyID.BackgroundImage)] public Style backgroundImage; // Token: 0x04000BBA RID: 3002 [StyleProperty("background-size", StylePropertyID.BackgroundSize)] public Style backgroundSize; // Token: 0x04000BBB RID: 3003 [StyleProperty("align-items", StylePropertyID.AlignItems)] public Style alignItems; // Token: 0x04000BBC RID: 3004 [StyleProperty("align-content", StylePropertyID.AlignContent)] public Style alignContent; // Token: 0x04000BBD RID: 3005 [StyleProperty("justify-content", StylePropertyID.JustifyContent)] public Style justifyContent; // Token: 0x04000BBE RID: 3006 [StyleProperty("flex-wrap", StylePropertyID.FlexWrap)] public Style flexWrap; // Token: 0x04000BBF RID: 3007 [StyleProperty("border-width", StylePropertyID.BorderWidth)] public Style borderWidth; // Token: 0x04000BC0 RID: 3008 [StyleProperty("border-radius", StylePropertyID.BorderRadius)] public Style borderRadius; // Token: 0x04000BC1 RID: 3009 [StyleProperty("slice-left", StylePropertyID.SliceLeft)] public Style sliceLeft; // Token: 0x04000BC2 RID: 3010 [StyleProperty("slice-top", StylePropertyID.SliceTop)] public Style sliceTop; // Token: 0x04000BC3 RID: 3011 [StyleProperty("slice-right", StylePropertyID.SliceRight)] public Style sliceRight; // Token: 0x04000BC4 RID: 3012 [StyleProperty("slice-bottom", StylePropertyID.SliceBottom)] public Style sliceBottom; // Token: 0x04000BC5 RID: 3013 [StyleProperty("opacity", StylePropertyID.Opacity)] public Style opacity; } }