コード例 #1
0
        public Panel(ScriptableObject ownerObject, ContextType contextType, EventDispatcher dispatcher = null)
        {
            m_VisualTreeUpdater = new VisualTreeUpdater(this);

            this.ownerObject      = ownerObject;
            this.contextType      = contextType;
            this.dispatcher       = dispatcher ?? EventDispatcher.instance;
            repaintData           = new RepaintData();
            cursorManager         = new CursorManager();
            contextualMenuManager = null;
            m_RootContainer       = new VisualElement
            {
                name        = VisualElementUtils.GetUniqueName("unity-panel-container"),
                viewDataKey = "PanelContainer"
            };

            // Required!
            visualTree.SetPanel(this);
            focusController       = new FocusController(new VisualElementFocusRing(visualTree));
            m_ProfileUpdateName   = "PanelUpdate";
            m_ProfileLayoutName   = "PanelLayout";
            m_ProfileBindingsName = "PanelBindings";

            allowPixelCaching = true;
            InvokeHierarchyChanged(visualTree, HierarchyChangeType.Add);
        }
コード例 #2
0
        public Panel(ScriptableObject ownerObject, ContextType contextType, EventDispatcher dispatcher)
        {
            this.ownerObject      = ownerObject;
            this.contextType      = contextType;
            this.dispatcher       = dispatcher;
            repaintData           = new RepaintData();
            cursorManager         = new CursorManager();
            contextualMenuManager = null;
            m_VisualTreeUpdater   = new VisualTreeUpdater(this);
            m_RootContainer       = new VisualElement
            {
                name        = VisualElementUtils.GetUniqueName("unity-panel-container"),
                viewDataKey = "PanelContainer"
            };

            // Required!
            visualTree.SetPanel(this);
            focusController = new FocusController(new VisualElementFocusRing(visualTree));

            CreateMarkers();

            InvokeHierarchyChanged(visualTree, HierarchyChangeType.Add);
        }