public BorderedButton(HudParentBase parent) : base(parent) { border = new BorderBox(this) { Thickness = 1f, DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding, }; AutoResize = false; Format = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center); FocusTextColor = TerminalFormatting.Charcoal; Text = "NewBorderedButton"; TextPadding = new Vector2(32f, 0f); Padding = new Vector2(37f, 0f); Size = new Vector2(253f, 50f); HighlightEnabled = true; Color = TerminalFormatting.OuterSpace; HighlightColor = TerminalFormatting.Atomic; BorderColor = TerminalFormatting.LimedSpruce; FocusColor = TerminalFormatting.Mint; UseFocusFormatting = true; _mouseInput.GainedInputFocus += GainFocus; _mouseInput.LostInputFocus += LoseFocus; }
public TileElement(HudParentBase parent = null) : base(parent) { background = new TexturedBox(this) { DimAlignment = DimAlignments.Both, Color = TerminalFormatting.Gunmetal, }; var border = new BorderBox(this) { DimAlignment = DimAlignments.Both, Color = new Color(58, 68, 77), Thickness = 1f, }; controls = new HudChain <TerminalControlBase>(true, this) { DimAlignment = DimAlignments.Width | DimAlignments.IgnorePadding, SizingMode = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth, Spacing = 12f, }; Padding = new Vector2(16f); Size = new Vector2(300f, 250f); }
public BorderedCheckBox(HudParentBase parent) : base(parent) { border = new BorderBox(this) { Thickness = 1f, DimAlignment = DimAlignments.Both, }; tickBox = new TexturedBox() { DimAlignment = DimAlignments.Both, Padding = new Vector2(17f), }; tickBox.Register(this, true); Size = new Vector2(37f); Color = TerminalFormatting.OuterSpace; HighlightColor = TerminalFormatting.Atomic; FocusColor = TerminalFormatting.Mint; TickBoxColor = TerminalFormatting.StormGrey; TickBoxHighlightColor = Color.White; TickBoxFocusColor = TerminalFormatting.Cinder; BorderColor = TerminalFormatting.LimedSpruce; UseFocusFormatting = true; MouseInput.LeftClicked += ToggleValue; MouseInput.GainedInputFocus += GainFocus; MouseInput.LostInputFocus += LoseFocus; }
public DrawBox ToDrawBox() => new DrawBox { MarginBox = MarginBox.GetValueOrDefault(), BorderBox = BorderBox.GetValueOrDefault(), PaddingBox = PaddingBox.GetValueOrDefault(), ContentBox = ContentBox.GetValueOrDefault(), };
OpenLayoutWindow(MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, Action<string> onSubmitted) : base(Gtk.WindowType.Toplevel) { _onSubmitted = onSubmitted; this.Build (); scrolledwindow1.Child = treeviewGenerateActions; scrolledwindow1.ShowAll (); treeviewGenerateActions.Cancel += delegate { Destroy (); }; treeviewGenerateActions.Submit += delegate { if (String.IsNullOrEmpty(_selectedItem) == false) { _onSubmitted(_selectedItem); } Destroy (); }; WindowTransparencyDecorator.Attach (this); treeviewGenerateActions.HeadersVisible = false; treeviewGenerateActions.Model = optionsStore; TreeViewColumn column = new TreeViewColumn (); var pixbufRenderer = new CellRendererImage (); column.PackStart (pixbufRenderer, false); column.AddAttribute (pixbufRenderer, "image", 0); CellRendererText textRenderer = new CellRendererText (); column.PackStart (textRenderer, true); column.AddAttribute (textRenderer, "text", 1); column.Expand = true; treeviewGenerateActions.AppendColumn (column); treeviewGenerateActions.Selection.Changed += TreeviewGenerateActionsSelectionChanged; this.Remove (this.vbox1); BorderBox messageArea = new BorderBox (); messageArea.Add (vbox1); this.Add (messageArea); this.ShowAll (); int x = completionContext.TriggerXCoord; int y = completionContext.TriggerYCoord; int w, h; GetSize (out w, out h); int myMonitor = Screen.GetMonitorAtPoint (x, y); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, myMonitor); if (x + w > geometry.Right) x = geometry.Right - w; if (y + h > geometry.Bottom) y = y - completionContext.TriggerTextHeight - h; Move (x, y); }
public override void Draw() { if (Size == null || Location == null) { return; } BorderBox.Draw(new Rect(Location.Value.x, Location.Value.y, borderSize.x, borderSize.y), Textures); base.Draw(); }
private BorderBox CreateCallButton(DiscountDetailContentUI parentContentUI, string bindingProperty) { int btnHeight = Device.OnPlatform(50, 50, 64); var imgPhone = new Image { Source = parentContentUI.IconPhone, HeightRequest = btnHeight / 1.5, WidthRequest = btnHeight / 1.5 }; var txtPhone = new Label { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Style = (Style)App.Current.Resources[LabelStyles.DetailPhoneStyle] }; txtPhone.SetBinding(Label.TextProperty, bindingProperty); AbsoluteLayout phoneLayout = new AbsoluteLayout { BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor] }; AbsoluteLayout.SetLayoutFlags(imgPhone, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(imgPhone, new Rectangle(0.1, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize) ); AbsoluteLayout.SetLayoutFlags(txtPhone, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds( txtPhone, new Rectangle( 0.7, // X 0.5, // Y AbsoluteLayout.AutoSize, // Width AbsoluteLayout.AutoSize) // Height ); phoneLayout.Children.Add(imgPhone); phoneLayout.Children.Add(txtPhone); var borderPhone = new BorderBox(); borderPhone.HeightRequest = btnHeight - 8; borderPhone.BorderWidth = 1; borderPhone.BorderColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor]; borderPhone.Content = phoneLayout; return(borderPhone); }
public RebindHud(HudParentBase parent) : base(parent) { background = new TexturedBox(this) { Color = new Color(37, 46, 53), DimAlignment = DimAlignments.Both, }; border = new BorderBox(this) { Thickness = 1f, Color = new Color(53, 66, 75), DimAlignment = DimAlignments.Both, }; header = new Label(this) { AutoResize = false, DimAlignment = DimAlignments.Width | DimAlignments.IgnorePadding, Height = 24f, ParentAlignment = ParentAlignments.Top | ParentAlignments.InnerV | ParentAlignments.UsePadding, Offset = new Vector2(0f, -42f), Format = new GlyphFormat(Color.White, TextAlignment.Center, 1.25f), Text = "SELECT CONTROL", }; var divider = new TexturedBox(header) { DimAlignment = DimAlignments.Width, Height = 1f, ParentAlignment = ParentAlignments.Bottom, Offset = new Vector2(0f, -10f), Color = new Color(84, 98, 111), }; subheader = new Label(divider) { AutoResize = false, DimAlignment = DimAlignments.Width, Height = 24f, ParentAlignment = ParentAlignments.Bottom, Offset = new Vector2(0f, -41f), Format = new GlyphFormat(GlyphFormat.Blueish.Color, TextAlignment.Center, 1.25f), Text = "Please press a key", }; Padding = new Vector2(372f, 0f); Size = new Vector2(1210f, 288f); ZOffset = sbyte.MaxValue - 1; layerData.zOffsetInner = byte.MaxValue - 1; }
public Tooltip(Texture2D pixelTexture, SpriteFont font) { _box = new BorderBox(pixelTexture) { BorderBoxInfo = ControlConstants.TOOLTIP_BOX_SIZE }; _text = new TextBox(font) { TextBoxInfo = ControlConstants.TOOLTIP_TEXT }; Show = false; }
public ModList(HudParentBase parent = null) : base(parent) { scrollBox = new ScrollBox <ModControlRoot, LabelElementBase>(true, this) { SizingMode = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.ClampChainBoth, ParentAlignment = ParentAlignments.Bottom | ParentAlignments.InnerV, Color = TerminalFormatting.DarkSlateGrey, Padding = new Vector2(6f) }; listInput = new ListInputElement <ModControlRoot, LabelElementBase>(scrollBox); header = new LabelBox(scrollBox) { AutoResize = false, ParentAlignment = ParentAlignments.Top, DimAlignment = DimAlignments.Width, Size = new Vector2(200f, 36f), Color = new Color(32, 39, 45), Format = TerminalFormatting.ControlFormat, Text = "Mod List:", TextPadding = new Vector2(30f, 0f), }; var listDivider = new TexturedBox(header) { ParentAlignment = ParentAlignments.Bottom, DimAlignment = DimAlignments.Width, Height = 1f, Color = new Color(53, 66, 75), }; var listBorder = new BorderBox(this) { DimAlignment = DimAlignments.Both, Thickness = 1f, Color = new Color(53, 66, 75), }; }
public TextField(HudParentBase parent) : base(parent) { border = new BorderBox(background) { Thickness = 1f, DimAlignment = DimAlignments.Both, }; textBox = new TextBox(background) { AutoResize = false, DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding, Padding = new Vector2(24f, 0f), MoveToEndOnGainFocus = true, ClearSelectionOnLoseFocus = true }; Format = TerminalFormatting.ControlFormat; FocusTextColor = TerminalFormatting.Charcoal; Text = "NewTextField"; Color = TerminalFormatting.OuterSpace; HighlightColor = TerminalFormatting.Atomic; FocusColor = TerminalFormatting.Mint; BorderColor = TerminalFormatting.LimedSpruce; UseFocusFormatting = true; HighlightEnabled = true; Size = new Vector2(319f, 40); textBox.TextBoard.TextChanged += OnTextChanged; MouseInput.CursorEntered += CursorEnter; MouseInput.CursorExited += CursorExit; MouseInput.LostInputFocus += LoseFocus; }
GenerateCodeWindow(CodeGenerationOptions options, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext) : base(Gtk.WindowType.Toplevel) { this.options = options; this.Build(); scrolledwindow1.Child = treeviewGenerateActions; scrolledwindow1.ShowAll(); scrolledwindow2.Child = treeviewSelection; scrolledwindow2.ShowAll(); treeviewGenerateActions.Cancel += delegate { Destroy(); }; treeviewGenerateActions.Submit += delegate { treeviewSelection.GrabFocus(); }; treeviewSelection.Cancel += delegate { treeviewGenerateActions.GrabFocus(); }; treeviewSelection.Submit += delegate { if (curInitializeObject != null) { curInitializeObject.GenerateCode(); curInitializeObject = null; } Destroy(); }; WindowTransparencyDecorator.Attach(this); treeviewSelection.HeadersVisible = false; treeviewGenerateActions.HeadersVisible = false; treeviewGenerateActions.Model = generateActionsStore; TreeViewColumn column = new TreeViewColumn(); var pixbufRenderer = new CellRendererImage(); column.PackStart(pixbufRenderer, false); column.AddAttribute(pixbufRenderer, "image", 0); CellRendererText textRenderer = new CellRendererText(); column.PackStart(textRenderer, true); column.AddAttribute(textRenderer, "text", 1); column.Expand = true; treeviewGenerateActions.AppendColumn(column); treeviewGenerateActions.Selection.Changed += TreeviewGenerateActionsSelectionChanged; this.Remove(this.vbox1); BorderBox messageArea = new BorderBox(); messageArea.Add(vbox1); this.Add(messageArea); this.ShowAll(); int x = completionContext.TriggerXCoord; int y = completionContext.TriggerYCoord; int w, h; GetSize(out w, out h); int myMonitor = Screen.GetMonitorAtPoint(x, y); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, myMonitor); if (x + w > geometry.Right) { x = geometry.Right - w; } if (y + h > geometry.Bottom) { y = y - completionContext.TriggerTextHeight - h; } Move(x, y); }
public CombatStateTargetUI(ContentManager _content) { Texture2D buttonTexture = _content.Load <Texture2D>(ControlConstants.BUTTON_TEXTURE); SpriteFont buttonFont = _content.Load <SpriteFont>(ControlConstants.BUTTON_FONT); Texture2D pixelTexture = _content.Load <Texture2D>(Config.PIXEL_TEXTURE); BorderBox CanvasBox = new BorderBox(pixelTexture) { BorderBoxInfo = ControlConstants.COMBATMODE_CANVAS }; Button BuildModeButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_BUILDMODE, }; ProgressBarButton TargetEnemyShipButton = new ProgressBarButton(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_TARGETENEMYSHIP, }; ProgressBarButton TargetStoragesButton = new ProgressBarButton(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_TARGETSTORAGES, }; ProgressBarButton TargetWeaponsButton = new ProgressBarButton(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_TARGETWEAPONS, }; ProgressBarButton TargetPowerGenButton = new ProgressBarButton(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_TARGETPOWERGEN, }; ProgressBarButton TargetPowerStorageButton = new ProgressBarButton(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_TARGETPOWERSTORAGE, }; TextBox CombatModeTitle = new TextBox(buttonFont) { TextBoxInfo = ControlConstants.COMBATMODE_TITLE, }; _gridBox = new BorderBox(pixelTexture) { BorderBoxInfo = ControlConstants.BUILDMODE_GRIDBOX }; Button FireWeapon = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_FIREWEAPON }; Button RepairRoom = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_REPAIRROOM }; UI_Components = new List <UI_Component>() { CanvasBox, BuildModeButton, CombatModeTitle, _gridBox, TargetEnemyShipButton, TargetStoragesButton, TargetWeaponsButton, TargetPowerGenButton, TargetPowerStorageButton, FireWeapon, RepairRoom }; }
public DiscountTemplate(ListViewAnimation parentListView, int rowHeight) { SelectColor = (Color)App.Current.Resources[MainStyles.ListSelectColor]; Grid gridDiscountItem = new Grid { Padding = new Thickness(10), BackgroundColor = (Color)App.Current.Resources[MainStyles.ListBackgroundColor], RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) } } }; var fileNameConverter = new FileNameToImageConverter(); // Company logo var imgCompanyLogo = new ImageExtended { WidthRequest = Device.OnPlatform(64, 64, 64), HeightRequest = Device.OnPlatform(64, 64, 64), Aspect = Aspect.AspectFit, }; imgCompanyLogo.SetBinding(Image.SourceProperty, new Binding("LogoFileName", BindingMode.Default, fileNameConverter)); var stackCompanyLogo = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { imgCompanyLogo } }; gridDiscountItem.Children.Add(stackCompanyLogo, 0, 1, 0, 2); // Header Grid headerLayout = new Grid { Padding = new Thickness(2, 0, 0, 0), RowDefinitions = { new RowDefinition { Height = GridLength.Auto } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition { Width = GridLength.Auto } //new GridLength(1, GridUnitType.Star)}, } }; // Title var txtTitle = new Label { VerticalOptions = LayoutOptions.End, Style = (Style)App.Current.Resources[LabelStyles.ListTitleStyle] }; txtTitle.SetBinding(Label.TextProperty, "Name"); headerLayout.Children.Add(txtTitle, 0, 0); #region Percent label var txtPercent = new Label { Style = (Style)App.Current.Resources[LabelStyles.ListPercentStyle], VerticalOptions = LayoutOptions.End }; txtPercent.SetBinding(Label.TextProperty, "DiscountPercent"); var percentLayout = new StackLayout { Spacing = 0, Orientation = StackOrientation.Horizontal, Children = { txtPercent, new Label { Style = (Style)App.Current.Resources[LabelStyles.ListPercentSymbolStyle], VerticalOptions = LayoutOptions.End } } }; #endregion #region Category layout var txtCategory = new Label { Style = (Style)App.Current.Resources[LabelStyles.CategoryStyle], VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand }; txtCategory.SetBinding(Label.TextProperty, "FirstCategoryName"); txtCategory.SetBinding(BackgroundColorProperty, "FirstCategoryColor"); var categoryLayout = new StackLayout { Padding = Device.OnPlatform(new Thickness(4), new Thickness(4), new Thickness(6)), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { txtCategory } }; categoryLayout.SetBinding(BackgroundColorProperty, "FirstCategoryColor"); var txtCategoryMore = new Label { Text = "...", Style = (Style)App.Current.Resources[LabelStyles.CategoryStyle], VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand }; txtCategory.SetBinding(BackgroundColorProperty, "FirstCategoryColor"); var stackCategoryMore = new StackLayout { Padding = Device.OnPlatform(new Thickness(4), new Thickness(4), new Thickness(6)), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { txtCategoryMore } }; stackCategoryMore.SetBinding(BackgroundColorProperty, "FirstCategoryColor"); stackCategoryMore.SetBinding(IsVisibleProperty, "IsCategoryMore"); #endregion var infoDiscountLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { percentLayout, categoryLayout, stackCategoryMore } }; headerLayout.Children.Add(infoDiscountLayout, 1, 0); gridDiscountItem.Children.Add(headerLayout, 1, 2, 0, 1); #region Description var txtDescription = new LabelExtended { IsWrapped = true, Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle], }; txtDescription.GestureRecognizers.Clear(); txtDescription.SetBinding(LabelExtended.TextProperty, new Binding("Description", BindingMode.Default, new TextHeightLimitation())); var layoutDescription = new RelativeLayout(); layoutDescription.Children.Add(txtDescription, Constraint.Constant(2), Constraint.Constant(0), Constraint.RelativeToParent(parent => { return(parent.Width - 2); }), Constraint.RelativeToParent(parent => { return(parent.Height); })); gridDiscountItem.Children.Add(layoutDescription, 1, 2, 1, 2); #endregion var boxBorder = new BorderBox { Padding = new Thickness(8, 4), HeightRequest = rowHeight - 16, }; boxBorder.BorderColor = (Color)App.Current.Resources[MainStyles.ListBorderColor]; boxBorder.BorderWidth = 1; boxBorder.Content = gridDiscountItem; var layout = new AbsoluteLayout { Padding = new Thickness(8, 4), }; parentListView.AnimationListAdd(layout); AbsoluteLayout.SetLayoutFlags(boxBorder, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(boxBorder, new Rectangle(0f, 0f, 1f, 1f)); layout.Children.Add(boxBorder); View = layout; }
public OnOffButton(HudParentBase parent) : base(parent) { mouseInput = new MouseInputElement(this); background = new TexturedBox(this) { DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding, }; bgBorder = new BorderBox(background) { DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding, }; on = new LabelBox() { AutoResize = false, Size = new Vector2(71f, 49f), Format = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center), Text = "On" }; onBorder = new BorderBox(on) { Thickness = 2f, DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding, }; off = new LabelBox() { AutoResize = false, Size = new Vector2(71f, 49f), Format = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center), Text = "Off" }; offBorder = new BorderBox(off) { Thickness = 2f, DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding, }; buttonChain = new HudChain(false, bgBorder) { SizingMode = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth, Padding = new Vector2(12f, 10f), Spacing = 9f, CollectionContainer = { on, off } }; Size = new Vector2(166f, 58f); BackgroundColor = TerminalFormatting.Cinder.SetAlphaPct(0.8f); HighlightColor = TerminalFormatting.Atomic; FocusColor = TerminalFormatting.Mint; BorderColor = TerminalFormatting.LimedSpruce; UnselectedColor = TerminalFormatting.OuterSpace; SelectionColor = TerminalFormatting.DullMint; HighlightEnabled = true; UseFocusFormatting = true; mouseInput.LeftClicked += LeftClick; }
public void Render(RenderContext context, BorderBox border) { renderAction(context, border); }
GenerateCodeWindow (CodeGenerationOptions options, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext) : base(Gtk.WindowType.Toplevel) { this.options = options; this.Build (); scrolledwindow1.Child = treeviewGenerateActions; scrolledwindow1.ShowAll (); scrolledwindow2.Child = treeviewSelection; scrolledwindow2.ShowAll (); treeviewGenerateActions.Cancel += delegate { Destroy (); }; treeviewGenerateActions.Submit += delegate { treeviewSelection.GrabFocus (); }; treeviewSelection.Cancel += delegate { treeviewGenerateActions.GrabFocus (); }; treeviewSelection.Submit += delegate { if (curInitializeObject != null) { curInitializeObject.GenerateCode (); curInitializeObject = null; } Destroy (); }; WindowTransparencyDecorator.Attach (this); treeviewSelection.HeadersVisible = false; treeviewGenerateActions.HeadersVisible = false; treeviewGenerateActions.Model = generateActionsStore; TreeViewColumn column = new TreeViewColumn (); var pixbufRenderer = new CellRendererPixbuf (); column.PackStart (pixbufRenderer, false); column.AddAttribute (pixbufRenderer, "pixbuf", 0); CellRendererText textRenderer = new CellRendererText (); column.PackStart (textRenderer, true); column.AddAttribute (textRenderer, "text", 1); column.Expand = true; treeviewGenerateActions.AppendColumn (column); treeviewGenerateActions.Selection.Changed += TreeviewGenerateActionsSelectionChanged; this.Remove (this.vbox1); BorderBox messageArea = new BorderBox (); messageArea.Add (vbox1); this.Add (messageArea); this.ShowAll (); int x = completionContext.TriggerXCoord; int y = completionContext.TriggerYCoord; int w, h; GetSize (out w, out h); int myMonitor = Screen.GetMonitorAtPoint (x, y); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, myMonitor); if (x + w > geometry.Right) x = geometry.Right - w; if (y + h > geometry.Bottom) y = y - completionContext.TriggerTextHeight - h; Move (x, y); }
public BuildState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content, Ship ship) : base(game, graphicsDevice, content) { this.Ship = ship; Texture2D buttonTexture = _content.Load <Texture2D>(ControlConstants.BUTTON_TEXTURE); SpriteFont buttonFont = _content.Load <SpriteFont>(ControlConstants.BUTTON_FONT); Texture2D pixelTexture = _content.Load <Texture2D>(Config.PIXEL_TEXTURE); _combatModeButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.BUILDMODE_COMBATMODE, }; _combatModeButton.Click += CombatModeButton_Click; TextBox MetalAmountText = new TextBox(buttonFont) { TextBoxInfo = ControlConstants.PRIMARY_TEXTBOX }; _metalAmount = new TextBox(buttonFont) { TextBoxInfo = ControlConstants.PRIMARY_TEXTBOX_VALUE }; Button RoomButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.BUILDMODE_ROOM, }; RoomButton.Click += RoomButton_Click; Button ComponentBuildButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.BUILDMODE_COMPONENTBUILD, }; ComponentBuildButton.Click += ComponentBuildButton_Click; Button ShipButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.BUILDMODE_SHIP, }; ShipButton.Click += ShipBuildButton_Click; TextBox BuildModeTitle = new TextBox(buttonFont) { TextBoxInfo = ControlConstants.BUILDMODE_TITLE, }; BorderBox GridBox = new BorderBox(pixelTexture) { BorderBoxInfo = ControlConstants.BUILDMODE_GRIDBOX }; GridBox.SetPosition(Ship.Grid.Info.GridRectangle, ControlConstants.BUILDMODE_GRIDBOX.Padding); BorderBox Canvas = new BorderBox(pixelTexture) { BorderBoxInfo = ControlConstants.BUILDMODE_CANVAS }; _tooltip = new Tooltip(pixelTexture, buttonFont); _uicomponents = new List <UI_Component>() { _combatModeButton, RoomButton, ComponentBuildButton, ShipButton, BuildModeTitle, GridBox, Canvas, MetalAmountText, _metalAmount, }; }
public ColorPickerRGB(HudParentBase parent) : base(parent) { // Header name = new Label() { Format = GlyphFormat.Blueish.WithSize(1.08f), Text = "NewColorPicker", AutoResize = false, Size = new Vector2(88f, 22f) }; display = new TexturedBox() { Width = 231f, Color = Color.Black }; var dispBorder = new BorderBox(display) { Color = Color.White, Thickness = 1f, DimAlignment = DimAlignments.Both, }; headerChain = new HudChain(false) { SizingMode = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth, Height = 22f, Spacing = 0f, CollectionContainer = { name, display } }; // Color picker sliderText = new Label[] { new Label() { AutoResize = false, Format = TerminalFormatting.ControlFormat, Height = 47f }, new Label() { AutoResize = false, Format = TerminalFormatting.ControlFormat, Height = 47f }, new Label() { AutoResize = false, Format = TerminalFormatting.ControlFormat, Height = 47f } }; colorNameColumn = new HudChain <HudElementContainer <Label>, Label>(true) { SizingMode = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth, Width = 87f, Spacing = 5f, CollectionContainer = { sliderText[0], sliderText[1], sliderText[2] } }; sliders = new SliderBox[] { new SliderBox() { Min = 0f, Max = 255f, Height = 47f }, new SliderBox() { Min = 0f, Max = 255f, Height = 47f }, new SliderBox() { Min = 0f, Max = 255f, Height = 47f } }; colorSliderColumn = new HudChain <HudElementContainer <SliderBox>, SliderBox>(true) { SizingMode = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth, Width = 231f, Spacing = 5f, CollectionContainer = { sliders[0], sliders[1], sliders[2] } }; colorChain = new HudChain(false) { SizingMode = HudChainSizingModes.FitChainBoth, CollectionContainer = { colorNameColumn, colorSliderColumn, } }; mainChain = new HudChain(true, this) { SizingMode = HudChainSizingModes.FitChainBoth, Spacing = 5f, CollectionContainer = { headerChain, colorChain, } }; Size = new Vector2(318f, 163f); valueBuilder = new StringBuilder(); UseCursor = true; ShareCursor = true; }
public PropertyListMenu(QuickActionMenu parent) : base(parent) { quickActionMenu = parent; header = new LabelBox() { Format = listHeaderFormat, Text = "Build Vision", AutoResize = false, Size = new Vector2(300f, 34f), Color = headerColor, }; listBody = new ScrollBox <PropertyListEntry, PropertyListEntryElement>(true) { MemberMinSize = new Vector2(300f, 0f), SizingMode = HudChainSizingModes.ClampChainOffAxis | HudChainSizingModes.FitChainAlignAxis, Padding = new Vector2(30f, 16f), Color = bodyColor, EnableScrolling = false, UseSmoothScrolling = false, MinVisibleCount = 10, Visible = false, }; listBody.ScrollBar.Padding = new Vector2(12f, 16f); listBody.ScrollBar.Width = 4f; peekBody = new LabelBox() { AutoResize = false, VertCenterText = false, Color = bodyColor, TextPadding = new Vector2(48f, 16f), BuilderMode = TextBuilderModes.Lined, }; var border = new BorderBox(listBody) { DimAlignment = DimAlignments.Both, Color = new Color(58, 68, 77), Thickness = 1f, }; highlightBox = new HighlightBox(listBody.Background) { Padding = new Vector2(16f, 0f) }; footer = new DoubleLabelBox() { AutoResize = false, TextPadding = new Vector2(48f, 0f), Size = new Vector2(300f, 24f), Color = headerColor, }; layout = new HudChain(true, this) { MemberMinSize = new Vector2(300f, 0f), SizingMode = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth, CollectionContainer = { header, { listBody,true }, { peekBody,true }, footer } }; debugText = new Label(layout) { ParentAlignment = ParentAlignments.Right, BuilderMode = TextBuilderModes.Lined }; peekBuilder = new RichText(); entryPool = new ObjectPool <PropertyListEntry>(() => new PropertyListEntry(), x => x.Reset()); notificationTimer = new Stopwatch(); listWrapTimer = new Stopwatch(); }