public void Load(IPanel parent) { _parent = parent; var factory = _game.Factory; _searchBox = factory.UI.GetTextBox("GameDebugDisplayListSearchBox", 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.Visible = false; _searchBox.GetComponent <ITextComponent>().PropertyChanged += onSearchPropertyChanged; _scrollingPanel = factory.UI.GetPanel("GameDebugDisplayListScrollingPanel", 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); _scrollingPanel.Visible = false; const float lineHeight = 42f; _listPanel = factory.UI.GetPanel("GameDebugDisplayListPanel", 1f, 1f, 0f, _scrollingPanel.Height - lineHeight, _scrollingPanel); _listPanel.Tint = Colors.Transparent; _listPanel.RenderLayer = _layer; _listPanel.Pivot = new PointF(0f, 1f); _listPanel.AddComponent <IBoundingBoxWithChildrenComponent>(); _layout = _listPanel.AddComponent <IStackLayoutComponent>(); _listBox = _listPanel.AddComponent <IListboxComponent>(); var yellowBrush = factory.Graphics.Brushes.LoadSolidBrush(Colors.Yellow); var whiteBrush = factory.Graphics.Brushes.LoadSolidBrush(Colors.White); _listBox.ItemButtonFactory = text => { var button = factory.UI.GetButton("GameDebugDisplayListPanel_" + text, new ButtonAnimation(null, new AGSTextConfig(whiteBrush, autoFit: AutoFit.LabelShouldFitText), null), new ButtonAnimation(null, new AGSTextConfig(yellowBrush, autoFit: AutoFit.LabelShouldFitText), null), new ButtonAnimation(null, new AGSTextConfig(yellowBrush, outlineBrush: whiteBrush, outlineWidth: 0.5f, autoFit: AutoFit.LabelShouldFitText), null), 0f, 0f, width: 500f, height: 50f); button.RenderLayer = parent.RenderLayer; return(button); }; 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); _listPanel.Y = _scrollingPanel.Height - 10f; _searchBox.Y = _parent.Height; }; }
public void Load(IPanel parent) { _parent = parent; var factory = _editor.Factory; _searchBox = factory.UI.GetTextBox("GameDebugDisplayListSearchBox", 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.Visible = false; _searchBox.GetComponent <ITextComponent>().PropertyChanged += onSearchPropertyChanged; _scrollingPanel = factory.UI.GetPanel("GameDebugDisplayListScrollingPanel", 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); _scrollingPanel.Visible = false; _contentsPanel = factory.UI.CreateScrollingPanel(_scrollingPanel); _listPanel = factory.UI.GetPanel("GameDebugDisplayListPanel", 1f, 1f, 0f, _contentsPanel.Height - _padding, _contentsPanel); _listPanel.Tint = Colors.Transparent; _listPanel.RenderLayer = _layer; _listPanel.Pivot = new PointF(0f, 1f); _listPanel.AddComponent <IBoundingBoxWithChildrenComponent>(); _layout = _listPanel.AddComponent <IStackLayoutComponent>(); _listBox = _listPanel.AddComponent <IListboxComponent>(); var hoverBrush = factory.Graphics.Brushes.LoadSolidBrush(GameViewColors.HoveredText); var textBrush = factory.Graphics.Brushes.LoadSolidBrush(GameViewColors.Text); _listBox.ListItemFactory = text => { var button = factory.UI.GetButton("GameDebugDisplayListPanel_" + text, new ButtonAnimation(null, factory.Fonts.GetTextConfig(textBrush, autoFit: AutoFit.LabelShouldFitText), null), new ButtonAnimation(null, factory.Fonts.GetTextConfig(hoverBrush, autoFit: AutoFit.LabelShouldFitText), null), new ButtonAnimation(null, factory.Fonts.GetTextConfig(hoverBrush, outlineBrush: textBrush, outlineWidth: 0.5f, autoFit: AutoFit.LabelShouldFitText), null), 0f, 0f, width: 500f, height: 50f); button.RenderLayer = parent.RenderLayer; button.Text = text; return(button); }; parent.GetComponent <IScaleComponent>().PropertyChanged += (_, args) => { if (args.PropertyName != nameof(IScaleComponent.Height)) { return; } _contentsPanel.BaseSize = new SizeF(_contentsPanel.Width, parent.Height - _searchBox.Height - _gutterSize); _listPanel.Y = _contentsPanel.Height - _padding; _searchBox.Y = _parent.Height; }; }
public AGSListbox(IPanel scrollingPanel, IPanel contentsPanel, IListboxComponent listboxComponent) { ScrollingPanel = scrollingPanel; ContentsPanel = contentsPanel; ListboxComponent = listboxComponent; }