public void Load(IPanel parent) { _parent = parent; _panelId = parent.TreeNode.GetRoot().ID; var factory = _editor.Editor.Factory; _searchBox = factory.UI.GetTextBox("GameDebugTreeSearchBox", 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; _scrollingPanel = factory.UI.GetPanel("GameDebugTreeScrollingPanel", parent.Width - _gutterSize, parent.Height - _searchBox.Height - _gutterSize, 0f, 0f, parent); _scrollingPanel.RenderLayer = _layer; _scrollingPanel.Pivot = new PointF(0f, 0f); _scrollingPanel.Tint = Colors.Transparent; _scrollingPanel.Border = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 2f); _contentsPanel = factory.UI.CreateScrollingPanel(_scrollingPanel); _treeView = _contentsPanel.AddComponent <ITreeViewComponent>(); _treeView.OnNodeSelected.Subscribe(onTreeNodeSelected); _treeView.TopPadding = 30f; _treeView.LeftPadding = 5f; parent.GetComponent <IScaleComponent>().PropertyChanged += (_, args) => { if (args.PropertyName != nameof(IScaleComponent.Height)) { return; } _contentsPanel.BaseSize = new SizeF(_contentsPanel.Width, parent.Height - _searchBox.Height - _gutterSize); _searchBox.Y = _parent.Height; }; }
public NodesExpander(ITreeViewComponent treeView) { _treeView = treeView; _shouldExpand = new List <ITreeStringNode>(); treeView.Tree.TreeNode.RunOnTree(0, (node, _) => { if (!(treeView.IsCollapsed(node) ?? true)) { _shouldExpand.Add(node); } }); }
public RoomSubscriber(IRoom room, ITreeViewComponent treeView, Func <IRoom, ITreeStringNode> findRoom, Action <IObject, ITreeStringNode> addObjToTree, Action <IArea, ITreeStringNode> addAreaToTree, Action <string, ITreeStringNode> removeFromTree) { Room = room; _treeView = treeView; _findRoom = findRoom; _addObjToTree = addObjToTree; _removeFromTree = removeFromTree; _addAreaToTree = addAreaToTree; room.Areas.OnListChanged.Subscribe(onRoomAreasChanged); room.Objects.OnListChanged.Subscribe(onRoomObjectsChanged); }
public void Load(IPanel parent) { _parent = parent; _panelId = parent.TreeNode.GetRoot().ID; var factory = _game.Factory; _searchBox = factory.UI.GetTextBox("GameDebugTreeSearchBox", 0f, parent.Height, parent, "Search...", width: parent.Width, height: 30f); _searchBox.RenderLayer = _layer; _searchBox.Border = AGSBorders.SolidColor(Colors.Green, 2f); _searchBox.Tint = Colors.Transparent; _searchBox.Pivot = new PointF(0f, 1f); _searchBox.GetComponent <ITextComponent>().PropertyChanged += onSearchPropertyChanged; _scrollingPanel = factory.UI.GetPanel("GameDebugTreeScrollingPanel", parent.Width, parent.Height - _searchBox.Height, 0f, 0f, parent); _scrollingPanel.RenderLayer = _layer; _scrollingPanel.Pivot = new PointF(0f, 0f); _scrollingPanel.Tint = Colors.Transparent; _scrollingPanel.Border = AGSBorders.SolidColor(Colors.Green, 2f); const float lineHeight = 42f; _treePanel = factory.UI.GetPanel("GameDebugTreePanel", 1f, 1f, 0f, _scrollingPanel.Height - lineHeight, _scrollingPanel); _treePanel.Tint = Colors.Transparent; _treePanel.RenderLayer = _layer; _treeView = _treePanel.AddComponent <ITreeViewComponent>(); _treeView.OnNodeSelected.Subscribe(onTreeNodeSelected); factory.UI.CreateScrollingPanel(_scrollingPanel); parent.GetComponent <IScaleComponent>().PropertyChanged += (_, args) => { if (args.PropertyName != nameof(IScaleComponent.Height)) { return; } _scrollingPanel.Image = new EmptyImage(_scrollingPanel.Width, parent.Height - _searchBox.Height); _treePanel.Y = _scrollingPanel.Height - lineHeight; _searchBox.Y = _parent.Height; }; }
public override void Init() { base.Init(); Entity.Bind <ITreeViewComponent>(c => { _treeView = c; configureTree(); refreshTree(); }, _ => _treeView = null); }