scripts
This commit is contained in:
@@ -0,0 +1,392 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.CSSLayout;
|
||||
using UnityEngine.Experimental.UIElements.StyleEnums;
|
||||
using UnityEngine.Experimental.UIElements.StyleSheets;
|
||||
using UnityEngine.StyleSheets;
|
||||
|
||||
namespace UnityEngine.Experimental.UIElements
|
||||
{
|
||||
// Token: 0x02000356 RID: 854
|
||||
public class VisualContainer : VisualElement, IEnumerable<VisualElement>, IEnumerable
|
||||
{
|
||||
// Token: 0x0600342D RID: 13357 RVA: 0x00053A4C File Offset: 0x00051C4C
|
||||
public VisualContainer()
|
||||
{
|
||||
this.clipChildren = true;
|
||||
base.cssNode.SetMeasureFunction(null);
|
||||
}
|
||||
|
||||
// Token: 0x17000BEA RID: 3050
|
||||
// (get) Token: 0x0600342E RID: 13358 RVA: 0x00053A74 File Offset: 0x00051C74
|
||||
internal IEnumerable<StyleSheet> styleSheets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_StyleSheets == null)
|
||||
{
|
||||
this.LoadStyleSheetsFromPaths();
|
||||
if (this.m_StyleSheets == null)
|
||||
{
|
||||
this.m_StyleSheets = new List<StyleSheet>();
|
||||
}
|
||||
}
|
||||
return this.m_StyleSheets;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BEB RID: 3051
|
||||
// (get) Token: 0x0600342F RID: 13359 RVA: 0x00053ABC File Offset: 0x00051CBC
|
||||
// (set) Token: 0x06003430 RID: 13360 RVA: 0x00053AD8 File Offset: 0x00051CD8
|
||||
public bool clipChildren { get; set; }
|
||||
|
||||
// Token: 0x17000BEC RID: 3052
|
||||
// (get) Token: 0x06003431 RID: 13361 RVA: 0x00053AE4 File Offset: 0x00051CE4
|
||||
public int childrenCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Children.Count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BED RID: 3053
|
||||
// (get) Token: 0x06003432 RID: 13362 RVA: 0x00053B04 File Offset: 0x00051D04
|
||||
// (set) Token: 0x06003433 RID: 13363 RVA: 0x00053B2C File Offset: 0x00051D2C
|
||||
public FlexDirection flexDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return (FlexDirection)this.m_Styles.flexDirection.value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.EnsureInlineStyles();
|
||||
this.m_Styles.flexDirection = Style<int>.Create((int)value);
|
||||
base.cssNode.FlexDirection = (CSSFlexDirection)value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BEE RID: 3054
|
||||
// (get) Token: 0x06003434 RID: 13364 RVA: 0x00053B54 File Offset: 0x00051D54
|
||||
// (set) Token: 0x06003435 RID: 13365 RVA: 0x00053B7C File Offset: 0x00051D7C
|
||||
public Align alignItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Align)this.m_Styles.alignItems.value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.EnsureInlineStyles();
|
||||
this.m_Styles.alignItems = Style<int>.Create((int)value);
|
||||
base.cssNode.AlignItems = (CSSAlign)value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BEF RID: 3055
|
||||
// (get) Token: 0x06003436 RID: 13366 RVA: 0x00053BA4 File Offset: 0x00051DA4
|
||||
// (set) Token: 0x06003437 RID: 13367 RVA: 0x00053BCC File Offset: 0x00051DCC
|
||||
public Align alignContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Align)this.m_Styles.alignContent.value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.EnsureInlineStyles();
|
||||
this.m_Styles.alignContent = Style<int>.Create((int)value);
|
||||
base.cssNode.AlignContent = (CSSAlign)value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BF0 RID: 3056
|
||||
// (get) Token: 0x06003438 RID: 13368 RVA: 0x00053BF4 File Offset: 0x00051DF4
|
||||
// (set) Token: 0x06003439 RID: 13369 RVA: 0x00053C1C File Offset: 0x00051E1C
|
||||
public Justify justifyContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Justify)this.m_Styles.justifyContent.value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.EnsureInlineStyles();
|
||||
this.m_Styles.justifyContent = Style<int>.Create((int)value);
|
||||
base.cssNode.JustifyContent = (CSSJustify)value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BF1 RID: 3057
|
||||
// (get) Token: 0x0600343A RID: 13370 RVA: 0x00053C44 File Offset: 0x00051E44
|
||||
// (set) Token: 0x0600343B RID: 13371 RVA: 0x00053C6C File Offset: 0x00051E6C
|
||||
public Wrap flexWrap
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Wrap)this.m_Styles.flexWrap.value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.EnsureInlineStyles();
|
||||
this.m_Styles.flexWrap = Style<int>.Create((int)value);
|
||||
base.cssNode.Wrap = (CSSWrap)value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600343C RID: 13372 RVA: 0x00053C94 File Offset: 0x00051E94
|
||||
public VisualContainer.Enumerator GetEnumerator()
|
||||
{
|
||||
return new VisualContainer.Enumerator(ref this.m_Children);
|
||||
}
|
||||
|
||||
// Token: 0x0600343D RID: 13373 RVA: 0x00053CB4 File Offset: 0x00051EB4
|
||||
IEnumerator<VisualElement> IEnumerable<VisualElement>.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600343E RID: 13374 RVA: 0x00053CD4 File Offset: 0x00051ED4
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600343F RID: 13375 RVA: 0x00053CF4 File Offset: 0x00051EF4
|
||||
internal override void ChangePanel(BaseVisualElementPanel p)
|
||||
{
|
||||
if (p != base.panel)
|
||||
{
|
||||
base.ChangePanel(p);
|
||||
this.m_StyleSheets = null;
|
||||
base.Dirty(ChangeType.Styles);
|
||||
for (int i = 0; i < this.m_Children.Count; i++)
|
||||
{
|
||||
this.m_Children[i].ChangePanel(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003440 RID: 13376 RVA: 0x00053D58 File Offset: 0x00051F58
|
||||
public void AddChild(VisualElement child)
|
||||
{
|
||||
if (child == null)
|
||||
{
|
||||
throw new ArgumentException("Cannot add null child");
|
||||
}
|
||||
if (child.parent != null)
|
||||
{
|
||||
child.parent.RemoveChild(child);
|
||||
}
|
||||
child.parent = this;
|
||||
this.m_Children.Add(child);
|
||||
base.cssNode.Insert(base.cssNode.Count, child.cssNode);
|
||||
child.Dirty(ChangeType.Styles);
|
||||
child.PropagateChangesToParents();
|
||||
}
|
||||
|
||||
// Token: 0x06003441 RID: 13377 RVA: 0x00053DCC File Offset: 0x00051FCC
|
||||
public void InsertChild(int index, VisualElement child)
|
||||
{
|
||||
if (child == null)
|
||||
{
|
||||
throw new ArgumentException("Cannot insert null child");
|
||||
}
|
||||
if (index > this.m_Children.Count)
|
||||
{
|
||||
throw new IndexOutOfRangeException("Index out of range: " + index);
|
||||
}
|
||||
if (child.parent != null)
|
||||
{
|
||||
child.parent.RemoveChild(child);
|
||||
}
|
||||
child.parent = this;
|
||||
this.m_Children.Insert(index, child);
|
||||
base.cssNode.Insert(index, child.cssNode);
|
||||
child.Dirty(ChangeType.Styles);
|
||||
child.PropagateChangesToParents();
|
||||
}
|
||||
|
||||
// Token: 0x06003442 RID: 13378 RVA: 0x00053E60 File Offset: 0x00052060
|
||||
public void RemoveChild(VisualElement child)
|
||||
{
|
||||
if (child == null)
|
||||
{
|
||||
throw new ArgumentException("Cannot add null child");
|
||||
}
|
||||
if (child.parent != this)
|
||||
{
|
||||
throw new ArgumentException("This visualElement is not my child");
|
||||
}
|
||||
child.parent = null;
|
||||
this.m_Children.Remove(child);
|
||||
base.cssNode.RemoveAt(base.cssNode.IndexOf(child.cssNode));
|
||||
}
|
||||
|
||||
// Token: 0x06003443 RID: 13379 RVA: 0x00053EC8 File Offset: 0x000520C8
|
||||
public void RemoveChildAt(int index)
|
||||
{
|
||||
if (index < 0 || index >= this.m_Children.Count)
|
||||
{
|
||||
throw new IndexOutOfRangeException("Index out of range: " + index);
|
||||
}
|
||||
VisualElement visualElement = this.m_Children[index];
|
||||
visualElement.parent = null;
|
||||
this.m_Children.RemoveAt(index);
|
||||
base.cssNode.RemoveAt(index);
|
||||
}
|
||||
|
||||
// Token: 0x06003444 RID: 13380 RVA: 0x00053F30 File Offset: 0x00052130
|
||||
public void ClearChildren()
|
||||
{
|
||||
for (int i = 0; i < this.m_Children.Count; i++)
|
||||
{
|
||||
this.m_Children[i].parent = null;
|
||||
}
|
||||
this.m_Children.Clear();
|
||||
base.cssNode.Clear();
|
||||
}
|
||||
|
||||
// Token: 0x06003445 RID: 13381 RVA: 0x00053F84 File Offset: 0x00052184
|
||||
public VisualElement GetChildAt(int index)
|
||||
{
|
||||
return this.m_Children[index];
|
||||
}
|
||||
|
||||
// Token: 0x06003446 RID: 13382 RVA: 0x00053FA8 File Offset: 0x000521A8
|
||||
public bool ContainsChild(VisualElement elem)
|
||||
{
|
||||
for (int i = 0; i < this.m_Children.Count; i++)
|
||||
{
|
||||
if (this.m_Children[i] == elem)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06003447 RID: 13383 RVA: 0x00053FF8 File Offset: 0x000521F8
|
||||
public void AddStyleSheetPath(string sheetPath)
|
||||
{
|
||||
if (this.m_StyleSheetPaths == null)
|
||||
{
|
||||
this.m_StyleSheetPaths = new List<string>();
|
||||
}
|
||||
this.m_StyleSheetPaths.Add(sheetPath);
|
||||
this.m_StyleSheets = null;
|
||||
base.Dirty(ChangeType.Styles);
|
||||
}
|
||||
|
||||
// Token: 0x06003448 RID: 13384 RVA: 0x00054030 File Offset: 0x00052230
|
||||
public void RemoveStyleSheetPath(string sheetPath)
|
||||
{
|
||||
if (this.m_StyleSheetPaths == null)
|
||||
{
|
||||
Debug.LogWarning("Attempting to remove from null style sheet path list");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_StyleSheetPaths.Remove(sheetPath);
|
||||
this.m_StyleSheets = null;
|
||||
base.Dirty(ChangeType.Styles);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003449 RID: 13385 RVA: 0x0005406C File Offset: 0x0005226C
|
||||
public bool HasStyleSheetPath(string sheetPath)
|
||||
{
|
||||
return this.m_StyleSheetPaths != null && this.m_StyleSheetPaths.Contains(sheetPath);
|
||||
}
|
||||
|
||||
// Token: 0x0600344A RID: 13386 RVA: 0x0005409C File Offset: 0x0005229C
|
||||
internal void LoadStyleSheetsFromPaths()
|
||||
{
|
||||
if (this.m_StyleSheetPaths != null && base.elementPanel != null)
|
||||
{
|
||||
this.m_StyleSheets = new List<StyleSheet>();
|
||||
foreach (string text in this.m_StyleSheetPaths)
|
||||
{
|
||||
StyleSheet styleSheet = base.elementPanel.loadResourceFunc(text, typeof(StyleSheet)) as StyleSheet;
|
||||
if (styleSheet != null)
|
||||
{
|
||||
int i = 0;
|
||||
int num = styleSheet.complexSelectors.Length;
|
||||
while (i < num)
|
||||
{
|
||||
styleSheet.complexSelectors[i].CachePseudoStateMasks();
|
||||
i++;
|
||||
}
|
||||
this.m_StyleSheets.Add(styleSheet);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning(string.Format("Style sheet not found for path \"{0}\"", text));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000B07 RID: 2823
|
||||
private List<VisualElement> m_Children = new List<VisualElement>();
|
||||
|
||||
// Token: 0x04000B08 RID: 2824
|
||||
private List<StyleSheet> m_StyleSheets;
|
||||
|
||||
// Token: 0x04000B09 RID: 2825
|
||||
private List<string> m_StyleSheetPaths;
|
||||
|
||||
// Token: 0x02000357 RID: 855
|
||||
public struct Enumerator : IEnumerator<VisualElement>, IDisposable, IEnumerator
|
||||
{
|
||||
// Token: 0x0600344B RID: 13387 RVA: 0x0005419C File Offset: 0x0005239C
|
||||
public Enumerator(ref List<VisualElement> list)
|
||||
{
|
||||
this.m_Enumerator = list.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600344C RID: 13388 RVA: 0x000541AC File Offset: 0x000523AC
|
||||
public void Dispose()
|
||||
{
|
||||
this.m_Enumerator.Dispose();
|
||||
}
|
||||
|
||||
// Token: 0x0600344D RID: 13389 RVA: 0x000541BC File Offset: 0x000523BC
|
||||
public void Reset()
|
||||
{
|
||||
((IEnumerator)this.m_Enumerator).Reset();
|
||||
}
|
||||
|
||||
// Token: 0x0600344E RID: 13390 RVA: 0x000541D0 File Offset: 0x000523D0
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.m_Enumerator.MoveNext();
|
||||
}
|
||||
|
||||
// Token: 0x17000BF3 RID: 3059
|
||||
// (get) Token: 0x0600344F RID: 13391 RVA: 0x000541F0 File Offset: 0x000523F0
|
||||
public VisualElement Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000BF2 RID: 3058
|
||||
// (get) Token: 0x06003450 RID: 13392 RVA: 0x00054210 File Offset: 0x00052410
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Current;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000B0B RID: 2827
|
||||
private List<VisualElement>.Enumerator m_Enumerator;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user