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 static void AddHoverEffect(ITextBox textbox) { var uiEvents = textbox.GetComponent <IUIEvents>(); uiEvents.MouseEnter.Subscribe(_ => textbox.TextConfig = HoverTextConfig); uiEvents.MouseLeave.Subscribe(_ => textbox.TextConfig = TextConfig); }
public void Load(IPanel parent) { _parent = parent; var factory = _game.Factory; _searchBox = factory.UI.GetTextBox("GameDebugInspectorSearchBox", 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; var height = parent.Height - _searchBox.Height; _scrollingPanel = factory.UI.GetPanel("GameDebugInspectorScrollingPanel", parent.Width, height, 0f, height, parent); _scrollingPanel.RenderLayer = _layer; _scrollingPanel.Pivot = new PointF(0f, 1f); _scrollingPanel.Tint = Colors.Transparent; _scrollingPanel.Border = AGSBorders.SolidColor(Colors.Green, 2f); _panel = factory.UI.GetPanel("GameDebugInspectorPanel", parent.Width, _padding, 0f, height - _padding, _scrollingPanel); _panel.Tint = Colors.Transparent; _panel.RenderLayer = _layer; var treeView = _panel.AddComponent <ITreeViewComponent>(); treeView.SkipRenderingRoot = true; treeView.NodeViewProvider = new InspectorTreeNodeProvider(treeView.NodeViewProvider, _game.Factory); Inspector = new AGSInspector(_game.Factory, _game.Settings); _panel.AddComponent <IInspectorComponent>(Inspector); factory.UI.CreateScrollingPanel(_scrollingPanel); _parent.Bind <IScaleComponent>(c => c.PropertyChanged += onParentPanelScaleChanged, c => c.PropertyChanged -= onParentPanelScaleChanged); }
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 static void AddHoverEffect(ITextBox textbox) { textbox.TextBackgroundVisible = true; textbox.Tint = TextboxColor; textbox.Border = TextboxBorder; var uiEvents = textbox.GetComponent <IUIEvents>(); uiEvents.MouseEnter.Subscribe(_ => { textbox.TextConfig = TextboxHoverTextConfig; textbox.Tint = TextboxHoverColor; textbox.Border = TextboxHoverBorder; }); uiEvents.MouseLeave.Subscribe(_ => { textbox.TextConfig = TextboxTextConfig; textbox.Tint = TextboxColor; textbox.Border = TextboxBorder; }); }
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); }
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; }; }