Пример #1
0
        public void Load(IPanel parent, IForm parentForm)
        {
            _parent = parent;
            var factory = _editor.Editor.Factory;

            _searchBox             = factory.UI.GetTextBox($"{_idPrefix}_InspectorSearchBox", 0f, parent.Height, parent, "Search...", width: parent.Width, height: 30f);
            _searchBox.RenderLayer = _layer;
            _searchBox.Border      = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 2f);
            _searchBox.Tint        = GameViewColors.Textbox;
            _searchBox.Pivot       = new PointF(0f, 1f);
            _searchBox.GetComponent <ITextComponent>().PropertyChanged += onSearchPropertyChanged;

            var height = parent.Height - _searchBox.Height - _gutterSize;

            _scrollingPanel             = factory.UI.GetPanel($"{_idPrefix}_InspectorScrollingPanel", parent.Width - _gutterSize, height, 0f, parent.Height - _searchBox.Height, parent);
            _scrollingPanel.RenderLayer = _layer;
            _scrollingPanel.Pivot       = new PointF(0f, 1f);
            _scrollingPanel.Tint        = Colors.Transparent;
            _scrollingPanel.Border      = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 2f);
            _contentsPanel = factory.UI.CreateScrollingPanel(_scrollingPanel);

            _treePanel             = factory.UI.GetPanel($"{_idPrefix}_InspectorPanel", 0f, 0f, 0f, _contentsPanel.Height - _padding, _contentsPanel);
            _treePanel.Tint        = Colors.Transparent;
            _treePanel.RenderLayer = _layer;
            _treePanel.Pivot       = new PointF(0f, 1f);
            var treeView = _treePanel.AddComponent <ITreeViewComponent>();

            treeView.SkipRenderingRoot = true;

            Inspector = new AGSInspector(_editor.Editor.Factory, _editor.Game.Settings, _editor.Editor.Settings, _actions, _editor.Project.Model, _editor, parentForm);
            _treePanel.AddComponent <IInspectorComponent>(Inspector);
            Inspector.ScrollingContainer = _contentsPanel;

            _inspectorNodeView = new InspectorTreeNodeProvider(treeView.NodeViewProvider,
                                                               _editor.Editor.Events, _treePanel);
            _inspectorNodeView.Resize(_contentsPanel.Width);
            treeView.NodeViewProvider = _inspectorNodeView;

            _parent.Bind <IScaleComponent>(c => c.PropertyChanged += onParentPanelScaleChanged,
                                           c => c.PropertyChanged -= onParentPanelScaleChanged);
        }