123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- namespace UnityEngine.Rendering
- {
- public partial class DebugUI
- {
-
-
-
-
-
- public class Panel : IContainer, IComparable<Panel>
- {
-
-
-
- public Flags flags { get; set; }
-
-
-
- public string displayName { get; set; }
-
-
-
- public int groupIndex { get; set; }
-
-
-
- public string queryPath { get { return displayName; } }
-
-
-
- public bool isEditorOnly { get { return (flags & Flags.EditorOnly) != 0; } }
-
-
-
- public bool isRuntimeOnly { get { return (flags & Flags.RuntimeOnly) != 0; } }
-
-
-
- public bool isInactiveInEditor { get { return (isRuntimeOnly && !Application.isPlaying); } }
-
-
-
- public bool editorForceUpdate { get { return (flags & Flags.EditorForceUpdate) != 0; } }
-
-
-
- public ObservableList<Widget> children { get; private set; }
-
-
-
- public event Action<Panel> onSetDirty = delegate {};
-
-
-
- public Panel()
- {
- children = new ObservableList<Widget>();
- children.ItemAdded += OnItemAdded;
- children.ItemRemoved += OnItemRemoved;
- }
-
-
-
-
-
- protected virtual void OnItemAdded(ObservableList<Widget> sender, ListChangedEventArgs<Widget> e)
- {
- if (e.item != null)
- {
- e.item.panel = this;
- e.item.parent = this;
- }
- SetDirty();
- }
-
-
-
-
-
- protected virtual void OnItemRemoved(ObservableList<Widget> sender, ListChangedEventArgs<Widget> e)
- {
- if (e.item != null)
- {
- e.item.panel = null;
- e.item.parent = null;
- }
- SetDirty();
- }
-
-
-
- public void SetDirty()
- {
- foreach (var child in children)
- child.GenerateQueryPath();
- onSetDirty(this);
- }
-
-
-
-
- public override int GetHashCode()
- {
- int hash = 17;
- hash = hash * 23 + displayName.GetHashCode();
- foreach (var child in children)
- hash = hash * 23 + child.GetHashCode();
- return hash;
- }
-
-
-
-
-
- int IComparable<Panel>.CompareTo(Panel other) => other == null ? 1 : groupIndex.CompareTo(other.groupIndex);
- }
- }
- }
|