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,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;
}
}
}