105 lines
2.5 KiB
C#
105 lines
2.5 KiB
C#
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>);
|
|
}
|
|
}
|