OSDN Git Service

Added Assets for main menu
[mindgames/Mindgames_main.git] / Mindgames / Library / PackageCache / com.unity.render-pipelines.high-definition@6.9.0-preview / Runtime / Core / Debugging / DebugUI.cs
1 using System;
2 using UnityEngine.Assertions;
3
4 namespace UnityEngine.Experimental.Rendering
5 {
6     public partial class DebugUI
7     {
8         [Flags]
9         public enum Flags
10         {
11             None        = 0,
12             EditorOnly  = 1 << 1,
13             RuntimeOnly = 1 << 2,
14             EditorForceUpdate = 1 << 3
15         }
16
17         // Base class for all debug UI widgets
18         public abstract class Widget
19         {
20             // Set to null until it's added to a panel, be careful
21             protected Panel m_Panel;
22             public virtual Panel panel
23             {
24                 get { return m_Panel; }
25                 internal set { m_Panel = value; }
26             }
27
28             protected IContainer m_Parent;
29             public virtual IContainer parent
30             {
31                 get { return m_Parent; }
32                 internal set { m_Parent = value; }
33             }
34
35             public Flags flags { get; set; }
36             public string displayName { get; set; }
37
38             public string queryPath { get; private set; }
39
40             public bool isEditorOnly { get { return (flags & Flags.EditorOnly) != 0; } }
41             public bool isRuntimeOnly { get { return (flags & Flags.RuntimeOnly) != 0; } }
42             public bool isInactiveInEditor { get { return (isRuntimeOnly && !Application.isPlaying); } } 
43
44             internal virtual void GenerateQueryPath()
45             {
46                 queryPath = displayName.Trim();
47
48                 if (m_Parent != null)
49                     queryPath = m_Parent.queryPath + " -> " + queryPath;
50             }
51
52             public override int GetHashCode()
53             {
54                 return queryPath.GetHashCode();
55             }
56
57             public void RemoveSelf()
58             {
59                 if (parent != null)
60                     parent.children.Remove(this);
61             }
62         }
63
64         // Any widget that can holds other widgets must implement this interface
65         public interface IContainer
66         {
67             ObservableList<Widget> children { get; }
68             string displayName { get; set; }
69             string queryPath { get; }
70         }
71
72         // Any widget that implements this will be considered for serialization (only if the setter
73         // is set and thus is not read-only)
74         public interface IValueField
75         {
76             object GetValue();
77             void SetValue(object value);
78             object ValidateValue(object value);
79         }
80
81         // Miscellaneous
82         public class Button : Widget
83         {
84             public Action action { get; set; }
85         }
86
87         public class Value : Widget
88         {
89             public Func<object> getter { get; set; }
90
91             // Runtime-only
92             public float refreshRate = 0.1f;
93
94             public object GetValue()
95             {
96                 Assert.IsNotNull(getter);
97                 return getter();
98             }
99         }
100     }
101 }