Ejemplo n.º 1
0
 public Panel(ScriptableObject ownerObject, ContextType contextType, IDataWatchService dataWatch = null, IEventDispatcher dispatcher = null)
 {
     this.ownerObject                    = ownerObject;
     this.contextType                    = contextType;
     this.m_DataWatch                    = dataWatch;
     this.dispatcher                     = dispatcher;
     this.stylePainter                   = new StylePainter();
     this.m_RootContainer                = new VisualElement();
     this.m_RootContainer.name           = VisualElementUtils.GetUniqueName("PanelContainer");
     this.m_RootContainer.persistenceKey = "PanelContainer";
     this.visualTree.ChangePanel(this);
     this.focusController   = new FocusController(new VisualElementFocusRing(this.visualTree, VisualElementFocusRing.DefaultFocusOrder.ChildOrder));
     this.m_StyleContext    = new StyleContext(this.m_RootContainer);
     this.allowPixelCaching = true;
 }
Ejemplo n.º 2
0
        public Panel(ScriptableObject ownerObject, ContextType contextType, IDataWatchService dataWatch = null, IEventDispatcher dispatcher = null)
        {
            this.ownerObject               = ownerObject;
            this.contextType               = contextType;
            m_DataWatch                    = dataWatch;
            this.dispatcher                = dispatcher;
            stylePainter                   = new StylePainter();
            cursorManager                  = new CursorManager();
            contextualMenuManager          = null;
            m_RootContainer                = new VisualElement();
            m_RootContainer.name           = VisualElementUtils.GetUniqueName("PanelContainer");
            m_RootContainer.persistenceKey = "PanelContainer"; // Required!
            visualTree.SetPanel(this);
            focusController = new FocusController(new VisualElementFocusRing(visualTree));
            m_StyleContext  = new StyleSheets.StyleContext(m_RootContainer);

            allowPixelCaching = true;
        }
Ejemplo n.º 3
0
        public Panel(ScriptableObject ownerObject, ContextType contextType, IDataWatchService dataWatch = null, EventDispatcher dispatcher = null)
        {
            m_VisualTreeUpdater = new VisualTreeUpdater(this);

            this.ownerObject               = ownerObject;
            this.contextType               = contextType;
            m_DataWatch                    = dataWatch;
            this.dispatcher                = dispatcher ?? EventDispatcher.instance;
            repaintData                    = new RepaintData();
            cursorManager                  = new CursorManager();
            contextualMenuManager          = null;
            m_RootContainer                = new VisualElement();
            m_RootContainer.name           = VisualElementUtils.GetUniqueName("PanelContainer");
            m_RootContainer.persistenceKey = "PanelContainer"; // Required!
            visualTree.SetPanel(this);
            focusController       = new FocusController(new VisualElementFocusRing(visualTree));
            m_ProfileUpdateName   = "PanelUpdate";
            m_ProfileLayoutName   = "PanelLayout";
            m_ProfileBindingsName = "PanelBindings";

            allowPixelCaching = true;
        }
        internal static Panel FindOrCreatePanel(ScriptableObject ownerObject, ContextType contextType, IDataWatchService dataWatch = null)
        {
            Panel panel;

            if (!UIElementsUtility.s_UIElementsCache.TryGetValue(ownerObject.GetInstanceID(), out panel))
            {
                panel = new Panel(ownerObject, contextType, dataWatch, UIElementsUtility.eventDispatcher);
                UIElementsUtility.s_UIElementsCache.Add(ownerObject.GetInstanceID(), panel);
            }
            else
            {
                Debug.Assert(contextType == panel.contextType, "Context type mismatch");
            }
            return(panel);
        }
Ejemplo n.º 5
0
        internal static Panel FindOrCreatePanel(int instanceId, ContextType contextType, IDataWatchService dataWatch = null, LoadResourceFunction loadResourceFunction = null)
        {
            Panel panel;

            if (!UIElementsUtility.s_UIElementsCache.TryGetValue(instanceId, out panel))
            {
                panel = new Panel(instanceId, contextType, loadResourceFunction, dataWatch, UIElementsUtility.eventDispatcher);
                UIElementsUtility.s_UIElementsCache.Add(instanceId, panel);
            }
            else
            {
                Debug.Assert(contextType == panel.contextType, "Context type mismatch");
            }
            return(panel);
        }
Ejemplo n.º 6
0
        public Panel(int instanceID, ContextType contextType, LoadResourceFunction loadResourceDelegate = null, IDataWatchService dataWatch = null, IDispatcher dispatcher = null)
        {
            this.instanceID  = instanceID;
            this.contextType = contextType;
            LoadResourceFunction arg_3B_1 = loadResourceDelegate;

            if (loadResourceDelegate == null)
            {
                if (Panel.< > f__mg$cache0 == null)
                {
                    Panel.< > f__mg$cache0 = new LoadResourceFunction(Resources.Load);
                }
                arg_3B_1 = Panel.< > f__mg$cache0;
            }
            this.loadResourceFunc     = arg_3B_1;
            this.dataWatch            = dataWatch;
            this.dispatcher           = dispatcher;
            this.stylePainter         = new StylePainter();
            this.m_RootContainer      = new VisualContainer();
            this.m_RootContainer.name = VisualElementUtils.GetUniqueName("PanelContainer");
            this.visualTree.ChangePanel(this);
            this.m_StyleContext = new StyleContext(this.m_RootContainer);
            this.defaultIMRoot  = new IMContainer
            {
                name        = "DefaultOnGUI",
                pickingMode = PickingMode.Ignore
            };
            this.defaultIMRoot.StretchToParentSize();
            this.visualTree.InsertChild(0, this.defaultIMRoot);
            this.allowPixelCaching = true;
        }