public NanoStyle() { var resCache = IoCManager.Resolve <IResourceCache>(); var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14); var notoSans16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 16); var notoSansBold16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 16); var textureCloseButton = resCache.GetTexture("/Nano/cross.svg.png"); var windowHeaderTex = resCache.GetTexture("/Nano/window_header.png"); var windowHeader = new StyleBoxTexture { Texture = windowHeaderTex, PatchMarginBottom = 3, ExpandMarginBottom = 3, }; var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png"); var windowBackground = new StyleBoxTexture { Texture = windowBackgroundTex, }; windowBackground.SetPatchMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); windowBackground.SetExpandMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); var buttonNormalTex = resCache.GetTexture("/Nano/button_normal.png"); var buttonNormal = new StyleBoxTexture { Texture = buttonNormalTex, }; buttonNormal.SetPatchMargin(StyleBox.Margin.All, 2); buttonNormal.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); var buttonHoverTex = resCache.GetTexture("/Nano/button_hover.png"); var buttonHover = new StyleBoxTexture { Texture = buttonHoverTex, }; buttonHover.SetPatchMargin(StyleBox.Margin.All, 2); buttonHover.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); var buttonPressedTex = resCache.GetTexture("/Nano/button_pressed.png"); var buttonPressed = new StyleBoxTexture { Texture = buttonPressedTex, }; buttonPressed.SetPatchMargin(StyleBox.Margin.All, 2); buttonPressed.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); var buttonDisabledTex = resCache.GetTexture("/Nano/button_disabled.png"); var buttonDisabled = new StyleBoxTexture { Texture = buttonDisabledTex, }; buttonDisabled.SetPatchMargin(StyleBox.Margin.All, 2); buttonDisabled.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); var lineEditTex = resCache.GetTexture("/Nano/lineedit.png"); var lineEdit = new StyleBoxTexture { Texture = lineEditTex, }; lineEdit.SetPatchMargin(StyleBox.Margin.All, 3); lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerPanelTex = resCache.GetTexture("/Nano/tabcontainer_panel.png"); var tabContainerPanel = new StyleBoxTexture { Texture = tabContainerPanelTex, }; tabContainerPanel.SetPatchMargin(StyleBox.Margin.All, 2); var tabContainerBoxActive = new StyleBoxFlat { BackgroundColor = new Color(64, 64, 64) }; tabContainerBoxActive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerBoxInactive = new StyleBoxFlat { BackgroundColor = new Color(32, 32, 32) }; tabContainerBoxInactive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var vScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginLeftOverride = 10 }; var vScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginLeftOverride = 10 }; var vScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginLeftOverride = 10 }; var hScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var hScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var hScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var progressBarBackground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.25f, 0.25f) }; progressBarBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); var progressBarForeground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.50f, 0.25f) }; progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); // CheckBox var checkBoxTextureChecked = resCache.GetTexture("/Nano/checkbox_checked.svg.96dpi.png"); var checkBoxTextureUnchecked = resCache.GetTexture("/Nano/checkbox_unchecked.svg.96dpi.png"); // Tooltip box var tooltipTexture = resCache.GetTexture("/Nano/tooltip.png"); var tooltipBox = new StyleBoxTexture { Texture = tooltipTexture, }; tooltipBox.SetPatchMargin(StyleBox.Margin.All, 2); tooltipBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); // Placeholder var placeholderTexture = resCache.GetTexture("/Nano/placeholder.png"); var placeholder = new StyleBoxTexture { Texture = placeholderTexture }; placeholder.SetPatchMargin(StyleBox.Margin.All, 24); placeholder.SetExpandMargin(StyleBox.Margin.All, -5); var itemListBackgroundSelected = new StyleBoxFlat { BackgroundColor = new Color(75, 75, 86) }; itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackgroundDisabled = new StyleBoxFlat { BackgroundColor = new Color(10, 10, 12) }; itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackground = new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68) }; itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); Stylesheet = new Stylesheet(new[] { // Default font. new StyleRule( new SelectorElement(null, null, null, null), new[] { new StyleProperty("font", notoSans12), }), // Window title. new StyleRule( new SelectorElement(typeof(Label), new[] { SS14Window.StyleClassWindowTitle }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, NanoGold), new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), }), // Window background. new StyleRule( new SelectorElement(null, new[] { SS14Window.StyleClassWindowPanel }, null, null), new[] { new StyleProperty(Panel.StylePropertyPanel, windowBackground), }), // Window header. new StyleRule( new SelectorElement(typeof(Panel), new[] { SS14Window.StyleClassWindowHeader }, null, null), new[] { new StyleProperty(Panel.StylePropertyPanel, windowHeader), }), // Window close button base texture. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, null), new[] { new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton), new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")), }), // Window close button hover. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new [] { TextureButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")), }), // Window close button pressed. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new [] { TextureButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#753131")), }), // Regular buttons! new StyleRule( new SelectorElement(typeof(Button), null, null, new [] { Button.StylePseudoClassNormal }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonNormal), }), new StyleRule( new SelectorElement(typeof(Button), null, null, new [] { Button.StylePseudoClassHover }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonHover), }), new StyleRule( new SelectorElement(typeof(Button), null, null, new [] { Button.StylePseudoClassPressed }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonPressed), }), new StyleRule( new SelectorElement(typeof(Button), null, null, new [] { Button.StylePseudoClassDisabled }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonDisabled), new StyleProperty("font-color", Color.FromHex("#E5E5E581")), }), // Main menu: Make those buttons bigger. new StyleRule( new SelectorChild( new SelectorElement(null, null, "mainMenuVBox", null), new SelectorElement(typeof(Button), null, null, null)), new[] { new StyleProperty("font", notoSansBold16), }), // Main menu: also make those buttons slightly more separated. new StyleRule(new SelectorElement(typeof(BoxContainer), null, "mainMenuVBox", null), new[] { new StyleProperty(BoxContainer.StylePropertySeparation, 2), }), // Fancy LineEdit new StyleRule(new SelectorElement(typeof(LineEdit), null, null, null), new[] { new StyleProperty(LineEdit.StylePropertyStyleBox, lineEdit), }), new StyleRule( new SelectorElement(typeof(LineEdit), new[] { LineEdit.StyleClassLineEditNotEditable }, null, null), new[] { new StyleProperty("font-color", new Color(192, 192, 192)), }), new StyleRule(new SelectorElement(typeof(LineEdit), null, null, new [] { LineEdit.StylePseudoClassPlaceholder }), new[] { new StyleProperty("font-color", Color.Gray), }), // TabContainer new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null), new[] { new StyleProperty(TabContainer.StylePropertyPanelStyleBox, tabContainerPanel), new StyleProperty(TabContainer.StylePropertyTabStyleBox, tabContainerBoxActive), new StyleProperty(TabContainer.StylePropertyTabStyleBoxInactive, tabContainerBoxInactive), }), // Scroll bars new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberNormal), }), new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, new [] { ScrollBar.StylePseudoClassHover }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberHover), }), new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, new [] { ScrollBar.StylePseudoClassGrabbed }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberGrabbed), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberNormal), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, new [] { ScrollBar.StylePseudoClassHover }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberHover), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, new [] { ScrollBar.StylePseudoClassGrabbed }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberGrabbed), }), // ProgressBar new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), new[] { new StyleProperty(ProgressBar.StylePropertyBackground, progressBarBackground), new StyleProperty(ProgressBar.StylePropertyForeground, progressBarForeground) }), // CheckBox new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new[] { new StyleProperty(CheckBox.StylePropertyIcon, checkBoxTextureUnchecked), }), new StyleRule(new SelectorElement(typeof(CheckBox), null, null, new [] { Button.StylePseudoClassPressed }), new[] { new StyleProperty(CheckBox.StylePropertyIcon, checkBoxTextureChecked), }), new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new[] { new StyleProperty(CheckBox.StylePropertyHSeparation, 3), }), // Tooltip new StyleRule(new SelectorElement(typeof(Tooltip), null, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), new StyleRule(new SelectorElement(typeof(PanelContainer), new [] { "tooltipBox" }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), // Entity tooltip new StyleRule( new SelectorElement(typeof(PanelContainer), new[] { ExamineSystem.StyleClassEntityTooltip }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), // ItemList new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new[] { new StyleProperty(ItemList.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) }), new StyleProperty(ItemList.StylePropertyItemBackground, itemListItemBackground), new StyleProperty(ItemList.StylePropertyDisabledItemBackground, itemListItemBackgroundDisabled), new StyleProperty(ItemList.StylePropertySelectedItemBackground, itemListBackgroundSelected) }), // Tree new StyleRule(new SelectorElement(typeof(Tree), null, null, null), new[] { new StyleProperty(Tree.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) }), new StyleProperty(Tree.StylePropertyItemBoxSelected, new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68), ContentMarginLeftOverride = 4 }) }), // Placeholder new StyleRule(new SelectorElement(typeof(Placeholder), null, null, null), new [] { new StyleProperty(PanelContainer.StylePropertyPanel, placeholder), }), new StyleRule(new SelectorElement(typeof(Label), new [] { Placeholder.StyleClassPlaceholderText }, null, null), new [] { new StyleProperty(Label.StylePropertyFont, notoSans16), new StyleProperty(Label.StylePropertyFontColor, new Color(103, 103, 103, 128)), }), // Big Label new StyleRule(new SelectorElement(typeof(Label), new [] { StyleClassLabelHeading }, null, null), new [] { new StyleProperty(Label.StylePropertyFont, notoSansBold16), new StyleProperty(Label.StylePropertyFontColor, NanoGold), }), // Small Label new StyleRule(new SelectorElement(typeof(Label), new [] { StyleClassLabelSubText }, null, null), new [] { new StyleProperty(Label.StylePropertyFont, notoSans10), new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray), }), // Big Button new StyleRule(new SelectorElement(typeof(Button), new [] { StyleClassButtonBig }, null, null), new [] { new StyleProperty("font", notoSans16) }), //APC and SMES power state label colors new StyleRule(new SelectorElement(typeof(Label), new [] { StyleClassPowerStateNone }, null, null), new [] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.8f, 0.0f, 0.0f)) }), new StyleRule(new SelectorElement(typeof(Label), new [] { StyleClassPowerStateLow }, null, null), new [] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.9f, 0.36f, 0.0f)) }), new StyleRule(new SelectorElement(typeof(Label), new [] { StyleClassPowerStateGood }, null, null), new [] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.024f, 0.8f, 0.0f)) }), // Those top menu buttons. new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new [] { Button.StylePseudoClassNormal }), new [] { new StyleProperty(Button.StylePropertyStyleBox, buttonNormal), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new [] { Button.StylePseudoClassPressed }), new [] { new StyleProperty(Button.StylePropertyStyleBox, buttonPressed), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new [] { Button.StylePseudoClassHover }), new [] { new StyleProperty(Button.StylePropertyStyleBox, buttonHover), }), new StyleRule( new SelectorElement(typeof(Label), new [] { GameHud.TopButton.StyleClassLabelTopButton }, null, null), new [] { new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), }), }); }
public LobbyGui(IEntityManager entityManager, IResourceCache resourceCache, IClientPreferencesManager preferencesManager) { var margin = new MarginContainer { MarginBottomOverride = 20, MarginLeftOverride = 20, MarginRightOverride = 20, MarginTopOverride = 20, }; AddChild(margin); var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png"); var back = new StyleBoxTexture { Texture = panelTex, Modulate = new Color(37, 37, 42), }; back.SetPatchMargin(StyleBox.Margin.All, 10); var panel = new PanelContainer { PanelOverride = back }; margin.AddChild(panel); var vBox = new VBoxContainer { SeparationOverride = 0 }; margin.AddChild(vBox); var topHBox = new HBoxContainer { CustomMinimumSize = (0, 40), Children = { new MarginContainer { MarginLeftOverride = 8, Children = { new Label { Text = Loc.GetString("Lobby"), StyleClasses ={ StyleNano.StyleClassLabelHeadingBigger }, /*MarginBottom = 40, * MarginLeft = 8,*/ VAlign = Label.VAlignMode.Center } } }, (ServerName = new Label { StyleClasses ={ StyleNano.StyleClassLabelHeadingBigger }, /*MarginBottom = 40, * GrowHorizontal = GrowDirection.Both,*/ VAlign = Label.VAlignMode.Center, SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter }), (LeaveButton = new Button { SizeFlagsHorizontal = SizeFlags.ShrinkEnd, Text = Loc.GetString("Leave"), StyleClasses ={ StyleNano.StyleClassButtonBig }, //GrowHorizontal = GrowDirection.Begin }) } }; vBox.AddChild(topHBox); vBox.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = StyleNano.NanoGold, ContentMarginTopOverride = 2 }, }); var hBox = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 0 }; vBox.AddChild(hBox); CharacterPreview = new LobbyCharacterPreviewPanel( entityManager, preferencesManager) { SizeFlagsHorizontal = SizeFlags.None }; hBox.AddChild(new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SeparationOverride = 0, Children = { CharacterPreview, new StripeBack { Children = { new MarginContainer { MarginRightOverride = 3, MarginLeftOverride = 3, MarginTopOverride = 3, MarginBottomOverride = 3, Children = { new HBoxContainer { SeparationOverride = 6, Children = { (ObserveButton = new Button { Text = Loc.GetString("Observe"), StyleClasses = { StyleNano.StyleClassButtonBig } }), (StartTime = new Label { SizeFlagsHorizontal = SizeFlags.FillExpand, Align = Label.AlignMode.Right, FontColorOverride = Color.DarkGray, StyleClasses = { StyleNano.StyleClassLabelBig } }), (ReadyButton = new Button { ToggleMode = true, Text = Loc.GetString("Ready Up"), StyleClasses = { StyleNano.StyleClassButtonBig } }), } } } } } }, new MarginContainer { MarginRightOverride = 3, MarginLeftOverride = 3, MarginTopOverride = 3, MarginBottomOverride = 3, SizeFlagsVertical = SizeFlags.FillExpand, Children = { (Chat = new ChatBox { Input = { PlaceHolder = Loc.GetString("Say something!") } }) } }, } }); hBox.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = StyleNano.NanoGold }, CustomMinimumSize = (2, 0) });
public NanoStyle() { var resCache = IoCManager.Resolve <IResourceCache>(); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSansBold16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 16); var animalSilence40 = resCache.GetFont("/Fonts/Animal Silence.otf", 40); var textureCloseButton = resCache.GetTexture("/Nano/cross.svg.png"); var windowHeaderTex = resCache.GetTexture("/Nano/window_header.png"); var windowHeader = new StyleBoxTexture { Texture = windowHeaderTex, PatchMarginBottom = 3, ExpandMarginBottom = 3, }; var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png"); var windowBackground = new StyleBoxTexture { Texture = windowBackgroundTex, }; windowBackground.SetPatchMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); windowBackground.SetExpandMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); var buttonNormalTex = resCache.GetTexture("/Nano/button_normal.png"); var buttonNormal = new StyleBoxTexture { Texture = buttonNormalTex, }; buttonNormal.SetPatchMargin(StyleBox.Margin.All, 2); buttonNormal.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4); var buttonHoverTex = resCache.GetTexture("/Nano/button_hover.png"); var buttonHover = new StyleBoxTexture { Texture = buttonHoverTex, }; buttonHover.SetPatchMargin(StyleBox.Margin.All, 2); buttonHover.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4); var buttonPressedTex = resCache.GetTexture("/Nano/button_pressed.png"); var buttonPressed = new StyleBoxTexture { Texture = buttonPressedTex, }; buttonPressed.SetPatchMargin(StyleBox.Margin.All, 2); buttonPressed.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4); var buttonDisabledTex = resCache.GetTexture("/Nano/button_disabled.png"); var buttonDisabled = new StyleBoxTexture { Texture = buttonDisabledTex, }; buttonDisabled.SetPatchMargin(StyleBox.Margin.All, 2); buttonDisabled.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4); var lineEditTex = resCache.GetTexture("/Nano/lineedit.png"); var lineEdit = new StyleBoxTexture { Texture = lineEditTex, }; lineEdit.SetPatchMargin(StyleBox.Margin.All, 3); lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerPanelTex = resCache.GetTexture("/Nano/tabcontainer_panel.png"); var tabContainerPanel = new StyleBoxTexture { Texture = tabContainerPanelTex, }; tabContainerPanel.SetPatchMargin(StyleBox.Margin.All, 2); var tabContainerBoxActive = new StyleBoxFlat { BackgroundColor = new Color(64, 64, 64) }; tabContainerBoxActive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 3); var tabContainerBoxInactive = new StyleBoxFlat { BackgroundColor = new Color(32, 32, 32) }; tabContainerBoxInactive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 3); var vScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray, ContentMarginLeftOverride = 10 }; var vScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140), ContentMarginLeftOverride = 10 }; var vScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160), ContentMarginLeftOverride = 10 }; var hScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray, ContentMarginTopOverride = 10 }; var hScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140), ContentMarginTopOverride = 10 }; var hScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160), ContentMarginTopOverride = 10 }; var progressBarBackground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.25f, 0.25f) }; progressBarBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); var progressBarForeground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.50f, 0.25f) }; progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); // CheckBox var checkBoxTextureChecked = resCache.GetTexture("/Nano/checkbox_checked.svg.96dpi.png"); var checkBoxTextureUnchecked = resCache.GetTexture("/Nano/checkbox_unchecked.svg.96dpi.png"); Stylesheet = new Stylesheet(new[] { // Default font. new StyleRule( new SelectorElement(null, null, null, null), new[] { new StyleProperty("font", notoSans12), }), // Window title. new StyleRule( new SelectorElement(typeof(Label), new[] { SS14Window.StyleClassWindowTitle }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, NanoGold), new StyleProperty(Label.StylePropertyFont, notoSansBold16), }), // Window background. new StyleRule( new SelectorElement(null, new[] { SS14Window.StyleClassWindowPanel }, null, null), new[] { new StyleProperty(Panel.StylePropertyPanel, windowBackground), }), // Window header. new StyleRule( new SelectorElement(typeof(Panel), new[] { SS14Window.StyleClassWindowHeader }, null, null), new[] { new StyleProperty(Panel.StylePropertyPanel, windowHeader), }), // Window close button base texture. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, null), new[] { new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton), new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")), }), // Window close button hover. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, TextureButton.StylePseudoClassHover), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")), }), // Window close button pressed. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, TextureButton.StylePseudoClassPressed), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#753131")), }), // Regular buttons! new StyleRule( new SelectorElement(typeof(Button), null, null, Button.StylePseudoClassNormal), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonNormal), }), new StyleRule( new SelectorElement(typeof(Button), null, null, Button.StylePseudoClassHover), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonHover), }), new StyleRule( new SelectorElement(typeof(Button), null, null, Button.StylePseudoClassPressed), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonPressed), }), new StyleRule( new SelectorElement(typeof(Button), null, null, Button.StylePseudoClassDisabled), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonDisabled), new StyleProperty("font-color", Color.FromHex("#E5E5E581")), }), // Main menu: Make those buttons bigger. new StyleRule( new SelectorChild( new SelectorElement(null, null, "mainMenuVBox", null), new SelectorElement(typeof(Button), null, null, null)), new[] { new StyleProperty("font", animalSilence40), }), // Main menu: also make those buttons slightly more separated. new StyleRule(new SelectorElement(typeof(BoxContainer), null, "mainMenuVBox", null), new[] { new StyleProperty(BoxContainer.StylePropertySeparation, 2), }), // Fancy LineEdit new StyleRule(new SelectorElement(typeof(LineEdit), null, null, null), new[] { new StyleProperty(LineEdit.StylePropertyStyleBox, lineEdit), }), new StyleRule( new SelectorElement(typeof(LineEdit), new[] { LineEdit.StyleClassLineEditNotEditable }, null, null), new[] { new StyleProperty("font-color", new Color(192, 192, 192)), }), new StyleRule(new SelectorElement(typeof(LineEdit), null, null, LineEdit.StylePseudoClassPlaceholder), new[] { new StyleProperty("font-color", Color.Gray), }), // TabContainer new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null), new[] { new StyleProperty(TabContainer.StylePropertyPanelStyleBox, tabContainerPanel), new StyleProperty(TabContainer.StylePropertyTabStyleBox, tabContainerBoxActive), new StyleProperty(TabContainer.StylePropertyTabStyleBoxInactive, tabContainerBoxInactive), }), // Scroll bars new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberNormal), }), new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, ScrollBar.StylePseudoClassHover), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberHover), }), new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, ScrollBar.StylePseudoClassGrabbed), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberGrabbed), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberNormal), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, ScrollBar.StylePseudoClassHover), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberHover), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, ScrollBar.StylePseudoClassGrabbed), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberGrabbed), }), // ProgressBar new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), new[] { new StyleProperty(ProgressBar.StylePropertyBackground, progressBarBackground) }), new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), new[] { new StyleProperty(ProgressBar.StylePropertyForeground, progressBarForeground) }), // CheckBox new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new [] { new StyleProperty(CheckBox.StylePropertyIcon, checkBoxTextureUnchecked), }), new StyleRule(new SelectorElement(typeof(CheckBox), null, null, Button.StylePseudoClassPressed), new [] { new StyleProperty(CheckBox.StylePropertyIcon, checkBoxTextureChecked), }), new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new [] { new StyleProperty(CheckBox.StylePropertyHSeparation, 3), }), }); }
protected StyleBase(IResourceCache resCache) { var notoSans12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12); var notoSans12Italic = resCache.GetFont("/Fonts/NotoSans/NotoSans-Italic.ttf", 12); var textureCloseButton = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png"); // Button styles. var buttonTex = resCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); BaseButton = new StyleBoxTexture { Texture = buttonTex, }; BaseButton.SetPatchMargin(StyleBox.Margin.All, 10); BaseButton.SetPadding(StyleBox.Margin.All, 1); BaseButton.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); BaseButton.SetContentMarginOverride(StyleBox.Margin.Horizontal, 14); BaseButtonOpenRight = new StyleBoxTexture(BaseButton) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((0, 0), (14, 24))), }; BaseButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0); BaseButtonOpenRight.SetContentMarginOverride(StyleBox.Margin.Right, 8); BaseButtonOpenRight.SetPadding(StyleBox.Margin.Right, 2); BaseButtonOpenLeft = new StyleBoxTexture(BaseButton) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (14, 24))), }; BaseButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0); BaseButtonOpenLeft.SetContentMarginOverride(StyleBox.Margin.Left, 8); BaseButtonOpenLeft.SetPadding(StyleBox.Margin.Left, 1); BaseButtonOpenBoth = new StyleBoxTexture(BaseButton) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))), }; BaseButtonOpenBoth.SetPatchMargin(StyleBox.Margin.Horizontal, 0); BaseButtonOpenBoth.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); BaseButtonOpenBoth.SetPadding(StyleBox.Margin.Right, 2); BaseButtonOpenBoth.SetPadding(StyleBox.Margin.Left, 1); BaseButtonSquare = new StyleBoxTexture(BaseButton) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))), }; BaseButtonSquare.SetPatchMargin(StyleBox.Margin.Horizontal, 0); BaseButtonSquare.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); BaseButtonSquare.SetPadding(StyleBox.Margin.Right, 2); BaseButtonSquare.SetPadding(StyleBox.Margin.Left, 1); BaseAngleRect = new StyleBoxTexture { Texture = buttonTex, }; BaseAngleRect.SetPatchMargin(StyleBox.Margin.All, 10); var vScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var vScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var vScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var hScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var hScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var hScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginTopOverride = 10 }; BaseRules = new[] { // Default font. new StyleRule( new SelectorElement(null, null, null, null), new[] { new StyleProperty("font", notoSans12), }), // Default font. new StyleRule( new SelectorElement(null, new[] { StyleClassItalic }, null, null), new[] { new StyleProperty("font", notoSans12Italic), }), // Window close button base texture. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, null), new[] { new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton), new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")), }), // Window close button hover. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new[] { TextureButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")), }), // Window close button pressed. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new[] { TextureButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#753131")), }), // Scroll bars new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberNormal), }), new StyleRule( new SelectorElement(typeof(VScrollBar), null, null, new[] { ScrollBar.StylePseudoClassHover }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberHover), }), new StyleRule( new SelectorElement(typeof(VScrollBar), null, null, new[] { ScrollBar.StylePseudoClassGrabbed }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberGrabbed), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberNormal), }), new StyleRule( new SelectorElement(typeof(HScrollBar), null, null, new[] { ScrollBar.StylePseudoClassHover }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberHover), }), new StyleRule( new SelectorElement(typeof(HScrollBar), null, null, new[] { ScrollBar.StylePseudoClassGrabbed }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberGrabbed), }), }; }
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, IEntityManager entityManager) { RobustXamlLoader.Load(this); _random = IoCManager.Resolve <IRobustRandom>(); _prototypeManager = prototypeManager; _preferencesManager = preferencesManager; #region Left #region Randomize #endregion Randomize #region Name _nameEdit.OnTextChanged += args => { SetName(args.Text); }; _nameRandomButton.OnPressed += args => RandomizeName(); _randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); }; _warningLabel.SetMarkup($"[color=red]{Loc.GetString("humanoid-profile-editor-naming-rules-warning")}[/color]"); #endregion Name #region Appearance _tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab")); #region Sex var sexButtonGroup = new ButtonGroup(); _sexMaleButton.Group = sexButtonGroup; _sexMaleButton.OnPressed += args => { SetSex(Sex.Male); if (Profile?.Gender == Gender.Female) { SetGender(Gender.Male); UpdateGenderControls(); } }; _sexFemaleButton.Group = sexButtonGroup; _sexFemaleButton.OnPressed += _ => { SetSex(Sex.Female); if (Profile?.Gender == Gender.Male) { SetGender(Gender.Female); UpdateGenderControls(); } }; #endregion Sex #region Age _ageEdit.OnTextChanged += args => { if (!int.TryParse(args.Text, out var newAge)) { return; } SetAge(newAge); }; #endregion Age #region Gender _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-male-text"), (int)Gender.Male); _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-female-text"), (int)Gender.Female); _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-epicene-text"), (int)Gender.Epicene); _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-neuter-text"), (int)Gender.Neuter); _genderButton.OnItemSelected += args => { _genderButton.SelectId(args.Id); SetGender((Gender)args.Id); }; #endregion Gender #region Skin // 0 - 100, 0 being gold/yellowish and 100 being dark // HSV based // // 0 - 20 changes the hue // 20 - 100 changes the value // 0 is 45 - 20 - 100 // 20 is 25 - 20 - 100 // 100 is 25 - 100 - 20 _skinColor.OnValueChanged += range => { if (Profile is null) { return; } int rangeOffset = (int)range.Value - 20; float hue = 25; float sat = 20; float val = 100; if (rangeOffset < 0) { hue += Math.Abs(rangeOffset); } else if (rangeOffset > 0) { sat += rangeOffset; val -= rangeOffset; } var color = Color.FromHsv(new Vector4(hue / 360, sat / 100, val / 100, 1.0f)); Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithSkinColor(color)); IsDirty = true; }; #endregion #region Hair _hairPicker.Populate(); _hairPicker.OnHairStylePicked += newStyle => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairStyleName(newStyle)); IsDirty = true; }; _hairPicker.OnHairColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairColor(newColor)); IsDirty = true; }; _facialHairPicker.Populate(); _facialHairPicker.OnHairStylePicked += newStyle => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairStyleName(newStyle)); IsDirty = true; }; _facialHairPicker.OnHairColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairColor(newColor)); IsDirty = true; }; #endregion Hair #region Clothing _clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpsuit"), (int)ClothingPreference.Jumpsuit); _clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpskirt"), (int)ClothingPreference.Jumpskirt); _clothingButton.OnItemSelected += args => { _clothingButton.SelectId(args.Id); SetClothing((ClothingPreference)args.Id); }; #endregion Clothing #region Backpack _backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-backpack"), (int)BackpackPreference.Backpack); _backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-satchel"), (int)BackpackPreference.Satchel); _backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-duffelbag"), (int)BackpackPreference.Duffelbag); _backpackButton.OnItemSelected += args => { _backpackButton.SelectId(args.Id); SetBackpack((BackpackPreference)args.Id); }; #endregion Backpack #region Eyes _eyesPicker.OnEyeColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithEyeColor(newColor)); IsDirty = true; }; #endregion Eyes #endregion Appearance #region Jobs _tabContainer.SetTabTitle(1, Loc.GetString("humanoid-profile-editor-jobs-tab")); _preferenceUnavailableButton.AddItem( Loc.GetString("humanoid-profile-editor-preference-unavailable-stay-in-lobby-button"), (int)PreferenceUnavailableMode.StayInLobby); _preferenceUnavailableButton.AddItem( Loc.GetString("humanoid-profile-editor-preference-unavailable-spawn-as-overflow-button", ("overflowJob", Loc.GetString(SharedGameTicker.FallbackOverflowJobName))), (int)PreferenceUnavailableMode.SpawnAsOverflow); _preferenceUnavailableButton.OnItemSelected += args => { _preferenceUnavailableButton.SelectId(args.Id); Profile = Profile?.WithPreferenceUnavailable((PreferenceUnavailableMode)args.Id); IsDirty = true; }; _jobPriorities = new List <JobPrioritySelector>(); _jobCategories = new Dictionary <string, BoxContainer>(); var firstCategory = true; foreach (var job in prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name)) { if (!job.SetPreference) { continue; } foreach (var department in job.Departments) { if (!_jobCategories.TryGetValue(department, out var category)) { category = new BoxContainer { Orientation = LayoutOrientation.Vertical, Name = department, ToolTip = Loc.GetString("humanoid-profile-editor-jobs-amount-in-department-tooltip", ("departmentName", department)) }; if (firstCategory) { firstCategory = false; } else { category.AddChild(new Control { MinSize = new Vector2(0, 23), }); } category.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#464966") }, Children = { new Label { Text = Loc.GetString("humanoid-profile-editor-department-jobs-label", ("departmentName", department)) } } });
public StyleSpace(IResourceCache resCache) : base(resCache) { var notoSans10 = resCache.GetFont ( new [] { "/Fonts/NotoSans/NotoSans-Regular.ttf", "/Fonts/NotoSans/NotoSansSymbols-Regular.ttf", "/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf" }, 10 ); var notoSansBold16 = resCache.GetFont ( new [] { "/Fonts/NotoSans/NotoSans-Bold.ttf", "/Fonts/NotoSans/NotoSansSymbols-Regular.ttf", "/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf" }, 16 ); var progressBarBackground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.25f, 0.25f) }; progressBarBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); var progressBarForeground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.50f, 0.25f) }; progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); var textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png"); Stylesheet = new Stylesheet(BaseRules.Concat(new StyleRule[] { Element <Label>().Class(StyleClassLabelHeading) .Prop(Label.StylePropertyFont, notoSansBold16) .Prop(Label.StylePropertyFontColor, SpaceRed), Element <Label>().Class(StyleClassLabelSubText) .Prop(Label.StylePropertyFont, notoSans10) .Prop(Label.StylePropertyFontColor, Color.DarkGray), Element <PanelContainer>().Class(ClassHighDivider) .Prop(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = SpaceRed, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2 }), Element <PanelContainer>().Class(ClassLowDivider) .Prop(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = Color.FromHex("#444"), ContentMarginLeftOverride = 2, ContentMarginBottomOverride = 2 }), // Shapes for the buttons. Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Prop(ContainerButton.StylePropertyStyleBox, BaseButton), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonOpenRight) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenRight), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonOpenLeft) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenLeft), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonOpenBoth) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenBoth), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonSquare) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonSquare), // Colors for the buttons. Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassNormal) .Prop(Control.StylePropertyModulateSelf, ButtonColorDefault), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassHover) .Prop(Control.StylePropertyModulateSelf, ButtonColorHovered), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassPressed) .Prop(Control.StylePropertyModulateSelf, ButtonColorPressed), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassDisabled) .Prop(Control.StylePropertyModulateSelf, ButtonColorDisabled), // Colors for the caution buttons. Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassNormal) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDefault), Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassHover) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionHovered), Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassPressed) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionPressed), Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassDisabled) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDisabled), Element <Label>().Class(ContainerButton.StyleClassButton) .Prop(Label.StylePropertyAlignMode, Label.AlignMode.Center), Element <PanelContainer>().Class(ClassAngleRect) .Prop(PanelContainer.StylePropertyPanel, BaseAngleRect) .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#202030")), Child() .Parent(Element <Button>().Class(ContainerButton.StylePseudoClassDisabled)) .Child(Element <Label>()) .Prop("font-color", Color.FromHex("#E5E5E581")), Element <ProgressBar>() .Prop(ProgressBar.StylePropertyBackground, progressBarBackground) .Prop(ProgressBar.StylePropertyForeground, progressBarForeground), // OptionButton Element <OptionButton>() .Prop(ContainerButton.StylePropertyStyleBox, BaseButton), Element <OptionButton>().Pseudo(ContainerButton.StylePseudoClassNormal) .Prop(Control.StylePropertyModulateSelf, ButtonColorDefault), Element <OptionButton>().Pseudo(ContainerButton.StylePseudoClassHover) .Prop(Control.StylePropertyModulateSelf, ButtonColorHovered), Element <OptionButton>().Pseudo(ContainerButton.StylePseudoClassPressed) .Prop(Control.StylePropertyModulateSelf, ButtonColorPressed), Element <OptionButton>().Pseudo(ContainerButton.StylePseudoClassDisabled) .Prop(Control.StylePropertyModulateSelf, ButtonColorDisabled), Element <TextureRect>().Class(OptionButton.StyleClassOptionTriangle) .Prop(TextureRect.StylePropertyTexture, textureInvertedTriangle), Element <Label>().Class(OptionButton.StyleClassOptionButton) .Prop(Label.StylePropertyAlignMode, Label.AlignMode.Center), }).ToList()); }
public ParticleAcceleratorControlMenu(ParticleAcceleratorBoundUserInterface owner) { SetSize = (400, 320); _greyScaleShader = IoCManager.Resolve <IPrototypeManager>().Index <ShaderPrototype>("Greyscale").Instance(); Owner = owner; _drawNoiseGenerator = new NoiseGenerator(NoiseGenerator.NoiseType.Fbm); _drawNoiseGenerator.SetFrequency(0.5f); var resourceCache = IoCManager.Resolve <IResourceCache>(); var font = resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 13); var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); MouseFilter = MouseFilterMode.Stop; _alarmControlAnimation = new Animation { Length = TimeSpan.FromSeconds(1), AnimationTracks = { new AnimationTrackControlProperty { Property = nameof(Control.Visible), KeyFrames = { new AnimationTrackProperty.KeyFrame(true, 0), new AnimationTrackProperty.KeyFrame(false, 0.75f), } } } }; var back = new StyleBoxTexture { Texture = panelTex, Modulate = Color.FromHex("#25252A"), }; back.SetPatchMargin(StyleBox.Margin.All, 10); var back2 = new StyleBoxTexture(back) { Modulate = Color.FromHex("#202023") }; AddChild(new PanelContainer { PanelOverride = back, MouseFilter = MouseFilterMode.Pass }); _stateSpinBox = new SpinBox { Value = 0, IsValid = StrengthSpinBoxValid, }; _stateSpinBox.InitDefaultButtons(); _stateSpinBox.ValueChanged += PowerStateChanged; _stateSpinBox.LineEditDisabled = true; _offButton = new Button { ToggleMode = false, Text = Loc.GetString("particle-accelerator-control-menu-off-button"), StyleClasses = { StyleBase.ButtonOpenRight }, }; _offButton.OnPressed += args => owner.SendEnableMessage(false); _onButton = new Button { ToggleMode = false, Text = Loc.GetString("particle-accelerator-control-menu-on-button"), StyleClasses = { StyleBase.ButtonOpenLeft }, }; _onButton.OnPressed += args => owner.SendEnableMessage(true); var closeButton = new TextureButton { StyleClasses = { "windowCloseButton" }, HorizontalAlignment = HAlignment.Right, Margin = new Thickness(0, 0, 8, 0) }; closeButton.OnPressed += args => Close(); var serviceManual = new Label { HorizontalAlignment = HAlignment.Center, StyleClasses = { StyleBase.StyleClassLabelSubText }, Text = Loc.GetString("particle-accelerator-control-menu-service-manual-reference") }; _drawLabel = new Label(); var imgSize = new Vector2(32, 32); AddChild(new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = { new Control { Margin = new Thickness(2, 2, 0, 0), Children = { new Label { Text = Loc.GetString("particle-accelerator-control-menu-device-version-label"), FontOverride = font, FontColorOverride = StyleNano.NanoGold, }, closeButton } }, new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = StyleNano.NanoGold }, MinSize = (0, 2), },
public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache) { PanelOverride = new StyleBoxFlat { BackgroundColor = new Color(37, 37, 45) }; PanelOverride.SetContentMarginOverride(StyleBox.Margin.All, 4); var vBox = new VBoxContainer(); AddChild(vBox); { // Title bar. var titleContainer = new HBoxContainer(); vBox.AddChild(titleContainer); var lobbyTitle = new Label { Text = localization.GetString("Lobby"), SizeFlagsHorizontal = SizeFlags.None }; lobbyTitle.AddStyleClass(NanoStyle.StyleClassLabelHeading); titleContainer.AddChild(lobbyTitle); titleContainer.AddChild(ServerName = new Label { SizeFlagsHorizontal = SizeFlags.ShrinkCenter | SizeFlags.Expand }); ServerName.AddStyleClass(NanoStyle.StyleClassLabelHeading); titleContainer.AddChild(LeaveButton = new Button { SizeFlagsHorizontal = SizeFlags.ShrinkEnd, Text = localization.GetString("Leave") }); LeaveButton.AddStyleClass(NanoStyle.StyleClassButtonBig); } var hBox = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand }; vBox.AddChild(hBox); { var leftVBox = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBox.AddChild(leftVBox); leftVBox.AddChild(new Placeholder(resourceCache) { SizeFlagsVertical = SizeFlags.FillExpand, PlaceholderText = localization.GetString("Character UI\nPlaceholder") }); var readyButtons = new HBoxContainer(); leftVBox.AddChild(readyButtons); readyButtons.AddChild(ObserveButton = new Button { Text = localization.GetString("Observe") }); ObserveButton.AddStyleClass(NanoStyle.StyleClassButtonBig); readyButtons.AddChild(StartTime = new Label { SizeFlagsHorizontal = SizeFlags.FillExpand, Align = Label.AlignMode.Right }); readyButtons.AddChild(ReadyButton = new Button { ToggleMode = true, Text = localization.GetString("Ready Up") }); ReadyButton.AddStyleClass(NanoStyle.StyleClassButtonBig); leftVBox.AddChild(Chat = new ChatBox { SizeFlagsVertical = SizeFlags.FillExpand }); Chat.Input.PlaceHolder = localization.GetString("Talk!"); } { var rightVBox = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBox.AddChild(rightVBox); rightVBox.AddChild(new Label { Text = localization.GetString("Online Players:") }); rightVBox.AddChild(OnlinePlayerItemList = new ItemList { SizeFlagsVertical = SizeFlags.FillExpand, //SelectMode = ItemList.ItemListSelectMode.None }); rightVBox.AddChild(new Placeholder(resourceCache) { SizeFlagsVertical = SizeFlags.FillExpand, PlaceholderText = localization.GetString("Server Info\nPlaceholder") }); } }
public DebugConsole(IClientConsole console, IResourceManager resMan) { _console = console; _resourceManager = resMan; Visible = false; var styleBox = new StyleBoxFlat { BackgroundColor = Color.FromHex("#25252add"), }; styleBox.SetContentMarginOverride(StyleBox.Margin.All, 3); AddChild(new LayoutContainer { Children = { (MainControl = new VBoxContainer { SeparationOverride = 0, Children = { (Output = new OutputPanel { SizeFlagsVertical = SizeFlags.FillExpand, StyleBoxOverride = styleBox }), (CommandBar = new HistoryLineEdit { PlaceHolder = "Command Here" }) } }) } }); LayoutContainer.SetAnchorPreset(MainControl, LayoutContainer.LayoutPreset.TopWide); LayoutContainer.SetAnchorBottom(MainControl, 0.35f); CommandBar.OnTextChanged += OnCommandChanged; CommandBar.OnKeyBindDown += CommandBarOnOnKeyBindDown; CommandBar.OnTextEntered += CommandEntered; CommandBar.OnHistoryChanged += OnHistoryChanged; _console.AddString += (_, args) => AddLine(args.Text, args.Color); _console.AddFormatted += (_, args) => AddFormattedLine(args.Message); _console.ClearText += (_, args) => Clear(); _loadHistoryFromDisk(); CommandBar.OnKeyBindDown += args => { if (args.Function == EngineKeyFunctions.ShowDebugConsole) { Toggle(); args.Handle(); } }; searchResults = new List <string>(); }
public GasTankWindow(GasTankBoundUserInterface owner) { TextureButton btnClose; _resourceCache = IoCManager.Resolve <IResourceCache>(); _owner = owner; var rootContainer = new LayoutContainer { Name = "GasTankRoot" }; AddChild(rootContainer); MouseFilter = MouseFilterMode.Stop; var panelTex = _resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); var back = new StyleBoxTexture { Texture = panelTex, Modulate = Color.FromHex("#25252A"), }; back.SetPatchMargin(StyleBox.Margin.All, 10); var topPanel = new PanelContainer { PanelOverride = back, MouseFilter = MouseFilterMode.Pass }; var bottomWrap = new LayoutContainer { Name = "BottomWrap" }; rootContainer.AddChild(topPanel); rootContainer.AddChild(bottomWrap); LayoutContainer.SetAnchorPreset(topPanel, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetMarginBottom(topPanel, -85); LayoutContainer.SetAnchorPreset(bottomWrap, LayoutContainer.LayoutPreset.VerticalCenterWide); LayoutContainer.SetGrowHorizontal(bottomWrap, LayoutContainer.GrowDirection.Both); var topContainerWrap = new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = { (_topContainer = new BoxContainer { Orientation = LayoutOrientation.Vertical }), new Control { MinSize = (0, 110) } } }; rootContainer.AddChild(topContainerWrap); LayoutContainer.SetAnchorPreset(topContainerWrap, LayoutContainer.LayoutPreset.Wide); var font = _resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 13); var topRow = new BoxContainer { Orientation = LayoutOrientation.Horizontal, Margin = new Thickness(4, 2, 12, 2), Children = { (_lblName = new Label { Text = Loc.GetString("gas-tank-window-label"), FontOverride = font, FontColorOverride = StyleNano.NanoGold, VerticalAlignment = VAlignment.Center, HorizontalExpand = true, HorizontalAlignment = HAlignment.Left, Margin = new Thickness(0,0, 20, 0), }), (btnClose = new TextureButton { StyleClasses = { DefaultWindow.StyleClassWindowCloseButton }, VerticalAlignment = VAlignment.Center }) } }; var middle = new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#202025") }, Children = { (_contentContainer = new BoxContainer { Orientation = LayoutOrientation.Vertical, Margin = new Thickness(8,4), }) } }; _topContainer.AddChild(topRow); _topContainer.AddChild(new PanelContainer { MinSize = (0, 2), PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#525252ff") } });
public StyleNano(IResourceCache resCache) : base(resCache) { var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSansBold12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 12); var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14); var notoSans16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 16); var notoSansBold16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 16); var notoSansBold20 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 20); var textureCloseButton = resCache.GetTexture("/Nano/cross.svg.png"); var windowHeaderTex = resCache.GetTexture("/Nano/window_header.png"); var windowHeader = new StyleBoxTexture { Texture = windowHeaderTex, PatchMarginBottom = 3, ExpandMarginBottom = 3, ContentMarginBottomOverride = 0 }; var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png"); var windowBackground = new StyleBoxTexture { Texture = windowBackgroundTex, }; windowBackground.SetPatchMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); windowBackground.SetExpandMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); var textureInvertedTriangle = resCache.GetTexture("/Nano/inverted_triangle.svg.png"); // Button styles. var buttonNormal = new StyleBoxTexture(BaseButton) { Modulate = ButtonColorDefault }; var buttonHover = new StyleBoxTexture(buttonNormal) { Modulate = ButtonColorHovered }; var buttonPressed = new StyleBoxTexture(buttonNormal) { Modulate = ButtonColorPressed }; var buttonDisabled = new StyleBoxTexture(buttonNormal) { Modulate = ButtonColorDisabled }; var lineEditTex = resCache.GetTexture("/Nano/lineedit.png"); var lineEdit = new StyleBoxTexture { Texture = lineEditTex, }; lineEdit.SetPatchMargin(StyleBox.Margin.All, 3); lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerPanelTex = resCache.GetTexture("/Nano/tabcontainer_panel.png"); var tabContainerPanel = new StyleBoxTexture { Texture = tabContainerPanelTex, }; tabContainerPanel.SetPatchMargin(StyleBox.Margin.All, 2); var tabContainerBoxActive = new StyleBoxFlat { BackgroundColor = new Color(64, 64, 64) }; tabContainerBoxActive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerBoxInactive = new StyleBoxFlat { BackgroundColor = new Color(32, 32, 32) }; tabContainerBoxInactive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var vScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var vScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var vScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var hScrollBarGrabberNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var hScrollBarGrabberHover = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var hScrollBarGrabberGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginTopOverride = 10 }; var progressBarBackground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.25f, 0.25f) }; progressBarBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); var progressBarForeground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.50f, 0.25f) }; progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); // CheckBox var checkBoxTextureChecked = resCache.GetTexture("/Nano/checkbox_checked.svg.96dpi.png"); var checkBoxTextureUnchecked = resCache.GetTexture("/Nano/checkbox_unchecked.svg.96dpi.png"); // Tooltip box var tooltipTexture = resCache.GetTexture("/Nano/tooltip.png"); var tooltipBox = new StyleBoxTexture { Texture = tooltipTexture, }; tooltipBox.SetPatchMargin(StyleBox.Margin.All, 2); tooltipBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); // Placeholder var placeholderTexture = resCache.GetTexture("/Nano/placeholder.png"); var placeholder = new StyleBoxTexture { Texture = placeholderTexture }; placeholder.SetPatchMargin(StyleBox.Margin.All, 19); placeholder.SetExpandMargin(StyleBox.Margin.All, -5); placeholder.Mode = StyleBoxTexture.StretchMode.Tile; var itemListBackgroundSelected = new StyleBoxFlat { BackgroundColor = new Color(75, 75, 86) }; itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackgroundDisabled = new StyleBoxFlat { BackgroundColor = new Color(10, 10, 12) }; itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackground = new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68) }; itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackgroundTransparent = new StyleBoxFlat { BackgroundColor = Color.Transparent }; itemListItemBackgroundTransparent.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackgroundTransparent.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); // NanoHeading var nanoHeadingTex = resCache.GetTexture("/Nano/nanoheading.svg.96dpi.png"); var nanoHeadingBox = new StyleBoxTexture { Texture = nanoHeadingTex, PatchMarginRight = 10, PatchMarginTop = 10, ContentMarginTopOverride = 2, ContentMarginLeftOverride = 10, PaddingTop = 4 }; nanoHeadingBox.SetPatchMargin(StyleBox.Margin.Left | StyleBox.Margin.Bottom, 2); // Stripe background var stripeBackTex = resCache.GetTexture("/Nano/stripeback.svg.96dpi.png"); var stripeBack = new StyleBoxTexture { Texture = stripeBackTex, Mode = StyleBoxTexture.StretchMode.Tile }; // Slider var sliderOutlineTex = resCache.GetTexture("/Nano/slider_outline.svg.96dpi.png"); var sliderFillTex = resCache.GetTexture("/Nano/slider_fill.svg.96dpi.png"); var sliderGrabTex = resCache.GetTexture("/Nano/slider_grabber.svg.96dpi.png"); var sliderFillBox = new StyleBoxTexture { Texture = sliderFillTex, Modulate = Color.FromHex("#3E6C45") }; var sliderBackBox = new StyleBoxTexture { Texture = sliderFillTex, Modulate = Color.FromHex("#1E1E22") }; var sliderForeBox = new StyleBoxTexture { Texture = sliderOutlineTex, Modulate = Color.FromHex("#494949") }; var sliderGrabBox = new StyleBoxTexture { Texture = sliderGrabTex, }; sliderFillBox.SetPatchMargin(StyleBox.Margin.All, 12); sliderBackBox.SetPatchMargin(StyleBox.Margin.All, 12); sliderForeBox.SetPatchMargin(StyleBox.Margin.All, 12); sliderGrabBox.SetPatchMargin(StyleBox.Margin.All, 12); var sliderFillGreen = new StyleBoxTexture(sliderFillBox) { Modulate = Color.Green }; var sliderFillRed = new StyleBoxTexture(sliderFillBox) { Modulate = Color.Red }; var sliderFillBlue = new StyleBoxTexture(sliderFillBox) { Modulate = Color.Blue }; Stylesheet = new Stylesheet(BaseRules.Concat(new[] { // Window title. new StyleRule( new SelectorElement(typeof(Label), new[] { SS14Window.StyleClassWindowTitle }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, NanoGold), new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), }), // Window background. new StyleRule( new SelectorElement(null, new[] { SS14Window.StyleClassWindowPanel }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, windowBackground), }), // Window header. new StyleRule( new SelectorElement(typeof(PanelContainer), new[] { SS14Window.StyleClassWindowHeader }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, windowHeader), }), // Window close button base texture. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, null), new[] { new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton), new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")), }), // Window close button hover. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new[] { TextureButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")), }), // Window close button pressed. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new[] { TextureButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#753131")), }), // Regular buttons! new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] { ContainerButton.StylePseudoClassNormal }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonNormal), }), new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] { ContainerButton.StylePseudoClassHover }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonHover), }), new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] { ContainerButton.StylePseudoClassPressed }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonPressed), }), new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] { ContainerButton.StylePseudoClassDisabled }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonDisabled), }), new StyleRule(new SelectorElement(typeof(Label), new[] { Button.StyleClassButton }, null, null), new[] { new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center), }), new StyleRule(new SelectorChild( new SelectorElement(typeof(Button), null, null, new[] { ContainerButton.StylePseudoClassDisabled }), new SelectorElement(typeof(Label), null, null, null)), new[] { new StyleProperty("font-color", Color.FromHex("#E5E5E581")), }), // Main menu: Make those buttons bigger. new StyleRule(new SelectorChild( new SelectorElement(typeof(Button), null, "mainMenu", null), new SelectorElement(typeof(Label), null, null, null)), new[] { new StyleProperty("font", notoSansBold16), }), // Main menu: also make those buttons slightly more separated. new StyleRule(new SelectorElement(typeof(BoxContainer), null, "mainMenuVBox", null), new[] { new StyleProperty(BoxContainer.StylePropertySeparation, 2), }), // Fancy LineEdit new StyleRule(new SelectorElement(typeof(LineEdit), null, null, null), new[] { new StyleProperty(LineEdit.StylePropertyStyleBox, lineEdit), }), new StyleRule( new SelectorElement(typeof(LineEdit), new[] { LineEdit.StyleClassLineEditNotEditable }, null, null), new[] { new StyleProperty("font-color", new Color(192, 192, 192)), }), new StyleRule( new SelectorElement(typeof(LineEdit), null, null, new[] { LineEdit.StylePseudoClassPlaceholder }), new[] { new StyleProperty("font-color", Color.Gray), }), // TabContainer new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null), new[] { new StyleProperty(TabContainer.StylePropertyPanelStyleBox, tabContainerPanel), new StyleProperty(TabContainer.StylePropertyTabStyleBox, tabContainerBoxActive), new StyleProperty(TabContainer.StylePropertyTabStyleBoxInactive, tabContainerBoxInactive), }), // Scroll bars new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberNormal), }), new StyleRule( new SelectorElement(typeof(VScrollBar), null, null, new[] { ScrollBar.StylePseudoClassHover }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberHover), }), new StyleRule( new SelectorElement(typeof(VScrollBar), null, null, new[] { ScrollBar.StylePseudoClassGrabbed }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, vScrollBarGrabberGrabbed), }), new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, null), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberNormal), }), new StyleRule( new SelectorElement(typeof(HScrollBar), null, null, new[] { ScrollBar.StylePseudoClassHover }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberHover), }), new StyleRule( new SelectorElement(typeof(HScrollBar), null, null, new[] { ScrollBar.StylePseudoClassGrabbed }), new[] { new StyleProperty(ScrollBar.StylePropertyGrabber, hScrollBarGrabberGrabbed), }), // ProgressBar new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), new[] { new StyleProperty(ProgressBar.StylePropertyBackground, progressBarBackground), new StyleProperty(ProgressBar.StylePropertyForeground, progressBarForeground) }), // CheckBox new StyleRule(new SelectorElement(typeof(TextureRect), new [] { CheckBox.StyleClassCheckBox }, null, null), new[] { new StyleProperty(TextureRect.StylePropertyTexture, checkBoxTextureUnchecked), }), new StyleRule(new SelectorElement(typeof(TextureRect), new [] { CheckBox.StyleClassCheckBox, CheckBox.StyleClassCheckBoxChecked }, null, null), new[] { new StyleProperty(TextureRect.StylePropertyTexture, checkBoxTextureChecked), }), new StyleRule(new SelectorElement(typeof(HBoxContainer), new [] { CheckBox.StyleClassCheckBox }, null, null), new[] { new StyleProperty(BoxContainer.StylePropertySeparation, 10), }), // Tooltip new StyleRule(new SelectorElement(typeof(Tooltip), null, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), new StyleRule(new SelectorElement(typeof(PanelContainer), new[] { "tooltipBox" }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), // Entity tooltip new StyleRule( new SelectorElement(typeof(PanelContainer), new[] { ExamineSystem.StyleClassEntityTooltip }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), // ItemList new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new[] { new StyleProperty(ItemList.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) }), new StyleProperty(ItemList.StylePropertyItemBackground, itemListItemBackground), new StyleProperty(ItemList.StylePropertyDisabledItemBackground, itemListItemBackgroundDisabled), new StyleProperty(ItemList.StylePropertySelectedItemBackground, itemListBackgroundSelected) }), new StyleRule(new SelectorElement(typeof(ItemList), new[] { "transparentItemList" }, null, null), new[] { new StyleProperty(ItemList.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = Color.Transparent }), new StyleProperty(ItemList.StylePropertyItemBackground, itemListItemBackgroundTransparent), new StyleProperty(ItemList.StylePropertyDisabledItemBackground, itemListItemBackgroundDisabled), new StyleProperty(ItemList.StylePropertySelectedItemBackground, itemListBackgroundSelected) }), // Tree new StyleRule(new SelectorElement(typeof(Tree), null, null, null), new[] { new StyleProperty(Tree.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) }), new StyleProperty(Tree.StylePropertyItemBoxSelected, new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68), ContentMarginLeftOverride = 4 }) }), // Placeholder new StyleRule(new SelectorElement(typeof(Placeholder), null, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, placeholder), }), new StyleRule( new SelectorElement(typeof(Label), new[] { Placeholder.StyleClassPlaceholderText }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSans16), new StyleProperty(Label.StylePropertyFontColor, new Color(103, 103, 103, 128)), }), // Big Label new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelHeading }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansBold16), new StyleProperty(Label.StylePropertyFontColor, NanoGold), }), // Bigger Label new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelHeadingBigger }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansBold20), new StyleProperty(Label.StylePropertyFontColor, NanoGold), }), // Small Label new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelSubText }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSans10), new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray), }), // Label Key new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelKeyText }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansBold12), new StyleProperty(Label.StylePropertyFontColor, NanoGold) }), new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelSecondaryColor }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSans12), new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray), }), // Big Button new StyleRule(new SelectorChild( new SelectorElement(typeof(Button), new[] { StyleClassButtonBig }, null, null), new SelectorElement(typeof(Label), null, null, null)), new[] { new StyleProperty("font", notoSans16) }), //APC and SMES power state label colors new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPowerStateNone }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.8f, 0.0f, 0.0f)) }), new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPowerStateLow }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.9f, 0.36f, 0.0f)) }), new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPowerStateGood }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.024f, 0.8f, 0.0f)) }), // Those top menu buttons. new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassNormal }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonNormal), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassPressed }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonPressed), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassHover }), new[] { new StyleProperty(Button.StylePropertyStyleBox, buttonHover), }), new StyleRule( new SelectorElement(typeof(Label), new[] { GameHud.TopButton.StyleClassLabelTopButton }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), }), // Targeting doll new StyleRule( new SelectorElement(typeof(TextureButton), new[] { TargetingDoll.StyleClassTargetDollZone }, null, new[] { TextureButton.StylePseudoClassNormal }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorDefault), }), new StyleRule( new SelectorElement(typeof(TextureButton), new[] { TargetingDoll.StyleClassTargetDollZone }, null, new[] { TextureButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorHovered), }), new StyleRule( new SelectorElement(typeof(TextureButton), new[] { TargetingDoll.StyleClassTargetDollZone }, null, new[] { TextureButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorPressed), }), // NanoHeading new StyleRule( new SelectorChild( SelectorElement.Type(typeof(NanoHeading)), SelectorElement.Type(typeof(PanelContainer))), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, nanoHeadingBox), }), // StripeBack new StyleRule( SelectorElement.Type(typeof(StripeBack)), new[] { new StyleProperty(StripeBack.StylePropertyBackground, stripeBack), }), // StyleClassLabelBig new StyleRule( SelectorElement.Class(StyleClassLabelBig), new[] { new StyleProperty("font", notoSans16), }), // StyleClassItemStatus new StyleRule(SelectorElement.Class(StyleClassItemStatus), new[] { new StyleProperty("font", notoSans10), }), // Slider new StyleRule(SelectorElement.Type(typeof(Slider)), new [] { new StyleProperty(Slider.StylePropertyBackground, sliderBackBox), new StyleProperty(Slider.StylePropertyForeground, sliderForeBox), new StyleProperty(Slider.StylePropertyGrabber, sliderGrabBox), new StyleProperty(Slider.StylePropertyFill, sliderFillBox), }), new StyleRule(new SelectorElement(typeof(Slider), new [] { StyleClassSliderRed }, null, null), new [] { new StyleProperty(Slider.StylePropertyFill, sliderFillRed), }), new StyleRule(new SelectorElement(typeof(Slider), new [] { StyleClassSliderGreen }, null, null), new [] { new StyleProperty(Slider.StylePropertyFill, sliderFillGreen), }), new StyleRule(new SelectorElement(typeof(Slider), new [] { StyleClassSliderBlue }, null, null), new [] { new StyleProperty(Slider.StylePropertyFill, sliderFillBlue), }), // OptionButton new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassNormal }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonNormal), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassHover }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonHover), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassPressed }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonPressed), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassDisabled }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonDisabled), }), new StyleRule(new SelectorElement(typeof(TextureRect), new[] { OptionButton.StyleClassOptionTriangle }, null, null), new[] { new StyleProperty(TextureRect.StylePropertyTexture, textureInvertedTriangle), //new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#FFFFFF")), }), new StyleRule(new SelectorElement(typeof(Label), new[] { OptionButton.StyleClassOptionButton }, null, null), new[] { new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center), }), new StyleRule(new SelectorElement(typeof(PanelContainer), new [] { ClassHighDivider }, null, null), new [] { new StyleProperty(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = NanoGold, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2 }), }) }).ToList()); }
public StyleNano(IResourceCache resCache) : base(resCache) { var notoSans10 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 10); var notoSansItalic10 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Italic.ttf", 10); var notoSans12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12); var notoSansItalic12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Italic.ttf", 12); var notoSansBold12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 12); var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14); var notoSansDisplayBold16 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 16); var notoSans15 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 15); var notoSans16 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 16); var notoSansBold16 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 16); var notoSansBold18 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 18); var notoSansBold20 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 20); var windowHeaderTex = resCache.GetTexture("/Textures/Interface/Nano/window_header.png"); var windowHeader = new StyleBoxTexture { Texture = windowHeaderTex, PatchMarginBottom = 3, ExpandMarginBottom = 3, ContentMarginBottomOverride = 0 }; var windowBackgroundTex = resCache.GetTexture("/Textures/Interface/Nano/window_background.png"); var windowBackground = new StyleBoxTexture { Texture = windowBackgroundTex, }; windowBackground.SetPatchMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); windowBackground.SetExpandMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); var borderedWindowBackgroundTex = resCache.GetTexture("/Textures/Interface/Nano/window_background_bordered.png"); var borderedWindowBackground = new StyleBoxTexture { Texture = borderedWindowBackgroundTex, }; borderedWindowBackground.SetPatchMargin(StyleBox.Margin.All, 2); var invSlotBgTex = resCache.GetTexture("/Textures/Interface/Inventory/inv_slot_background.png"); var invSlotBg = new StyleBoxTexture { Texture = invSlotBgTex, }; invSlotBg.SetPatchMargin(StyleBox.Margin.All, 2); invSlotBg.SetContentMarginOverride(StyleBox.Margin.All, 0); var handSlotHighlightTex = resCache.GetTexture("/Textures/Interface/Inventory/hand_slot_highlight.png"); var handSlotHighlight = new StyleBoxTexture { Texture = handSlotHighlightTex, }; handSlotHighlight.SetPatchMargin(StyleBox.Margin.All, 2); var borderedTransparentWindowBackgroundTex = resCache.GetTexture("/Textures/Interface/Nano/transparent_window_background_bordered.png"); var borderedTransparentWindowBackground = new StyleBoxTexture { Texture = borderedTransparentWindowBackgroundTex, }; borderedTransparentWindowBackground.SetPatchMargin(StyleBox.Margin.All, 2); var hotbarBackground = new StyleBoxTexture { Texture = borderedWindowBackgroundTex, }; hotbarBackground.SetPatchMargin(StyleBox.Margin.All, 2); hotbarBackground.SetExpandMargin(StyleBox.Margin.All, 4); var buttonRectTex = resCache.GetTexture("/Textures/Interface/Nano/light_panel_background_bordered.png"); var buttonRect = new StyleBoxTexture(BaseButton) { Texture = buttonRectTex }; buttonRect.SetPatchMargin(StyleBox.Margin.All, 2); buttonRect.SetPadding(StyleBox.Margin.All, 2); buttonRect.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); buttonRect.SetContentMarginOverride(StyleBox.Margin.Horizontal, 2); var buttonRectHover = new StyleBoxTexture(buttonRect) { Modulate = ButtonColorHovered }; var buttonRectPressed = new StyleBoxTexture(buttonRect) { Modulate = ButtonColorPressed }; var buttonRectDisabled = new StyleBoxTexture(buttonRect) { Modulate = ButtonColorDisabled }; var buttonRectActionMenuItemTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_light_thin_border.png"); var buttonRectActionMenuRevokedItemTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_red_thin_border.png"); var buttonRectActionMenuItem = new StyleBoxTexture(BaseButton) { Texture = buttonRectActionMenuItemTex }; buttonRectActionMenuItem.SetPatchMargin(StyleBox.Margin.All, 2); buttonRectActionMenuItem.SetPadding(StyleBox.Margin.All, 2); buttonRectActionMenuItem.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); buttonRectActionMenuItem.SetContentMarginOverride(StyleBox.Margin.Horizontal, 2); var buttonRectActionMenuItemRevoked = new StyleBoxTexture(buttonRectActionMenuItem) { Texture = buttonRectActionMenuRevokedItemTex }; var buttonRectActionMenuItemHover = new StyleBoxTexture(buttonRectActionMenuItem) { Modulate = ButtonColorHovered }; var buttonRectActionMenuItemPressed = new StyleBoxTexture(buttonRectActionMenuItem) { Modulate = ButtonColorPressed }; var buttonTex = resCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); var topButtonBase = new StyleBoxTexture { Texture = buttonTex, }; topButtonBase.SetPatchMargin(StyleBox.Margin.All, 10); topButtonBase.SetPadding(StyleBox.Margin.All, 0); topButtonBase.SetContentMarginOverride(StyleBox.Margin.All, 0); var topButtonOpenRight = new StyleBoxTexture(topButtonBase) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((0, 0), (14, 24))), }; topButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0); var topButtonOpenLeft = new StyleBoxTexture(topButtonBase) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (14, 24))), }; topButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0); var topButtonSquare = new StyleBoxTexture(topButtonBase) { Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))), }; topButtonSquare.SetPatchMargin(StyleBox.Margin.Horizontal, 0); var textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png"); var lineEditTex = resCache.GetTexture("/Textures/Interface/Nano/lineedit.png"); var lineEdit = new StyleBoxTexture { Texture = lineEditTex, }; lineEdit.SetPatchMargin(StyleBox.Margin.All, 3); lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var actionSearchBoxTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_dark_thin_border.png"); var actionSearchBox = new StyleBoxTexture { Texture = actionSearchBoxTex, }; actionSearchBox.SetPatchMargin(StyleBox.Margin.All, 3); actionSearchBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerPanelTex = resCache.GetTexture("/Textures/Interface/Nano/tabcontainer_panel.png"); var tabContainerPanel = new StyleBoxTexture { Texture = tabContainerPanelTex, }; tabContainerPanel.SetPatchMargin(StyleBox.Margin.All, 2); var tabContainerBoxActive = new StyleBoxFlat { BackgroundColor = new Color(64, 64, 64) }; tabContainerBoxActive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerBoxInactive = new StyleBoxFlat { BackgroundColor = new Color(32, 32, 32) }; tabContainerBoxInactive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var progressBarBackground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.25f, 0.25f) }; progressBarBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); var progressBarForeground = new StyleBoxFlat { BackgroundColor = new Color(0.25f, 0.50f, 0.25f) }; progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5); // CheckBox var checkBoxTextureChecked = resCache.GetTexture("/Textures/Interface/Nano/checkbox_checked.svg.96dpi.png"); var checkBoxTextureUnchecked = resCache.GetTexture("/Textures/Interface/Nano/checkbox_unchecked.svg.96dpi.png"); // Tooltip box var tooltipTexture = resCache.GetTexture("/Textures/Interface/Nano/tooltip.png"); var tooltipBox = new StyleBoxTexture { Texture = tooltipTexture, }; tooltipBox.SetPatchMargin(StyleBox.Margin.All, 2); tooltipBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 7); // Placeholder var placeholderTexture = resCache.GetTexture("/Textures/Interface/Nano/placeholder.png"); var placeholder = new StyleBoxTexture { Texture = placeholderTexture }; placeholder.SetPatchMargin(StyleBox.Margin.All, 19); placeholder.SetExpandMargin(StyleBox.Margin.All, -5); placeholder.Mode = StyleBoxTexture.StretchMode.Tile; var itemListBackgroundSelected = new StyleBoxFlat { BackgroundColor = new Color(75, 75, 86) }; itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackgroundDisabled = new StyleBoxFlat { BackgroundColor = new Color(10, 10, 12) }; itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackground = new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68) }; itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); var itemListItemBackgroundTransparent = new StyleBoxFlat { BackgroundColor = Color.Transparent }; itemListItemBackgroundTransparent.SetContentMarginOverride(StyleBox.Margin.Vertical, 2); itemListItemBackgroundTransparent.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4); // NanoHeading var nanoHeadingTex = resCache.GetTexture("/Textures/Interface/Nano/nanoheading.svg.96dpi.png"); var nanoHeadingBox = new StyleBoxTexture { Texture = nanoHeadingTex, PatchMarginRight = 10, PatchMarginTop = 10, ContentMarginTopOverride = 2, ContentMarginLeftOverride = 10, PaddingTop = 4 }; nanoHeadingBox.SetPatchMargin(StyleBox.Margin.Left | StyleBox.Margin.Bottom, 2); // Stripe background var stripeBackTex = resCache.GetTexture("/Textures/Interface/Nano/stripeback.svg.96dpi.png"); var stripeBack = new StyleBoxTexture { Texture = stripeBackTex, Mode = StyleBoxTexture.StretchMode.Tile }; // Slider var sliderOutlineTex = resCache.GetTexture("/Textures/Interface/Nano/slider_outline.svg.96dpi.png"); var sliderFillTex = resCache.GetTexture("/Textures/Interface/Nano/slider_fill.svg.96dpi.png"); var sliderGrabTex = resCache.GetTexture("/Textures/Interface/Nano/slider_grabber.svg.96dpi.png"); var sliderFillBox = new StyleBoxTexture { Texture = sliderFillTex, Modulate = Color.FromHex("#3E6C45") }; var sliderBackBox = new StyleBoxTexture { Texture = sliderFillTex, Modulate = Color.FromHex("#1E1E22") }; var sliderForeBox = new StyleBoxTexture { Texture = sliderOutlineTex, Modulate = Color.FromHex("#494949") }; var sliderGrabBox = new StyleBoxTexture { Texture = sliderGrabTex, }; sliderFillBox.SetPatchMargin(StyleBox.Margin.All, 12); sliderBackBox.SetPatchMargin(StyleBox.Margin.All, 12); sliderForeBox.SetPatchMargin(StyleBox.Margin.All, 12); sliderGrabBox.SetPatchMargin(StyleBox.Margin.All, 12); var sliderFillGreen = new StyleBoxTexture(sliderFillBox) { Modulate = Color.Green }; var sliderFillRed = new StyleBoxTexture(sliderFillBox) { Modulate = Color.Red }; var sliderFillBlue = new StyleBoxTexture(sliderFillBox) { Modulate = Color.Blue }; Stylesheet = new Stylesheet(BaseRules.Concat(new[] { // Window title. new StyleRule( new SelectorElement(typeof(Label), new[] { SS14Window.StyleClassWindowTitle }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, NanoGold), new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), }), // Window background. new StyleRule( new SelectorElement(null, new[] { SS14Window.StyleClassWindowPanel }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, windowBackground), }), // bordered window background new StyleRule( new SelectorElement(null, new[] { StyleClassBorderedWindowPanel }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, borderedWindowBackground), }), new StyleRule( new SelectorElement(null, new[] { StyleClassTransparentBorderedWindowPanel }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, borderedTransparentWindowBackground), }), // inventory slot background new StyleRule( new SelectorElement(null, new[] { StyleClassInventorySlotBackground }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, invSlotBg), }), // hand slot highlight new StyleRule( new SelectorElement(null, new[] { StyleClassHandSlotHighlight }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, handSlotHighlight), }), // Hotbar background new StyleRule(new SelectorElement(typeof(PanelContainer), new[] { StyleClassHotbarPanel }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, hotbarBackground), }), // Window header. new StyleRule( new SelectorElement(typeof(PanelContainer), new[] { SS14Window.StyleClassWindowHeader }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, windowHeader), }), // Shapes for the buttons. Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Prop(ContainerButton.StylePropertyStyleBox, BaseButton), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonOpenRight) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenRight), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonOpenLeft) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenLeft), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonOpenBoth) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenBoth), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Class(ButtonSquare) .Prop(ContainerButton.StylePropertyStyleBox, BaseButtonSquare), new StyleRule(new SelectorElement(typeof(Label), new[] { Button.StyleClassButton }, null, null), new[] { new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center), }), // Colors for the buttons. Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassNormal) .Prop(Control.StylePropertyModulateSelf, ButtonColorDefault), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassHover) .Prop(Control.StylePropertyModulateSelf, ButtonColorHovered), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassPressed) .Prop(Control.StylePropertyModulateSelf, ButtonColorPressed), Element <ContainerButton>().Class(ContainerButton.StyleClassButton) .Pseudo(ContainerButton.StylePseudoClassDisabled) .Prop(Control.StylePropertyModulateSelf, ButtonColorDisabled), // Colors for the caution buttons. Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassNormal) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDefault), Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassHover) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionHovered), Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassPressed) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionPressed), Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Class(ButtonCaution) .Pseudo(ContainerButton.StylePseudoClassDisabled) .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDisabled), new StyleRule(new SelectorChild( new SelectorElement(typeof(Button), null, null, new[] { ContainerButton.StylePseudoClassDisabled }), new SelectorElement(typeof(Label), null, null, null)), new[] { new StyleProperty("font-color", Color.FromHex("#E5E5E581")), }), // action slot hotbar buttons new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] { ContainerButton.StylePseudoClassNormal }), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, buttonRect), }), new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] { ContainerButton.StylePseudoClassHover }), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, buttonRectHover), }), new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] { ContainerButton.StylePseudoClassPressed }), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, buttonRectPressed), }), new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] { ContainerButton.StylePseudoClassDisabled }), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, buttonRectDisabled), }), // action menu item buttons new StyleRule(new SelectorElement(typeof(ActionMenuItem), null, null, new[] { ContainerButton.StylePseudoClassNormal }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItem), }), // we don't actually disable the action menu items, only change their style based on the underlying action being revoked new StyleRule(new SelectorElement(typeof(ActionMenuItem), new [] { StyleClassActionMenuItemRevoked }, null, new[] { ContainerButton.StylePseudoClassNormal }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItemRevoked), }), new StyleRule(new SelectorElement(typeof(ActionMenuItem), null, null, new[] { ContainerButton.StylePseudoClassHover }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItemHover), }), new StyleRule(new SelectorElement(typeof(ActionMenuItem), null, null, new[] { ContainerButton.StylePseudoClassPressed }), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItemPressed), }), // Main menu: Make those buttons bigger. new StyleRule(new SelectorChild( new SelectorElement(typeof(Button), null, "mainMenu", null), new SelectorElement(typeof(Label), null, null, null)), new[] { new StyleProperty("font", notoSansBold16), }), // Main menu: also make those buttons slightly more separated. new StyleRule(new SelectorElement(typeof(BoxContainer), null, "mainMenuVBox", null), new[] { new StyleProperty(BoxContainer.StylePropertySeparation, 2), }), // Fancy LineEdit new StyleRule(new SelectorElement(typeof(LineEdit), null, null, null), new[] { new StyleProperty(LineEdit.StylePropertyStyleBox, lineEdit), }), new StyleRule( new SelectorElement(typeof(LineEdit), new[] { LineEdit.StyleClassLineEditNotEditable }, null, null), new[] { new StyleProperty("font-color", new Color(192, 192, 192)), }), new StyleRule( new SelectorElement(typeof(LineEdit), null, null, new[] { LineEdit.StylePseudoClassPlaceholder }), new[] { new StyleProperty("font-color", Color.Gray), }), // Action searchbox lineedit new StyleRule(new SelectorElement(typeof(LineEdit), new[] { StyleClassActionSearchBox }, null, null), new[] { new StyleProperty(LineEdit.StylePropertyStyleBox, actionSearchBox), }), // TabContainer new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null), new[] { new StyleProperty(TabContainer.StylePropertyPanelStyleBox, tabContainerPanel), new StyleProperty(TabContainer.StylePropertyTabStyleBox, tabContainerBoxActive), new StyleProperty(TabContainer.StylePropertyTabStyleBoxInactive, tabContainerBoxInactive), }), // ProgressBar new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), new[] { new StyleProperty(ProgressBar.StylePropertyBackground, progressBarBackground), new StyleProperty(ProgressBar.StylePropertyForeground, progressBarForeground) }), // CheckBox new StyleRule(new SelectorElement(typeof(TextureRect), new [] { CheckBox.StyleClassCheckBox }, null, null), new[] { new StyleProperty(TextureRect.StylePropertyTexture, checkBoxTextureUnchecked), }), new StyleRule(new SelectorElement(typeof(TextureRect), new [] { CheckBox.StyleClassCheckBox, CheckBox.StyleClassCheckBoxChecked }, null, null), new[] { new StyleProperty(TextureRect.StylePropertyTexture, checkBoxTextureChecked), }), new StyleRule(new SelectorElement(typeof(HBoxContainer), new [] { CheckBox.StyleClassCheckBox }, null, null), new[] { new StyleProperty(BoxContainer.StylePropertySeparation, 10), }), // Tooltip new StyleRule(new SelectorElement(typeof(Tooltip), null, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), new StyleRule(new SelectorElement(typeof(PanelContainer), new [] { StyleClassTooltipPanel }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), new StyleRule(new SelectorElement(typeof(PanelContainer), new[] { "speechBox", "sayBox" }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), new StyleRule(new SelectorChild( new SelectorElement(typeof(PanelContainer), new[] { "speechBox", "emoteBox" }, null, null), new SelectorElement(typeof(RichTextLabel), null, null, null)), new[] { new StyleProperty("font", notoSansItalic12), }), // alert tooltip new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipAlertTitle }, null, null), new[] { new StyleProperty("font", notoSansBold18) }), new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipAlertDescription }, null, null), new[] { new StyleProperty("font", notoSans16) }), new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipAlertCooldown }, null, null), new[] { new StyleProperty("font", notoSans16) }), // action tooltip new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipActionTitle }, null, null), new[] { new StyleProperty("font", notoSansBold16) }), new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipActionDescription }, null, null), new[] { new StyleProperty("font", notoSans15) }), new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipActionCooldown }, null, null), new[] { new StyleProperty("font", notoSans15) }), new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassTooltipActionRequirements }, null, null), new[] { new StyleProperty("font", notoSans15) }), // small number for the context menu new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassContextMenuCount }, null, null), new[] { new StyleProperty("font", notoSans10), new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Right), }), // hotbar slot new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] { StyleClassHotbarSlotNumber }, null, null), new[] { new StyleProperty("font", notoSansDisplayBold16) }), // Entity tooltip new StyleRule( new SelectorElement(typeof(PanelContainer), new[] { ExamineSystem.StyleClassEntityTooltip }, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), // ItemList new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new[] { new StyleProperty(ItemList.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) }), new StyleProperty(ItemList.StylePropertyItemBackground, itemListItemBackground), new StyleProperty(ItemList.StylePropertyDisabledItemBackground, itemListItemBackgroundDisabled), new StyleProperty(ItemList.StylePropertySelectedItemBackground, itemListBackgroundSelected) }), new StyleRule(new SelectorElement(typeof(ItemList), new[] { "transparentItemList" }, null, null), new[] { new StyleProperty(ItemList.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = Color.Transparent }), new StyleProperty(ItemList.StylePropertyItemBackground, itemListItemBackgroundTransparent), new StyleProperty(ItemList.StylePropertyDisabledItemBackground, itemListItemBackgroundDisabled), new StyleProperty(ItemList.StylePropertySelectedItemBackground, itemListBackgroundSelected) }), // Tree new StyleRule(new SelectorElement(typeof(Tree), null, null, null), new[] { new StyleProperty(Tree.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40) }), new StyleProperty(Tree.StylePropertyItemBoxSelected, new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68), ContentMarginLeftOverride = 4 }) }), // Placeholder new StyleRule(new SelectorElement(typeof(Placeholder), null, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, placeholder), }), new StyleRule( new SelectorElement(typeof(Label), new[] { Placeholder.StyleClassPlaceholderText }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSans16), new StyleProperty(Label.StylePropertyFontColor, new Color(103, 103, 103, 128)), }), // Big Label new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelHeading }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansBold16), new StyleProperty(Label.StylePropertyFontColor, NanoGold), }), // Bigger Label new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelHeadingBigger }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansBold20), new StyleProperty(Label.StylePropertyFontColor, NanoGold), }), // Small Label new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelSubText }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSans10), new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray), }), // Label Key new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelKeyText }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansBold12), new StyleProperty(Label.StylePropertyFontColor, NanoGold) }), new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassLabelSecondaryColor }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSans12), new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray), }), // Big Button new StyleRule(new SelectorChild( new SelectorElement(typeof(Button), new[] { StyleClassButtonBig }, null, null), new SelectorElement(typeof(Label), null, null, null)), new[] { new StyleProperty("font", notoSans16) }), // Popup messages new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPopupMessage }, null, null), new[] { new StyleProperty("font", notoSansItalic10), new StyleProperty("font-color", Color.LightGray), }), //APC and SMES power state label colors new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPowerStateNone }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.8f, 0.0f, 0.0f)) }), new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPowerStateLow }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.9f, 0.36f, 0.0f)) }), new StyleRule(new SelectorElement(typeof(Label), new[] { StyleClassPowerStateGood }, null, null), new[] { new StyleProperty(Label.StylePropertyFontColor, new Color(0.024f, 0.8f, 0.0f)) }), // Those top menu buttons. // these use slight variations on the various BaseButton styles so that the content within them appears centered, // which is NOT the case for the default BaseButton styles (OpenLeft/OpenRight adds extra padding on one of the sides // which makes the TopButton icons appear off-center, which we don't want). new StyleRule( new SelectorElement(typeof(GameHud.TopButton), new[] { ButtonSquare }, null, null), new[] { new StyleProperty(Button.StylePropertyStyleBox, topButtonSquare), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), new[] { ButtonOpenLeft }, null, null), new[] { new StyleProperty(Button.StylePropertyStyleBox, topButtonOpenLeft), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), new[] { ButtonOpenRight }, null, null), new[] { new StyleProperty(Button.StylePropertyStyleBox, topButtonOpenRight), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassNormal }), new[] { new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorDefault), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), new[] { GameHud.TopButton.StyleClassRedTopButton }, null, new[] { Button.StylePseudoClassNormal }), new[] { new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorDefaultRed), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassNormal }), new[] { new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorDefault), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassPressed }), new[] { new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorPressed), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), null, null, new[] { Button.StylePseudoClassHover }), new[] { new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorHovered), }), new StyleRule( new SelectorElement(typeof(GameHud.TopButton), new[] { GameHud.TopButton.StyleClassRedTopButton }, null, new[] { Button.StylePseudoClassHover }), new[] { new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorHoveredRed), }), new StyleRule( new SelectorElement(typeof(Label), new[] { GameHud.TopButton.StyleClassLabelTopButton }, null, null), new[] { new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), }), // Targeting doll new StyleRule( new SelectorElement(typeof(TextureButton), new[] { TargetingDoll.StyleClassTargetDollZone }, null, new[] { TextureButton.StylePseudoClassNormal }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorDefault), }), new StyleRule( new SelectorElement(typeof(TextureButton), new[] { TargetingDoll.StyleClassTargetDollZone }, null, new[] { TextureButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorHovered), }), new StyleRule( new SelectorElement(typeof(TextureButton), new[] { TargetingDoll.StyleClassTargetDollZone }, null, new[] { TextureButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorPressed), }), // NanoHeading new StyleRule( new SelectorChild( SelectorElement.Type(typeof(NanoHeading)), SelectorElement.Type(typeof(PanelContainer))), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, nanoHeadingBox), }), // StripeBack new StyleRule( SelectorElement.Type(typeof(StripeBack)), new[] { new StyleProperty(StripeBack.StylePropertyBackground, stripeBack), }), // StyleClassLabelBig new StyleRule( SelectorElement.Class(StyleClassLabelBig), new[] { new StyleProperty("font", notoSans16), }), // StyleClassItemStatus new StyleRule(SelectorElement.Class(StyleClassItemStatus), new[] { new StyleProperty("font", notoSans10), }), // Slider new StyleRule(SelectorElement.Type(typeof(Slider)), new [] { new StyleProperty(Slider.StylePropertyBackground, sliderBackBox), new StyleProperty(Slider.StylePropertyForeground, sliderForeBox), new StyleProperty(Slider.StylePropertyGrabber, sliderGrabBox), new StyleProperty(Slider.StylePropertyFill, sliderFillBox), }), new StyleRule(new SelectorElement(typeof(Slider), new [] { StyleClassSliderRed }, null, null), new [] { new StyleProperty(Slider.StylePropertyFill, sliderFillRed), }), new StyleRule(new SelectorElement(typeof(Slider), new [] { StyleClassSliderGreen }, null, null), new [] { new StyleProperty(Slider.StylePropertyFill, sliderFillGreen), }), new StyleRule(new SelectorElement(typeof(Slider), new [] { StyleClassSliderBlue }, null, null), new [] { new StyleProperty(Slider.StylePropertyFill, sliderFillBlue), }), // OptionButton new StyleRule(new SelectorElement(typeof(OptionButton), null, null, null), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, BaseButton), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassNormal }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorDefault), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorHovered), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorPressed), }), new StyleRule(new SelectorElement(typeof(OptionButton), null, null, new[] { ContainerButton.StylePseudoClassDisabled }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorDisabled), }), new StyleRule(new SelectorElement(typeof(TextureRect), new[] { OptionButton.StyleClassOptionTriangle }, null, null), new[] { new StyleProperty(TextureRect.StylePropertyTexture, textureInvertedTriangle), //new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#FFFFFF")), }), new StyleRule(new SelectorElement(typeof(Label), new[] { OptionButton.StyleClassOptionButton }, null, null), new[] { new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center), }), new StyleRule(new SelectorElement(typeof(PanelContainer), new [] { ClassHighDivider }, null, null), new [] { new StyleProperty(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = NanoGold, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2 }), }), Element <PanelContainer>().Class(ClassAngleRect) .Prop(PanelContainer.StylePropertyPanel, BaseAngleRect) .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#25252A")), }).ToList()); }
public SS14Window() { PanelOverride = new StyleBoxFlat { BackgroundColor = new Color(37, 37, 42) }; // Setup header. Includes the title label and close button. var header = new Panel { AnchorRight = 1.0f, MarginBottom = 25.0f, MouseFilter = MouseFilterMode.Ignore, StyleClasses = { StyleClassWindowHeader } }; header.AddStyleClass(StyleClassWindowHeader); TitleLabel = new Label { ClipText = true, AnchorRight = 1.0f, AnchorBottom = 1.0f, MarginRight = -25.0f, MarginLeft = 5, Text = "Exemplary Window Title Here", VAlign = Label.VAlignMode.Center, StyleClasses = { StyleClassWindowTitle } }; CloseButton = new TextureButton { AnchorLeft = 1.0f, AnchorRight = 1.0f, AnchorBottom = 1.0f, MarginLeft = -25.0f, StyleClasses = { StyleClassWindowCloseButton } }; CloseButton.OnPressed += CloseButtonPressed; header.AddChild(TitleLabel); header.AddChild(CloseButton); // Setup content area. Contents = new MarginContainer { AnchorRight = 1.0f, AnchorBottom = 1.0f, MarginTop = 30.0f, MarginBottomOverride = 10, MarginLeftOverride = 10, MarginRightOverride = 10, MarginTopOverride = 10, RectClipContent = true, MouseFilter = MouseFilterMode.Ignore }; Contents.OnMinimumSizeChanged += _ => MinimumSizeChanged(); AddChild(header); AddChild(Contents); AddStyleClass(StyleClassWindowPanel); MarginLeft = 100.0f; MarginTop = 38.0f; MarginRight = 878.0f; MarginBottom = 519.0f; if (CustomSize != null) { Size = CustomSize.Value; } }
public static Stylesheet Make() { var res = IoCManager.Resolve <IResourceCache>(); var textureCloseButton = res.GetResource <TextureResource>("/cross.svg.png").Texture; var notoSansFont = res.GetResource <FontResource>("/Fonts/NotoSans-Regular.ttf"); var notoSansBoldFont = res.GetResource <FontResource>("/Fonts/NotoSans-Bold.ttf"); var notoSansFont10 = new VectorFont(notoSansFont, 10); var notoSansFont12 = new VectorFont(notoSansFont, 12); var notoSansBoldFont14 = new VectorFont(notoSansBoldFont, 14); var scrollBarNormal = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var scrollBarHovered = new StyleBoxFlat { BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; var scrollBarGrabbed = new StyleBoxFlat { BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginLeftOverride = 10, ContentMarginTopOverride = 10 }; return(new Stylesheet(new StyleRule[] { Element <WindowRoot>() .Prop("background", Color.White), Element <PanelContainer>().Class("MapBackground") .Prop("panel", new StyleBoxFlat { BackgroundColor = Color.Black }), Element <PanelContainer>().Class("ContextMenuBackground") .Prop("panel", new StyleBoxFlat() { BackgroundColor = Color.White, BorderColor = Color.DarkGray, BorderThickness = new Thickness(1) }), // Default font. Element() .Prop("font", notoSansFont12) .Prop("font-color", Color.Black), // VScrollBar grabber normal Element <VScrollBar>() .Prop(ScrollBar.StylePropertyGrabber, scrollBarNormal), // VScrollBar grabber hovered Element <VScrollBar>().Pseudo(ScrollBar.StylePseudoClassHover) .Prop(ScrollBar.StylePropertyGrabber, scrollBarHovered), // VScrollBar grabber grabbed Element <VScrollBar>().Pseudo(ScrollBar.StylePseudoClassGrabbed) .Prop(ScrollBar.StylePropertyGrabber, scrollBarGrabbed), // HScrollBar grabber normal Element <HScrollBar>() .Prop(ScrollBar.StylePropertyGrabber, scrollBarNormal), // HScrollBar grabber hovered Element <HScrollBar>().Pseudo(ScrollBar.StylePseudoClassHover) .Prop(ScrollBar.StylePropertyGrabber, scrollBarHovered), // HScrollBar grabber grabbed Element <HScrollBar>().Pseudo(ScrollBar.StylePseudoClassGrabbed) .Prop(ScrollBar.StylePropertyGrabber, scrollBarGrabbed), // Window background default color. Element().Class(DefaultWindow.StyleClassWindowPanel) .Prop("panel", new StyleBoxFlat { BackgroundColor = Color.FromHex("#4A4A4A") }), // Window title properties Element().Class(DefaultWindow.StyleClassWindowTitle) // Color .Prop(Label.StylePropertyFontColor, Color.FromHex("#000000")) // Font .Prop(Label.StylePropertyFont, notoSansBoldFont14), // Window header color. Element().Class(DefaultWindow.StyleClassWindowHeader) .Prop(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = Color.FromHex("#636396"), Padding = new Thickness(1, 1) }), // Window close button Element().Class(DefaultWindow.StyleClassWindowCloseButton) // Button texture .Prop(TextureButton.StylePropertyTexture, textureCloseButton) // Normal button color .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#000000")), // Window close button hover color Element().Class(DefaultWindow.StyleClassWindowCloseButton).Pseudo(TextureButton.StylePseudoClassHover) .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#505050")), // Window close button pressed color Element().Class(DefaultWindow.StyleClassWindowCloseButton).Pseudo(TextureButton.StylePseudoClassPressed) .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#808080")), // Button style normal Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Pseudo(ContainerButton.StylePseudoClassNormal) .Prop(ContainerButton.StylePropertyStyleBox, new StyleBoxFlat { BackgroundColor = Color.FromHex("#C0C0C0"), BorderThickness = new Thickness(1), BorderColor = Color.FromHex("#707070") }), // Button style hovered Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Pseudo(ContainerButton.StylePseudoClassHover) .Prop(ContainerButton.StylePropertyStyleBox, new StyleBoxFlat { BackgroundColor = Color.FromHex("#D0D0D0"), BorderThickness = new Thickness(1), BorderColor = Color.FromHex("#707070") }), // Button style pressed Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Pseudo(ContainerButton.StylePseudoClassPressed) .Prop(ContainerButton.StylePropertyStyleBox, new StyleBoxFlat { BackgroundColor = Color.FromHex("#E0E0E0"), BorderThickness = new Thickness(1), BorderColor = Color.FromHex("#707070") }), // Button style disabled Element <ContainerButton>().Class(ContainerButton.StyleClassButton).Pseudo(ContainerButton.StylePseudoClassDisabled) .Prop(ContainerButton.StylePropertyStyleBox, new StyleBoxFlat { BackgroundColor = Color.FromHex("#FAFAFA"), BorderThickness = new Thickness(1), BorderColor = Color.FromHex("#707070") }), // DMF ControlButton Element <Label>().Class(ControlButton.StyleClassDMFButton) .Prop(Label.StylePropertyAlignMode, Label.AlignMode.Center) .Prop(Label.StylePropertyFont, notoSansFont10), // CheckBox unchecked Element <TextureRect>().Class(CheckBox.StyleClassCheckBox) .Prop(TextureRect.StylePropertyTexture, Texture.Black), // TODO: Add actual texture instead of this. // CheckBox unchecked Element <TextureRect>().Class(CheckBox.StyleClassCheckBox, CheckBox.StyleClassCheckBoxChecked) .Prop(TextureRect.StylePropertyTexture, Texture.White), // TODO: Add actual texture instead of this. // LineEdit Element <LineEdit>() // background color .Prop(LineEdit.StylePropertyStyleBox, new StyleBoxFlat { BackgroundColor = Color.FromHex("#D3B5B5"), BorderThickness = new Thickness(1), BorderColor = Color.FromHex("#abadb3") }) // default font color .Prop("font-color", Color.Black) .Prop("cursor-color", Color.Black), // LineEdit non-editable text color Element <LineEdit>().Class(LineEdit.StyleClassLineEditNotEditable) .Prop("font-color", Color.FromHex("#363636")), // LineEdit placeholder text color Element <LineEdit>().Pseudo(LineEdit.StylePseudoClassPlaceholder) .Prop("font-color", Color.FromHex("#7d7d7d")), // TabContainer Element <TabContainer>() // Panel style .Prop(TabContainer.StylePropertyPanelStyleBox, new StyleBoxFlat { BackgroundColor = Color.White, BorderThickness = new Thickness(1), BorderColor = Color.Black }) // Active tab style .Prop(TabContainer.StylePropertyTabStyleBox, new StyleBoxFlat { BackgroundColor = Color.FromHex("#707070"), PaddingLeft = 1, PaddingRight = 1, ContentMarginLeftOverride = 5, ContentMarginRightOverride = 5 }) // Inactive tab style .Prop(TabContainer.StylePropertyTabStyleBoxInactive, new StyleBoxFlat { BackgroundColor = Color.FromHex("#D0D0D0"), PaddingLeft = 1, PaddingRight = 1, ContentMarginLeftOverride = 5, ContentMarginRightOverride = 5 }) .Prop("font", notoSansFont10), })); }
public void Initialize() { var fontRes = _resourceCache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"); var font = new VectorFont(fontRes, 10); var bigFont = new VectorFont(fontRes, 32); var panelTex = _resourceCache.GetResource <TextureResource>("/Textures/Interface/panel.png"); var panel = new StyleBoxTexture { Texture = panelTex }; panel.SetPatchMargin(StyleBox.Margin.All, 2); panel.SetExpandMargin(StyleBox.Margin.All, 2); var panelDarkTex = _resourceCache.GetResource <TextureResource>("/Textures/Interface/panelDark.png"); var panelDark = new StyleBoxTexture { Texture = panelDarkTex }; panelDark.SetPatchMargin(StyleBox.Margin.All, 2); panelDark.SetExpandMargin(StyleBox.Margin.All, 2); var tabContainerPanelTex = _resourceCache.GetResource <TextureResource>("/Textures/Interface/tabPanel.png"); var tabContainerPanel = new StyleBoxTexture { Texture = tabContainerPanelTex.Texture, }; tabContainerPanel.SetPatchMargin(StyleBox.Margin.All, 2); var tabContainerBoxActive = new StyleBoxFlat { BackgroundColor = new Color(64, 64, 64) }; tabContainerBoxActive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var tabContainerBoxInactive = new StyleBoxFlat { BackgroundColor = new Color(32, 32, 32) }; tabContainerBoxInactive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); var textureCloseButton = _resourceCache.GetResource <TextureResource>("/Textures/Interface/cross.png").Texture; _userInterfaceManager.Stylesheet = new Stylesheet(new[] { new StyleRule( new SelectorElement(null, null, null, null), new[] { new StyleProperty("font", font), new StyleProperty(PanelContainer.StylePropertyPanel, panel), new StyleProperty(LineEdit.StylePropertyStyleBox, panelDark) }), // TabContainer new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null), new[] { new StyleProperty(TabContainer.StylePropertyPanelStyleBox, tabContainerPanel), new StyleProperty(TabContainer.StylePropertyTabStyleBox, tabContainerBoxActive), new StyleProperty(TabContainer.StylePropertyTabStyleBoxInactive, tabContainerBoxInactive), }), // Window close button base texture. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, null), new[] { new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton), new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#BB88BB")), }), // Window close button hover. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new[] { TextureButton.StylePseudoClassHover }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#DD88DD")), }), // Window close button pressed. new StyleRule( new SelectorElement(typeof(TextureButton), new[] { SS14Window.StyleClassWindowCloseButton }, null, new[] { TextureButton.StylePseudoClassPressed }), new[] { new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#FFCCFF")), }), // Game label. new StyleRule( new SelectorElement(typeof(Label), new [] { StyleClassLabelGame }, null, null), new [] { new StyleProperty(Label.StylePropertyFont, bigFont) }) }); }