This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,18 @@
using System;
using UnityEngine.StyleSheets;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x0200036E RID: 878
internal struct CustomProperty
{
// Token: 0x04000B8F RID: 2959
public int specificity;
// Token: 0x04000B90 RID: 2960
public StyleValueHandle handle;
// Token: 0x04000B91 RID: 2961
public StyleSheet data;
}
}
@@ -0,0 +1,26 @@
using System;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x0200036F RID: 879
public interface ICustomStyles
{
// Token: 0x06003540 RID: 13632
void ApplyCustomProperty(string propertyName, ref Style<float> target);
// Token: 0x06003541 RID: 13633
void ApplyCustomProperty(string propertyName, ref Style<int> target);
// Token: 0x06003542 RID: 13634
void ApplyCustomProperty(string propertyName, ref Style<bool> target);
// Token: 0x06003543 RID: 13635
void ApplyCustomProperty(string propertyName, ref Style<Color> target);
// Token: 0x06003544 RID: 13636
void ApplyCustomProperty<T>(string propertyName, ref Style<T> target) where T : Object;
// Token: 0x06003545 RID: 13637
void ApplyCustomProperty(string propertyName, ref Style<string> target);
}
}
@@ -0,0 +1,21 @@
using System;
using UnityEngine.StyleSheets;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000368 RID: 872
internal struct RuleMatcher
{
// Token: 0x04000B7E RID: 2942
public StyleSheet sheet;
// Token: 0x04000B7F RID: 2943
public StyleComplexSelector complexSelector;
// Token: 0x04000B80 RID: 2944
public int simpleSelectorIndex;
// Token: 0x04000B81 RID: 2945
public int depth;
}
}
@@ -0,0 +1,104 @@
using System;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000365 RID: 869
public struct Style<T>
{
// Token: 0x0600351D RID: 13597 RVA: 0x00057460 File Offset: 0x00055660
public Style(T value)
{
this.value = value;
this.specificity = 0;
}
// Token: 0x0600351E RID: 13598 RVA: 0x00057474 File Offset: 0x00055674
internal Style(T value, int specifity)
{
this.value = value;
this.specificity = specifity;
}
// Token: 0x17000C37 RID: 3127
// (get) Token: 0x0600351F RID: 13599 RVA: 0x00057488 File Offset: 0x00055688
public static Style<T> nil
{
get
{
return Style<T>.defaultStyle;
}
}
// Token: 0x06003520 RID: 13600 RVA: 0x000574A4 File Offset: 0x000556A4
public T GetSpecifiedValueOrDefault(T defaultValue)
{
if (this.specificity > 0)
{
defaultValue = this.value;
}
return defaultValue;
}
// Token: 0x06003521 RID: 13601 RVA: 0x000574D0 File Offset: 0x000556D0
public static implicit operator T(Style<T> sp)
{
return sp.value;
}
// Token: 0x06003522 RID: 13602 RVA: 0x000574EC File Offset: 0x000556EC
internal void Apply(Style<T> other, StylePropertyApplyMode mode)
{
if (mode != StylePropertyApplyMode.Copy)
{
if (mode != StylePropertyApplyMode.CopyIfMoreSpecific)
{
if (mode == StylePropertyApplyMode.CopyIfNotInline)
{
if (this.specificity < 2147483647)
{
this.value = other.value;
this.specificity = other.specificity;
}
}
}
else if (other.specificity >= this.specificity)
{
this.value = other.value;
this.specificity = other.specificity;
}
}
else
{
this.value = other.value;
this.specificity = other.specificity;
}
}
// Token: 0x06003523 RID: 13603 RVA: 0x00057598 File Offset: 0x00055798
public static implicit operator Style<T>(T value)
{
return new Style<T>(value);
}
// Token: 0x06003524 RID: 13604 RVA: 0x000575B4 File Offset: 0x000557B4
public static Style<T> Create(T value)
{
return new Style<T>(value, int.MaxValue);
}
// Token: 0x06003525 RID: 13605 RVA: 0x000575D4 File Offset: 0x000557D4
public override string ToString()
{
return string.Format("[StyleProperty<{2}>: specifity={0}, value={1}]", this.specificity, this.value, typeof(T).Name);
}
// Token: 0x04000B78 RID: 2936
internal int specificity;
// Token: 0x04000B79 RID: 2937
public T value;
// Token: 0x04000B7A RID: 2938
private static readonly Style<T> defaultStyle = default(Style<T>);
}
}
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using UnityEngine.StyleSheets;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000366 RID: 870
internal static class StyleComplexSelectorExtensions
{
// Token: 0x06003527 RID: 13607 RVA: 0x00057634 File Offset: 0x00055834
public static void CachePseudoStateMasks(this StyleComplexSelector complexSelector)
{
if (complexSelector.selectors[0].pseudoStateMask == -1)
{
if (StyleComplexSelectorExtensions.s_PseudoStates == null)
{
StyleComplexSelectorExtensions.s_PseudoStates = new Dictionary<string, StyleComplexSelectorExtensions.PseudoStateData>();
StyleComplexSelectorExtensions.s_PseudoStates["active"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Active, false);
StyleComplexSelectorExtensions.s_PseudoStates["hover"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Hover, false);
StyleComplexSelectorExtensions.s_PseudoStates["checked"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Checked, false);
StyleComplexSelectorExtensions.s_PseudoStates["selected"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Selected, false);
StyleComplexSelectorExtensions.s_PseudoStates["disabled"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Disabled, false);
StyleComplexSelectorExtensions.s_PseudoStates["focus"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Focus, false);
StyleComplexSelectorExtensions.s_PseudoStates["inactive"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Active, true);
StyleComplexSelectorExtensions.s_PseudoStates["enabled"] = new StyleComplexSelectorExtensions.PseudoStateData(PseudoStates.Disabled, true);
}
int i = 0;
int num = complexSelector.selectors.Length;
while (i < num)
{
StyleSelector styleSelector = complexSelector.selectors[i];
StyleSelectorPart[] parts = styleSelector.parts;
PseudoStates pseudoStates = (PseudoStates)0;
PseudoStates pseudoStates2 = (PseudoStates)0;
for (int j = 0; j < styleSelector.parts.Length; j++)
{
if (styleSelector.parts[j].type == StyleSelectorType.PseudoClass)
{
StyleComplexSelectorExtensions.PseudoStateData pseudoStateData;
if (StyleComplexSelectorExtensions.s_PseudoStates.TryGetValue(parts[j].value, out pseudoStateData))
{
if (!pseudoStateData.negate)
{
pseudoStates |= pseudoStateData.state;
}
else
{
pseudoStates2 |= pseudoStateData.state;
}
}
else
{
Debug.LogWarningFormat("Unknown pseudo class \"{0}\"", new object[] { parts[j].value });
}
}
}
styleSelector.pseudoStateMask = (int)pseudoStates;
styleSelector.negatedPseudoStateMask = (int)pseudoStates2;
i++;
}
}
}
// Token: 0x04000B7B RID: 2939
private static Dictionary<string, StyleComplexSelectorExtensions.PseudoStateData> s_PseudoStates;
// Token: 0x02000367 RID: 871
private struct PseudoStateData
{
// Token: 0x06003528 RID: 13608 RVA: 0x00057810 File Offset: 0x00055A10
public PseudoStateData(PseudoStates state, bool negate)
{
this.state = state;
this.negate = negate;
}
// Token: 0x04000B7C RID: 2940
public readonly PseudoStates state;
// Token: 0x04000B7D RID: 2941
public readonly bool negate;
}
}
}
@@ -0,0 +1,297 @@
using System;
using System.Collections.Generic;
using UnityEngine.StyleSheets;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000369 RID: 873
internal class StyleContext
{
// Token: 0x06003529 RID: 13609 RVA: 0x00057824 File Offset: 0x00055A24
public StyleContext(VisualContainer tree)
{
this.m_VisualTree = tree;
this.m_Matchers = new List<RuleMatcher>(0);
this.m_MatchedRules = new List<StyleContext.RuleRef>(0);
}
// Token: 0x17000C38 RID: 3128
// (get) Token: 0x0600352A RID: 13610 RVA: 0x0005784C File Offset: 0x00055A4C
// (set) Token: 0x0600352B RID: 13611 RVA: 0x00057868 File Offset: 0x00055A68
public float currentPixelsPerPoint { get; set; }
// Token: 0x0600352C RID: 13612 RVA: 0x00057874 File Offset: 0x00055A74
private void AddMatchersFromSheet(IEnumerable<StyleSheet> styleSheets)
{
foreach (StyleSheet styleSheet in styleSheets)
{
this.PushStyleSheet(styleSheet);
}
}
// Token: 0x0600352D RID: 13613 RVA: 0x000578CC File Offset: 0x00055ACC
internal void GetMatchersFor(VisualElement element, List<RuleMatcher> ruleMatchers, List<StyleSheet> stylesheets)
{
List<VisualElement> list = new List<VisualElement>();
list.Add(element);
VisualContainer visualContainer = element as VisualContainer;
if (visualContainer == null)
{
visualContainer = element.parent;
}
while (visualContainer != null)
{
if (visualContainer.styleSheets != null)
{
stylesheets.AddRange(visualContainer.styleSheets);
this.AddMatchersFromSheet(visualContainer.styleSheets);
}
list.Add(visualContainer);
visualContainer = visualContainer.parent;
}
int num = 0;
for (int i = list.Count - 1; i >= 0; i--)
{
this.GetMatchersFor(list, i, num++, ruleMatchers);
}
this.m_Matchers.Clear();
}
// Token: 0x0600352E RID: 13614 RVA: 0x00057974 File Offset: 0x00055B74
private void GetMatchersFor(List<VisualElement> elements, int idx, int depth, List<RuleMatcher> ruleMatchers)
{
VisualElement visualElement = elements[idx];
int count = this.m_Matchers.Count;
for (int i = 0; i < count; i++)
{
RuleMatcher ruleMatcher = this.m_Matchers[i];
if (ruleMatcher.depth >= depth && StyleContext.Match(visualElement, ref ruleMatcher))
{
StyleSelector[] selectors = ruleMatcher.complexSelector.selectors;
int num = ruleMatcher.simpleSelectorIndex + 1;
int num2 = selectors.Length;
if (num < num2)
{
RuleMatcher ruleMatcher2 = new RuleMatcher
{
complexSelector = ruleMatcher.complexSelector,
depth = ((selectors[num].previousRelationship != StyleSelectorRelationship.Child) ? int.MaxValue : (depth + 1)),
simpleSelectorIndex = num,
sheet = ruleMatcher.sheet
};
this.m_Matchers.Add(ruleMatcher2);
}
else if (idx == 0)
{
ruleMatchers.Add(ruleMatcher);
}
}
}
}
// Token: 0x0600352F RID: 13615 RVA: 0x00057A78 File Offset: 0x00055C78
private void PushStyleSheet(StyleSheet styleSheetData)
{
StyleComplexSelector[] complexSelectors = styleSheetData.complexSelectors;
int num = this.m_Matchers.Count + complexSelectors.Length;
this.m_Matchers.Capacity = Math.Max(this.m_Matchers.Capacity, num);
foreach (StyleComplexSelector styleComplexSelector in complexSelectors)
{
this.m_Matchers.Add(new RuleMatcher
{
sheet = styleSheetData,
complexSelector = styleComplexSelector,
simpleSelectorIndex = 0,
depth = int.MaxValue
});
}
}
// Token: 0x06003530 RID: 13616 RVA: 0x00057B0C File Offset: 0x00055D0C
public void DirtyStyleSheets()
{
StyleContext.PropagateDirtyStyleSheets(this.m_VisualTree);
}
// Token: 0x06003531 RID: 13617 RVA: 0x00057B1C File Offset: 0x00055D1C
private static void PropagateDirtyStyleSheets(VisualElement e)
{
VisualContainer visualContainer = e as VisualContainer;
if (visualContainer != null)
{
if (visualContainer.styleSheets != null)
{
visualContainer.LoadStyleSheetsFromPaths();
}
foreach (VisualElement visualElement in visualContainer)
{
StyleContext.PropagateDirtyStyleSheets(visualElement);
}
}
}
// Token: 0x06003532 RID: 13618 RVA: 0x00057B98 File Offset: 0x00055D98
public void ApplyStyles(VisualContainer subTree)
{
Debug.Assert(subTree.panel != null);
this.UpdateStyles(subTree, 0);
this.m_Matchers.Clear();
}
// Token: 0x06003533 RID: 13619 RVA: 0x00057BC0 File Offset: 0x00055DC0
public void ApplyStyles()
{
this.ApplyStyles(this.m_VisualTree);
}
// Token: 0x06003534 RID: 13620 RVA: 0x00057BD0 File Offset: 0x00055DD0
private void UpdateStyles(VisualElement element, int depth)
{
if (element.IsDirty(ChangeType.Styles) || element.IsDirty(ChangeType.StylesPath))
{
VisualContainer visualContainer = element as VisualContainer;
int count = this.m_Matchers.Count;
if (visualContainer != null && visualContainer.styleSheets != null)
{
this.AddMatchersFromSheet(visualContainer.styleSheets);
}
string fullTypeName = element.fullTypeName;
long num = (long)fullTypeName.GetHashCode();
num = (num * 397L) ^ (long)this.currentPixelsPerPoint.GetHashCode();
this.m_MatchedRules.Clear();
int count2 = this.m_Matchers.Count;
for (int i = 0; i < count2; i++)
{
RuleMatcher ruleMatcher = this.m_Matchers[i];
if (ruleMatcher.depth >= depth && StyleContext.Match(element, ref ruleMatcher))
{
StyleSelector[] selectors = ruleMatcher.complexSelector.selectors;
int num2 = ruleMatcher.simpleSelectorIndex + 1;
int num3 = selectors.Length;
if (num2 < num3)
{
RuleMatcher ruleMatcher2 = new RuleMatcher
{
complexSelector = ruleMatcher.complexSelector,
depth = ((selectors[num2].previousRelationship != StyleSelectorRelationship.Child) ? int.MaxValue : (depth + 1)),
simpleSelectorIndex = num2,
sheet = ruleMatcher.sheet
};
this.m_Matchers.Add(ruleMatcher2);
}
else
{
StyleRule rule = ruleMatcher.complexSelector.rule;
int specificity = ruleMatcher.complexSelector.specificity;
num = (num * 397L) ^ (long)rule.GetHashCode();
num = (num * 397L) ^ (long)specificity;
this.m_MatchedRules.Add(new StyleContext.RuleRef
{
selector = ruleMatcher.complexSelector,
sheet = ruleMatcher.sheet
});
}
}
}
VisualElementStyles visualElementStyles;
if (StyleContext.s_StyleCache.TryGetValue(num, out visualElementStyles))
{
element.SetSharedStyles(visualElementStyles);
}
else
{
visualElementStyles = new VisualElementStyles(true);
int j = 0;
int count3 = this.m_MatchedRules.Count;
while (j < count3)
{
StyleContext.RuleRef ruleRef = this.m_MatchedRules[j];
StylePropertyID[] propertyIDs = StyleSheetCache.GetPropertyIDs(ruleRef.sheet, ruleRef.selector.ruleIndex);
visualElementStyles.ApplyRule(ruleRef.sheet, ruleRef.selector.specificity, ruleRef.selector.rule, propertyIDs, this.m_VisualTree.elementPanel.loadResourceFunc);
j++;
}
StyleContext.s_StyleCache[num] = visualElementStyles;
element.SetSharedStyles(visualElementStyles);
}
if (visualContainer != null)
{
for (int k = 0; k < visualContainer.childrenCount; k++)
{
VisualElement childAt = visualContainer.GetChildAt(k);
this.UpdateStyles(childAt, depth + 1);
}
}
if (this.m_Matchers.Count > count)
{
this.m_Matchers.RemoveRange(count, this.m_Matchers.Count - count);
}
}
}
// Token: 0x06003535 RID: 13621 RVA: 0x00057EF0 File Offset: 0x000560F0
private static bool Match(VisualElement element, ref RuleMatcher matcher)
{
bool flag = true;
StyleSelector styleSelector = matcher.complexSelector.selectors[matcher.simpleSelectorIndex];
int num = styleSelector.parts.Length;
int num2 = 0;
while (num2 < num && flag)
{
switch (styleSelector.parts[num2].type)
{
case StyleSelectorType.Wildcard:
break;
case StyleSelectorType.Type:
flag = element.typeName == styleSelector.parts[num2].value;
break;
case StyleSelectorType.Class:
flag = element.ClassListContains(styleSelector.parts[num2].value);
break;
case StyleSelectorType.PseudoClass:
{
int pseudoStates = (int)element.pseudoStates;
flag = (styleSelector.pseudoStateMask & pseudoStates) == styleSelector.pseudoStateMask;
flag &= (styleSelector.negatedPseudoStateMask & ~pseudoStates) == styleSelector.negatedPseudoStateMask;
break;
}
case StyleSelectorType.RecursivePseudoClass:
goto IL_FA;
case StyleSelectorType.ID:
flag = element.name == styleSelector.parts[num2].value;
break;
default:
goto IL_FA;
}
IL_101:
num2++;
continue;
IL_FA:
flag = false;
goto IL_101;
}
return flag;
}
// Token: 0x04000B83 RID: 2947
private List<RuleMatcher> m_Matchers;
// Token: 0x04000B84 RID: 2948
private List<StyleContext.RuleRef> m_MatchedRules;
// Token: 0x04000B85 RID: 2949
private VisualContainer m_VisualTree;
// Token: 0x04000B86 RID: 2950
private static Dictionary<long, VisualElementStyles> s_StyleCache = new Dictionary<long, VisualElementStyles>();
// Token: 0x0200036A RID: 874
private struct RuleRef
{
// Token: 0x04000B87 RID: 2951
public StyleComplexSelector selector;
// Token: 0x04000B88 RID: 2952
public StyleSheet sheet;
}
}
}
@@ -0,0 +1,15 @@
using System;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000364 RID: 868
internal enum StylePropertyApplyMode
{
// Token: 0x04000B75 RID: 2933
Copy,
// Token: 0x04000B76 RID: 2934
CopyIfMoreSpecific,
// Token: 0x04000B77 RID: 2935
CopyIfNotInline
}
}
@@ -0,0 +1,34 @@
using System;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000363 RID: 867
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
internal class StylePropertyAttribute : Attribute
{
// Token: 0x0600351A RID: 13594 RVA: 0x0005742C File Offset: 0x0005562C
internal StylePropertyAttribute(string propertyName, StylePropertyID propertyID)
{
this.propertyName = propertyName;
this.propertyID = propertyID;
}
// Token: 0x0600351B RID: 13595 RVA: 0x00057444 File Offset: 0x00055644
public StylePropertyAttribute(string propertyName)
: this(propertyName, StylePropertyID.Custom)
{
}
// Token: 0x0600351C RID: 13596 RVA: 0x00057450 File Offset: 0x00055650
public StylePropertyAttribute()
: this(string.Empty)
{
}
// Token: 0x04000B72 RID: 2930
internal string propertyName;
// Token: 0x04000B73 RID: 2931
internal StylePropertyID propertyID;
}
}
@@ -0,0 +1,111 @@
using System;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x02000362 RID: 866
internal enum StylePropertyID
{
// Token: 0x04000B3F RID: 2879
Unknown = -1,
// Token: 0x04000B40 RID: 2880
MarginLeft,
// Token: 0x04000B41 RID: 2881
MarginTop,
// Token: 0x04000B42 RID: 2882
MarginRight,
// Token: 0x04000B43 RID: 2883
MarginBottom,
// Token: 0x04000B44 RID: 2884
PaddingLeft,
// Token: 0x04000B45 RID: 2885
PaddingTop,
// Token: 0x04000B46 RID: 2886
PaddingRight,
// Token: 0x04000B47 RID: 2887
PaddingBottom,
// Token: 0x04000B48 RID: 2888
BorderLeft,
// Token: 0x04000B49 RID: 2889
BorderTop,
// Token: 0x04000B4A RID: 2890
BorderRight,
// Token: 0x04000B4B RID: 2891
BorderBottom,
// Token: 0x04000B4C RID: 2892
PositionType,
// Token: 0x04000B4D RID: 2893
PositionLeft,
// Token: 0x04000B4E RID: 2894
PositionTop,
// Token: 0x04000B4F RID: 2895
PositionRight,
// Token: 0x04000B50 RID: 2896
PositionBottom,
// Token: 0x04000B51 RID: 2897
Width,
// Token: 0x04000B52 RID: 2898
Height,
// Token: 0x04000B53 RID: 2899
MinWidth,
// Token: 0x04000B54 RID: 2900
MinHeight,
// Token: 0x04000B55 RID: 2901
MaxWidth,
// Token: 0x04000B56 RID: 2902
MaxHeight,
// Token: 0x04000B57 RID: 2903
Flex,
// Token: 0x04000B58 RID: 2904
BorderWidth,
// Token: 0x04000B59 RID: 2905
BorderRadius,
// Token: 0x04000B5A RID: 2906
FlexDirection,
// Token: 0x04000B5B RID: 2907
FlexWrap,
// Token: 0x04000B5C RID: 2908
JustifyContent,
// Token: 0x04000B5D RID: 2909
AlignContent,
// Token: 0x04000B5E RID: 2910
AlignSelf,
// Token: 0x04000B5F RID: 2911
AlignItems,
// Token: 0x04000B60 RID: 2912
TextAlignment,
// Token: 0x04000B61 RID: 2913
TextClipping,
// Token: 0x04000B62 RID: 2914
Font,
// Token: 0x04000B63 RID: 2915
FontSize,
// Token: 0x04000B64 RID: 2916
FontStyle,
// Token: 0x04000B65 RID: 2917
BackgroundSize,
// Token: 0x04000B66 RID: 2918
WordWrap,
// Token: 0x04000B67 RID: 2919
BackgroundImage,
// Token: 0x04000B68 RID: 2920
TextColor,
// Token: 0x04000B69 RID: 2921
BackgroundColor,
// Token: 0x04000B6A RID: 2922
BorderColor,
// Token: 0x04000B6B RID: 2923
Overflow,
// Token: 0x04000B6C RID: 2924
SliceLeft,
// Token: 0x04000B6D RID: 2925
SliceTop,
// Token: 0x04000B6E RID: 2926
SliceRight,
// Token: 0x04000B6F RID: 2927
SliceBottom,
// Token: 0x04000B70 RID: 2928
Opacity,
// Token: 0x04000B71 RID: 2929
Custom
}
}
@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine.StyleSheets;
namespace UnityEngine.Experimental.UIElements.StyleSheets
{
// Token: 0x0200036B RID: 875
internal static class StyleSheetCache
{
// Token: 0x06003537 RID: 13623 RVA: 0x00058028 File Offset: 0x00056228
static StyleSheetCache()
{
FieldInfo[] fields = typeof(VisualElementStyles).GetFields();
foreach (FieldInfo fieldInfo in fields)
{
StylePropertyAttribute stylePropertyAttribute = (StylePropertyAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(StylePropertyAttribute));
if (stylePropertyAttribute != null)
{
StyleSheetCache.s_NameToIDCache.Add(stylePropertyAttribute.propertyName, stylePropertyAttribute.propertyID);
}
}
}
// Token: 0x06003538 RID: 13624 RVA: 0x000580D0 File Offset: 0x000562D0
internal static void ClearCaches()
{
StyleSheetCache.s_EnumToIntCache.Clear();
StyleSheetCache.s_RulePropertyIDsCache.Clear();
}
// Token: 0x06003539 RID: 13625 RVA: 0x000580E8 File Offset: 0x000562E8
internal static int GetEnumValue<T>(StyleSheet sheet, StyleValueHandle handle)
{
Debug.Assert(handle.valueType == StyleValueType.Enum);
StyleSheetCache.SheetHandleKey sheetHandleKey = new StyleSheetCache.SheetHandleKey(sheet, handle.valueIndex);
int num;
if (!StyleSheetCache.s_EnumToIntCache.TryGetValue(sheetHandleKey, out num))
{
string text = sheet.ReadEnum(handle).Replace("-", string.Empty);
object obj = Enum.Parse(typeof(T), text, true);
num = (int)obj;
StyleSheetCache.s_EnumToIntCache.Add(sheetHandleKey, num);
}
Debug.Assert(Enum.GetName(typeof(T), num) != null);
return num;
}
// Token: 0x0600353A RID: 13626 RVA: 0x00058190 File Offset: 0x00056390
internal static StylePropertyID[] GetPropertyIDs(StyleSheet sheet, int ruleIndex)
{
StyleSheetCache.SheetHandleKey sheetHandleKey = new StyleSheetCache.SheetHandleKey(sheet, ruleIndex);
StylePropertyID[] array;
if (!StyleSheetCache.s_RulePropertyIDsCache.TryGetValue(sheetHandleKey, out array))
{
StyleRule styleRule = sheet.rules[ruleIndex];
array = new StylePropertyID[styleRule.properties.Length];
for (int i = 0; i < array.Length; i++)
{
array[i] = StyleSheetCache.GetPropertyID(styleRule.properties[i].name);
}
StyleSheetCache.s_RulePropertyIDsCache.Add(sheetHandleKey, array);
}
return array;
}
// Token: 0x0600353B RID: 13627 RVA: 0x00058214 File Offset: 0x00056414
private static StylePropertyID GetPropertyID(string name)
{
StylePropertyID stylePropertyID;
if (!StyleSheetCache.s_NameToIDCache.TryGetValue(name, out stylePropertyID))
{
stylePropertyID = StylePropertyID.Custom;
}
return stylePropertyID;
}
// Token: 0x04000B89 RID: 2953
private static StyleSheetCache.SheetHandleKeyComparer s_Comparer = new StyleSheetCache.SheetHandleKeyComparer();
// Token: 0x04000B8A RID: 2954
private static Dictionary<StyleSheetCache.SheetHandleKey, int> s_EnumToIntCache = new Dictionary<StyleSheetCache.SheetHandleKey, int>(StyleSheetCache.s_Comparer);
// Token: 0x04000B8B RID: 2955
private static Dictionary<StyleSheetCache.SheetHandleKey, StylePropertyID[]> s_RulePropertyIDsCache = new Dictionary<StyleSheetCache.SheetHandleKey, StylePropertyID[]>(StyleSheetCache.s_Comparer);
// Token: 0x04000B8C RID: 2956
private static Dictionary<string, StylePropertyID> s_NameToIDCache = new Dictionary<string, StylePropertyID>();
// Token: 0x0200036C RID: 876
private struct SheetHandleKey
{
// Token: 0x0600353C RID: 13628 RVA: 0x00058244 File Offset: 0x00056444
public SheetHandleKey(StyleSheet sheet, int index)
{
this.sheetInstanceID = sheet.GetInstanceID();
this.index = index;
}
// Token: 0x04000B8D RID: 2957
public readonly int sheetInstanceID;
// Token: 0x04000B8E RID: 2958
public readonly int index;
}
// Token: 0x0200036D RID: 877
private class SheetHandleKeyComparer : IEqualityComparer<StyleSheetCache.SheetHandleKey>
{
// Token: 0x0600353E RID: 13630 RVA: 0x00058264 File Offset: 0x00056464
public bool Equals(StyleSheetCache.SheetHandleKey x, StyleSheetCache.SheetHandleKey y)
{
return x.sheetInstanceID == y.sheetInstanceID && x.index == y.index;
}
// Token: 0x0600353F RID: 13631 RVA: 0x000582A0 File Offset: 0x000564A0
public int GetHashCode(StyleSheetCache.SheetHandleKey key)
{
return key.sheetInstanceID.GetHashCode() ^ key.index.GetHashCode();
}
}
}
}
@@ -0,0 +1,136 @@
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<float> property)
{
if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2)
{
StyleSheetExtensions.Apply<float>(0f, specificity, ref property);
}
else
{
StyleSheetExtensions.Apply<float>(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<Color> property)
{
if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2)
{
StyleSheetExtensions.Apply<Color>(default(Color), specificity, ref property);
}
else
{
StyleSheetExtensions.Apply<Color>(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<int> property)
{
if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2)
{
StyleSheetExtensions.Apply<int>(0, specificity, ref property);
}
else
{
StyleSheetExtensions.Apply<int>((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<bool> property)
{
bool flag = sheet.ReadKeyword(handle) == StyleValueKeyword.True;
if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2)
{
StyleSheetExtensions.Apply<bool>(false, specificity, ref property);
}
else
{
StyleSheetExtensions.Apply<bool>(flag, specificity, ref property);
}
}
// Token: 0x0600355A RID: 13658 RVA: 0x00059324 File Offset: 0x00057524
public static void Apply<T>(this StyleSheet sheet, StyleValueHandle handle, int specificity, ref Style<int> property) where T : struct
{
if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 2)
{
StyleSheetExtensions.Apply<int>(0, specificity, ref property);
}
else
{
StyleSheetExtensions.Apply<int>(StyleSheetCache.GetEnumValue<T>(sheet, handle), specificity, ref property);
}
}
// Token: 0x0600355B RID: 13659 RVA: 0x00059360 File Offset: 0x00057560
public static void Apply<T>(this StyleSheet sheet, StyleValueHandle handle, int specificity, LoadResourceFunction loadResourceFunc, ref Style<T> property) where T : Object
{
if (handle.valueType == StyleValueType.Keyword && handle.valueIndex == 5)
{
StyleSheetExtensions.Apply<T>((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>(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>(T val, int specificity, ref Style<T> property)
{
property.Apply(new Style<T>(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;
}
}
}
@@ -0,0 +1,630 @@
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<int> left, ref Style<int> top, ref Style<int> right, ref Style<int> 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<float> left, ref Style<float> top, ref Style<float> right, ref Style<float> 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<string, CustomProperty>();
}
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<float> target)
{
Style<float> style = new Style<float>(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<int> target)
{
Style<int> style = new Style<int>(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<bool> target)
{
Style<bool> style = new Style<bool>(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<Color> target)
{
Style<Color> style = new Style<Color>(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<T>(string propertyName, ref Style<T> target) where T : Object
{
this.ApplyCustomProperty<T>(propertyName, new LoadResourceFunction(Resources.Load), ref target);
}
// Token: 0x06003553 RID: 13651 RVA: 0x000590F4 File Offset: 0x000572F4
public void ApplyCustomProperty<T>(string propertyName, LoadResourceFunction function, ref Style<T> target) where T : Object
{
Style<T> style = new Style<T>((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<string> target)
{
Style<string> style = new Style<string>(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<string, CustomProperty> m_CustomProperties;
// Token: 0x04000B95 RID: 2965
[StyleProperty("width", StylePropertyID.Width)]
public Style<float> width;
// Token: 0x04000B96 RID: 2966
[StyleProperty("height", StylePropertyID.Height)]
public Style<float> height;
// Token: 0x04000B97 RID: 2967
[StyleProperty("max-width", StylePropertyID.MaxWidth)]
public Style<float> maxWidth;
// Token: 0x04000B98 RID: 2968
[StyleProperty("max-height", StylePropertyID.MaxHeight)]
public Style<float> maxHeight;
// Token: 0x04000B99 RID: 2969
[StyleProperty("min-width", StylePropertyID.MinWidth)]
public Style<float> minWidth;
// Token: 0x04000B9A RID: 2970
[StyleProperty("min-height", StylePropertyID.MinHeight)]
public Style<float> minHeight;
// Token: 0x04000B9B RID: 2971
[StyleProperty("flex", StylePropertyID.Flex)]
public Style<float> flex;
// Token: 0x04000B9C RID: 2972
[StyleProperty("overflow", StylePropertyID.Overflow)]
public Style<int> overflow;
// Token: 0x04000B9D RID: 2973
[StyleProperty("position-left", StylePropertyID.PositionLeft)]
public Style<float> positionLeft;
// Token: 0x04000B9E RID: 2974
[StyleProperty("position-top", StylePropertyID.PositionTop)]
public Style<float> positionTop;
// Token: 0x04000B9F RID: 2975
[StyleProperty("position-right", StylePropertyID.PositionRight)]
public Style<float> positionRight;
// Token: 0x04000BA0 RID: 2976
[StyleProperty("position-bottom", StylePropertyID.PositionBottom)]
public Style<float> positionBottom;
// Token: 0x04000BA1 RID: 2977
[StyleProperty("margin-left", StylePropertyID.MarginLeft)]
public Style<float> marginLeft;
// Token: 0x04000BA2 RID: 2978
[StyleProperty("margin-top", StylePropertyID.MarginTop)]
public Style<float> marginTop;
// Token: 0x04000BA3 RID: 2979
[StyleProperty("margin-right", StylePropertyID.MarginRight)]
public Style<float> marginRight;
// Token: 0x04000BA4 RID: 2980
[StyleProperty("margin-bottom", StylePropertyID.MarginBottom)]
public Style<float> marginBottom;
// Token: 0x04000BA5 RID: 2981
[StyleProperty("border-left", StylePropertyID.BorderLeft)]
public Style<float> borderLeft;
// Token: 0x04000BA6 RID: 2982
[StyleProperty("border-top", StylePropertyID.BorderTop)]
public Style<float> borderTop;
// Token: 0x04000BA7 RID: 2983
[StyleProperty("border-right", StylePropertyID.BorderRight)]
public Style<float> borderRight;
// Token: 0x04000BA8 RID: 2984
[StyleProperty("border-bottom", StylePropertyID.BorderBottom)]
public Style<float> borderBottom;
// Token: 0x04000BA9 RID: 2985
[StyleProperty("padding-left", StylePropertyID.PaddingLeft)]
public Style<float> paddingLeft;
// Token: 0x04000BAA RID: 2986
[StyleProperty("padding-top", StylePropertyID.PaddingTop)]
public Style<float> paddingTop;
// Token: 0x04000BAB RID: 2987
[StyleProperty("padding-right", StylePropertyID.PaddingRight)]
public Style<float> paddingRight;
// Token: 0x04000BAC RID: 2988
[StyleProperty("padding-bottom", StylePropertyID.PaddingBottom)]
public Style<float> paddingBottom;
// Token: 0x04000BAD RID: 2989
[StyleProperty("position-type", StylePropertyID.PositionType)]
public Style<int> positionType;
// Token: 0x04000BAE RID: 2990
[StyleProperty("align-self", StylePropertyID.AlignSelf)]
public Style<int> alignSelf;
// Token: 0x04000BAF RID: 2991
[StyleProperty("text-alignment", StylePropertyID.TextAlignment)]
public Style<int> textAlignment;
// Token: 0x04000BB0 RID: 2992
[StyleProperty("font-style", StylePropertyID.FontStyle)]
public Style<int> fontStyle;
// Token: 0x04000BB1 RID: 2993
[StyleProperty("text-clipping", StylePropertyID.TextClipping)]
public Style<int> textClipping;
// Token: 0x04000BB2 RID: 2994
[StyleProperty("font", StylePropertyID.Font)]
public Style<Font> font;
// Token: 0x04000BB3 RID: 2995
[StyleProperty("font-size", StylePropertyID.FontSize)]
public Style<int> fontSize;
// Token: 0x04000BB4 RID: 2996
[StyleProperty("word-wrap", StylePropertyID.WordWrap)]
public Style<bool> wordWrap;
// Token: 0x04000BB5 RID: 2997
[StyleProperty("text-color", StylePropertyID.TextColor)]
public Style<Color> textColor;
// Token: 0x04000BB6 RID: 2998
[StyleProperty("flex-direction", StylePropertyID.FlexDirection)]
public Style<int> flexDirection;
// Token: 0x04000BB7 RID: 2999
[StyleProperty("background-color", StylePropertyID.BackgroundColor)]
public Style<Color> backgroundColor;
// Token: 0x04000BB8 RID: 3000
[StyleProperty("border-color", StylePropertyID.BorderColor)]
public Style<Color> borderColor;
// Token: 0x04000BB9 RID: 3001
[StyleProperty("background-image", StylePropertyID.BackgroundImage)]
public Style<Texture2D> backgroundImage;
// Token: 0x04000BBA RID: 3002
[StyleProperty("background-size", StylePropertyID.BackgroundSize)]
public Style<int> backgroundSize;
// Token: 0x04000BBB RID: 3003
[StyleProperty("align-items", StylePropertyID.AlignItems)]
public Style<int> alignItems;
// Token: 0x04000BBC RID: 3004
[StyleProperty("align-content", StylePropertyID.AlignContent)]
public Style<int> alignContent;
// Token: 0x04000BBD RID: 3005
[StyleProperty("justify-content", StylePropertyID.JustifyContent)]
public Style<int> justifyContent;
// Token: 0x04000BBE RID: 3006
[StyleProperty("flex-wrap", StylePropertyID.FlexWrap)]
public Style<int> flexWrap;
// Token: 0x04000BBF RID: 3007
[StyleProperty("border-width", StylePropertyID.BorderWidth)]
public Style<float> borderWidth;
// Token: 0x04000BC0 RID: 3008
[StyleProperty("border-radius", StylePropertyID.BorderRadius)]
public Style<float> borderRadius;
// Token: 0x04000BC1 RID: 3009
[StyleProperty("slice-left", StylePropertyID.SliceLeft)]
public Style<int> sliceLeft;
// Token: 0x04000BC2 RID: 3010
[StyleProperty("slice-top", StylePropertyID.SliceTop)]
public Style<int> sliceTop;
// Token: 0x04000BC3 RID: 3011
[StyleProperty("slice-right", StylePropertyID.SliceRight)]
public Style<int> sliceRight;
// Token: 0x04000BC4 RID: 3012
[StyleProperty("slice-bottom", StylePropertyID.SliceBottom)]
public Style<int> sliceBottom;
// Token: 0x04000BC5 RID: 3013
[StyleProperty("opacity", StylePropertyID.Opacity)]
public Style<float> opacity;
}
}