Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

75 行
2.5 KiB

using System;
namespace UnityEngine.Rendering
{
public partial class DebugUI
{
// Root panel class - we don't want to extend Container here because we need a clear
// separation between debug panels and actual widgets
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);
}
}
}