public HumanInventoryWindow(ILocalizationManager loc, IResourceCache resourceCache)
            {
                Title     = loc.GetString("Your Inventory");
                Resizable = false;

                var buttonDict = new Dictionary <Slots, InventoryButton>();

                Buttons = buttonDict;

                const int width  = ButtonSize * 4 + ButtonSeparation * 3 + RightSeparation;
                const int height = ButtonSize * 4 + ButtonSeparation * 3;

                var windowContents = new Control {
                    CustomMinimumSize = (width, height)
                };

                Contents.AddChild(windowContents);

                void AddButton(Slots slot, string textureName, Vector2 position)
                {
                    var texture        = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png");
                    var storageTexture = resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png");
                    var button         = new InventoryButton(slot, texture, storageTexture)
                    {
                        Position = position
                    };

                    windowContents.AddChild(button);
                    buttonDict.Add(slot, button);
                }

                const int size = ButtonSize;
                const int sep  = ButtonSeparation;
                const int rSep = RightSeparation;

                // Left column.
                AddButton(Slots.EYES, "glasses", (0, size + sep));
                AddButton(Slots.INNERCLOTHING, "uniform", (0, 2 * (size + sep)));
                AddButton(Slots.EXOSUITSLOT1, "suit_storage", (0, 3 * (size + sep)));

                // Middle column.
                AddButton(Slots.HEAD, "head", (size + sep, 0));
                AddButton(Slots.MASK, "mask", (size + sep, size + sep));
                AddButton(Slots.OUTERCLOTHING, "suit", (size + sep, 2 * (size + sep)));
                AddButton(Slots.SHOES, "shoes", (size + sep, 3 * (size + sep)));

                // Right column
                AddButton(Slots.EARS, "ears", (2 * (size + sep), 0));
                AddButton(Slots.IDCARD, "id", (2 * (size + sep), size + sep));
                AddButton(Slots.GLOVES, "gloves", (2 * (size + sep), 2 * (size + sep)));

                // Far right column.
                AddButton(Slots.BACKPACK, "back", (rSep + 3 * (size + sep), 0));
                AddButton(Slots.BELT, "belt", (rSep + 3 * (size + sep), size + sep));
                AddButton(Slots.POCKET1, "pocket", (rSep + 3 * (size + sep), 2 * (size + sep)));
                AddButton(Slots.POCKET2, "pocket", (rSep + 3 * (size + sep), 3 * (size + sep)));

                Size = CombinedMinimumSize;
            }
        }
Exemple #2
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            AddChild(_guiContainer = new HBoxContainer
            {
                SeparationOverride = 0,
                Children           =
                {
                    (_rightPanel             = ItemStatusPanel.FromSide(HandLocation.Right)),
                    (_handsColumn            = new VBoxContainer
                    {
                        Children             =
                        {
                            (_topPanel       = ItemStatusPanel.FromSide(HandLocation.Middle)),
                            (_handsContainer = new HBoxContainer())
                        }
                    }),
                    (_leftPanel              = ItemStatusPanel.FromSide(HandLocation.Left))
                }
            });
            _leftHandTexture   = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png");
            _middleHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png");
            _rightHandTexture  = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_r.png");
        }
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            _handR = new UIBox2i(0, 0, BoxSize, BoxSize);
            _handL = _handR.Translated((BoxSize + BoxSpacing, 0));

            MouseFilter = MouseFilterMode.Stop;

            TextureHandLeft   = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png");
            TextureHandRight  = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png");
            TextureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png");

            TexturesCooldownOverlay = new Texture[CooldownLevels];
            for (var i = 0; i < CooldownLevels; i++)
            {
                TexturesCooldownOverlay[i] =
                    _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/cooldown-{i}.png");
            }

            AddChild(new TextureRect
            {
                MouseFilter  = MouseFilterMode.Ignore,
                Texture      = TextureHandLeft,
                Size         = _handL.Size,
                Position     = _handL.TopLeft,
                TextureScale = (2, 2)
            });
Exemple #4
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            var textureHandLeft   = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png");
            var textureHandRight  = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png");
            var textureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png");
            var storageTexture    = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png");

            _rightStatusPanel = new ItemStatusPanel(true);
            _leftStatusPanel  = new ItemStatusPanel(false);

            _leftButton  = new ItemSlotButton(textureHandLeft, storageTexture);
            _rightButton = new ItemSlotButton(textureHandRight, storageTexture);
            var hBox = new HBoxContainer
            {
                SeparationOverride = 0,
                Children           = { _rightStatusPanel, _rightButton, _leftButton, _leftStatusPanel }
            };

            AddChild(hBox);

            _leftButton.OnPressed         += args => HandKeyBindDown(args, HandNameLeft);
            _leftButton.OnStoragePressed  += args => _OnStoragePressed(args, HandNameLeft);
            _rightButton.OnPressed        += args => HandKeyBindDown(args, HandNameRight);
            _rightButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameRight);

            // Active hand
            _leftButton.AddChild(ActiveHandRect = new TextureRect
            {
                Texture      = textureHandActive,
                TextureScale = (2, 2)
            });
        public StyleNano(IResourceCache resCache) : base(resCache)
        {
            var notoSans10            = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Regular.ttf", 10);
            var notoSansItalic10      = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Italic.ttf", 10);
            var notoSans12            = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Regular.ttf", 12);
            var notoSansItalic12      = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Italic.ttf", 12);
            var notoSansBold12        = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Bold.ttf", 12);
            var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14);
            var notoSans16            = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Regular.ttf", 16);
            var notoSansBold16        = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Bold.ttf", 16);
            var notoSansBold20        = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Bold.ttf", 20);
            var textureCloseButton    = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png");
            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 textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png");
Exemple #6
0
            public HumanInventoryWindow(IResourceCache resourceCache)
            {
                Title     = Loc.GetString("Your Inventory");
                Resizable = false;

                var buttonDict = new Dictionary <Slots, ItemSlotButton>();

                Buttons = buttonDict;

                const int width  = ButtonSize * 4 + ButtonSeparation * 3 + RightSeparation;
                const int height = ButtonSize * 4 + ButtonSeparation * 3;

                var windowContents = new LayoutContainer {
                    CustomMinimumSize = (width, height)
                };

                Contents.AddChild(windowContents);

                void AddButton(Slots slot, string textureName, Vector2 position)
                {
                    var texture        = resourceCache.GetTexture($"/Textures/Interface/Inventory/{textureName}.png");
                    var storageTexture = resourceCache.GetTexture("/Textures/Interface/Inventory/back.png");
                    var button         = new ItemSlotButton(texture, storageTexture);

                    LayoutContainer.SetPosition(button, position);

                    windowContents.AddChild(button);
                    buttonDict.Add(slot, button);
                }

                const int sizep = (ButtonSize + ButtonSeparation);

                // Left column.
                AddButton(Slots.EYES, "glasses", (0, 0));
                AddButton(Slots.NECK, "neck", (0, sizep));
                AddButton(Slots.INNERCLOTHING, "uniform", (0, 2 * sizep));
                AddButton(Slots.POCKET1, "pocket", (0, 3 * sizep));

                // Middle column.
                AddButton(Slots.HEAD, "head", (sizep, 0));
                AddButton(Slots.MASK, "mask", (sizep, sizep));
                AddButton(Slots.OUTERCLOTHING, "suit", (sizep, 2 * sizep));
                AddButton(Slots.SHOES, "shoes", (sizep, 3 * sizep));

                // Right column
                AddButton(Slots.EARS, "ears", (2 * sizep, 0));
                AddButton(Slots.IDCARD, "id", (2 * sizep, sizep));
                AddButton(Slots.GLOVES, "gloves", (2 * sizep, 2 * sizep));
                AddButton(Slots.POCKET2, "pocket", (2 * sizep, 3 * sizep));

                // Far right column.
                AddButton(Slots.BACKPACK, "back", (3 * sizep, 0));
                AddButton(Slots.BELT, "belt", (3 * sizep, sizep));
            }
        }
Exemple #7
0
        protected StyleBase(IResourceCache resCache)
        {
            var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12);

            // Button styles.
            var buttonTex = resCache.GetTexture("/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);

            BaseRules = new[]
            {
                // Default font.
                new StyleRule(
                    new SelectorElement(null, null, null, null),
                    new[]
                {
                    new StyleProperty("font", notoSans12),
                }),
            };
        }
Exemple #8
0
        public void UpdateStatusEffects()
        {
            if (!CurrentlyControlled || _ui == null)
            {
                return;
            }
            _cooldown.Clear();
            _ui.VBox.DisposeAllChildren();

            foreach (var(key, effect) in _status.OrderBy(x => (int)x.Key))
            {
                var texture = _resourceCache.GetTexture(effect.Icon);
                var status  = new StatusControl(key, texture);

                if (effect.Cooldown.HasValue)
                {
                    var cooldown = new CooldownGraphic();
                    status.Children.Add(cooldown);
                    _cooldown[key] = cooldown;
                }

                status.OnPressed += args => StatusPressed(args, status);

                _ui.VBox.AddChild(status);
            }
        }
Exemple #9
0
        public void UpdateStatusEffects()
        {
            if (!CurrentlyControlled || _ui == null)
            {
                return;
            }
            _cooldown.Clear();
            _ui.VBox.DisposeAllChildren();

            foreach (var(key, statusEffect) in _status.OrderBy(x => (int)x.Key))
            {
                var status = new Control()
                {
                    Children =
                    {
                        new TextureRect
                        {
                            TextureScale = (2, 2),
                            Texture      = _resourceCache.GetTexture(statusEffect.Icon)
                        },
                    }
                };

                if (statusEffect.Cooldown.HasValue)
                {
                    var cooldown = new CooldownGraphic();
                    status.Children.Add(cooldown);
                    _cooldown[key] = cooldown;
                }

                _ui.VBox.AddChild(status);
            }
        }
 public void SetSeverity(short?severity)
 {
     if (_severity != severity)
     {
         _severity     = severity;
         _icon.Texture = _resourceCache.GetTexture(Alert.GetIconPath(_severity));
     }
 }
Exemple #11
0
 public void Initialize()
 {
     for (var i = 0; i < CooldownLevels; i++)
     {
         _texturesCooldownOverlay[i] =
             _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/cooldown-{i}.png");
     }
 }
Exemple #12
0
        public void UpdateIcons()
        {
            if (!CurrentlyControlled || _ui == null)
            {
                return;
            }
            _ui.VBox.DisposeAllChildren();

            foreach (var effect in _icons.OrderBy(x => (int)x.Key))
            {
                TextureRect newIcon = new TextureRect
                {
                    TextureScale = (2, 2),
                    Texture      = _resourceCache.GetTexture(effect.Value)
                };

                newIcon.Texture = _resourceCache.GetTexture(effect.Value);
                _ui.VBox.AddChild(newIcon);
            }
        }
Exemple #13
0
        protected StyleBase(IResourceCache resCache)
        {
            var notoSans12 = resCache.GetFont("/Textures/Interface/Nano/NotoSans/NotoSans-Regular.ttf", 12);

            // 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);

            BaseRules = new[]
            {
                // Default font.
                new StyleRule(
                    new SelectorElement(null, null, null, null),
                    new[]
                {
                    new StyleProperty("font", notoSans12),
                }),
            };
        }
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            ToolTip = _loc.GetString("Your hands");

            _handR = new UIBox2i(0, 0, BoxSize, BoxSize);
            _handL = _handR.Translated((BoxSize + BoxSpacing, 0));

            MouseFilter = MouseFilterMode.Stop;

            TextureHandLeft   = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png");
            TextureHandRight  = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png");
            TextureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png");

            AddChild(new TextureRect
            {
                MouseFilter  = MouseFilterMode.Ignore,
                Texture      = TextureHandLeft,
                Size         = _handL.Size,
                Position     = _handL.TopLeft,
                TextureScale = (2, 2)
            });
Exemple #15
0
        public WiresMenu(WiresBoundUserInterface owner)
        {
            IoCManager.InjectDependencies(this);

            Owner = owner;
            var rootContainer = new LayoutContainer {
                Name = "WireRoot"
            };

            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"
            };
            var bottomPanel = new PanelContainer
            {
                PanelOverride = back,
                MouseFilter   = MouseFilterMode.Pass
            };

            var shadow = new BoxContainer
            {
                Orientation = LayoutOrientation.Horizontal,
                Children    =
                {
                    new PanelContainer
                    {
                        MinSize       = (2, 0),
                        PanelOverride = new StyleBoxFlat{
                            BackgroundColor = Color.FromHex("#525252ff")
                        }
                    },
        public AlertControl(AlertPrototype alert, short?severity, IResourceCache resourceCache)
        {
            _resourceCache = resourceCache;
            Alert          = alert;
            _severity      = severity;
            var texture = _resourceCache.GetTexture(alert.GetIconPath(_severity));

            _icon = new TextureRect
            {
                TextureScale = (2, 2),
                Texture      = texture
            };

            Children.Add(_icon);
            _cooldownGraphic = new CooldownGraphic();
            Children.Add(_cooldownGraphic);
        }
Exemple #17
0
        public CharacterSetupGui(
            IEntityManager entityManager,
            IResourceCache resourceCache,
            IClientPreferencesManager preferencesManager,
            IPrototypeManager prototypeManager,
            IConfigurationManager configurationManager)
        {
            RobustXamlLoader.Load(this);
            _entityManager        = entityManager;
            _prototypeManager     = prototypeManager;
            _preferencesManager   = preferencesManager;
            _configurationManager = configurationManager;

            var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
            var back     = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = new Color(37, 37, 42)
            };

            back.SetPatchMargin(StyleBox.Margin.All, 10);

            BackgroundPanel.PanelOverride = back;

            _createNewCharacterButton = new Button
            {
                Text = Loc.GetString("character-setup-gui-create-new-character-button"),
            };
            _createNewCharacterButton.OnPressed += args =>
            {
                preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random());
                UpdateUI();
                args.Event.Handle();
            };

            _humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager, entityManager, configurationManager);
            _humanoidProfileEditor.OnProfileChanged += ProfileChanged;
            CharEditor.AddChild(_humanoidProfileEditor);

            UpdateUI();

            RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open();
            preferencesManager.OnServerDataLoaded += UpdateUI;
        }
Exemple #18
0
        /// <summary>
        ///     Adds a new hand to this control
        /// </summary>
        /// <param name="hand">The hand to add to this control</param>
        /// <param name="buttonLocation">
        ///     The actual location of the button. The right hand is drawn
        ///     on the LEFT of the screen.
        /// </param>
        private void AddHand(Hand hand, HandLocation buttonLocation)
        {
            var textureName = "hand_l.png";

            if (buttonLocation == HandLocation.Right)
            {
                textureName = "hand_r.png";
            }
            var buttonTexture  = HandTexture(buttonLocation);
            var storageTexture = _gameHud.GetHudTexture("back.png");
            var blockedTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/blocked.png");
            var button         = new HandButton(buttonTexture, storageTexture, textureName, blockedTexture, buttonLocation);
            var slot           = hand.Name;

            button.OnPressed        += args => HandKeyBindDown(args, slot);
            button.OnStoragePressed += args => _OnStoragePressed(args, slot);

            _handsContainer.AddChild(button);
            hand.Button = button;
        }
        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("/Textures/Interface/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
                    }),
                    (CreditsButton = new Button
                    {
                        SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
                        Text = Loc.GetString("Credits"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                        //GrowHorizontal = GrowDirection.Begin
                    }),
                    (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)
            });
Exemple #20
0
    private BoxContainer GenerateButtonBar(IResourceCache resourceCache, IInputManager inputManager)
    {
        var topButtonsContainer = new BoxContainer
        {
            Orientation        = BoxContainer.LayoutOrientation.Horizontal,
            SeparationOverride = 8
        };

        LayoutContainer.SetAnchorAndMarginPreset(topButtonsContainer, LayoutContainer.LayoutPreset.TopLeft, margin: 10);

        // the icon textures here should all have the same image height (32) but different widths, so in order to ensure
        // the buttons themselves are consistent widths we set a common custom min size
        Vector2 topMinSize = (42, 64);

        // Escape
        {
            _buttonEscapeMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/hamburger.svg.192dpi.png"),
                                              EngineKeyFunctions.EscapeMenu, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-escape-menu-button-tooltip"),
                MinSize      = (70, 64),
                StyleClasses = { StyleBase.ButtonOpenRight }
            };

            topButtonsContainer.AddChild(_buttonEscapeMenu);

            _buttonEscapeMenu.OnToggled += args => EscapeButtonToggled?.Invoke(args.Pressed);
        }

        // Character
        {
            _buttonCharacterMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/character.svg.192dpi.png"),
                                                 ContentKeyFunctions.OpenCharacterMenu, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-character-menu-button-tooltip"),
                MinSize      = topMinSize,
                Visible      = false,
                StyleClasses = { StyleBase.ButtonSquare }
            };

            topButtonsContainer.AddChild(_buttonCharacterMenu);

            _buttonCharacterMenu.OnToggled += args => CharacterButtonToggled?.Invoke(args.Pressed);
        }

        // Inventory
        {
            _buttonInventoryMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/inventory.svg.192dpi.png"),
                                                 ContentKeyFunctions.OpenInventoryMenu, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-inventory-menu-button-tooltip"),
                MinSize      = topMinSize,
                Visible      = false,
                StyleClasses = { StyleBase.ButtonSquare }
            };

            topButtonsContainer.AddChild(_buttonInventoryMenu);

            _buttonInventoryMenu.OnToggled += args => InventoryButtonToggled?.Invoke(args.Pressed);
        }

        // Crafting
        {
            _buttonCraftingMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/hammer.svg.192dpi.png"),
                                                ContentKeyFunctions.OpenCraftingMenu, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-crafting-menu-button-tooltip"),
                MinSize      = topMinSize,
                Visible      = false,
                StyleClasses = { StyleBase.ButtonSquare }
            };

            topButtonsContainer.AddChild(_buttonCraftingMenu);

            _buttonCraftingMenu.OnToggled += args => CraftingButtonToggled?.Invoke(args.Pressed);
        }

        // Actions
        {
            _buttonActionsMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/fist.svg.192dpi.png"),
                                               ContentKeyFunctions.OpenActionsMenu, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-actions-menu-button-tooltip"),
                MinSize      = topMinSize,
                Visible      = false,
                StyleClasses = { StyleBase.ButtonSquare }
            };

            topButtonsContainer.AddChild(_buttonActionsMenu);

            _buttonActionsMenu.OnToggled += args => ActionsButtonToggled?.Invoke(args.Pressed);
        }

        // Admin
        {
            _buttonAdminMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/gavel.svg.192dpi.png"),
                                             ContentKeyFunctions.OpenAdminMenu, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-admin-menu-button-tooltip"),
                MinSize      = topMinSize,
                Visible      = false,
                StyleClasses = { StyleBase.ButtonSquare }
            };

            topButtonsContainer.AddChild(_buttonAdminMenu);

            _buttonAdminMenu.OnToggled += args => AdminButtonToggled?.Invoke(args.Pressed);
        }

        // Sandbox
        {
            _buttonSandboxMenu = new TopButton(resourceCache.GetTexture("/Textures/Interface/sandbox.svg.192dpi.png"),
                                               ContentKeyFunctions.OpenSandboxWindow, inputManager)
            {
                ToolTip      = Loc.GetString("game-hud-open-sandbox-menu-button-tooltip"),
                MinSize      = topMinSize,
                Visible      = false,
                StyleClasses = { StyleBase.ButtonSquare }
            };

            topButtonsContainer.AddChild(_buttonSandboxMenu);

            _buttonSandboxMenu.OnToggled += args => SandboxButtonToggled?.Invoke(args.Pressed);
        }

        // Info Window
        {
            _buttonInfo = new TopButton(resourceCache.GetTexture("/Textures/Interface/info.svg.192dpi.png"),
                                        ContentKeyFunctions.OpenInfo, inputManager)
            {
                ToolTip      = Loc.GetString("ui-options-function-open-info"),
                MinSize      = topMinSize,
                StyleClasses = { StyleBase.ButtonOpenLeft, TopButton.StyleClassRedTopButton },
            };

            topButtonsContainer.AddChild(_buttonInfo);

            _buttonInfo.OnToggled += args => InfoButtonToggled?.Invoke(args.Pressed);
            _buttonInfo.OnToggled += ButtonInfoToggledHandler;
        }

        return(topButtonsContainer);
    }
        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 VBoxContainer
            {
                Children =
                {
                    (_topContainer        = new VBoxContainer()),
                    new Control {
                        CustomMinimumSize = (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 MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 2,
                MarginRightOverride  = 12,
                MarginBottomOverride = 2,
                Children             =
                {
                    new HBoxContainer
                    {
                        Children =
                        {
                            (_lblName               = new Label
                            {
                                Text                = Loc.GetString("Gas Tank"),
                                FontOverride        = font,
                                FontColorOverride   = StyleNano.NanoGold,
                                SizeFlagsVertical   = SizeFlags.ShrinkCenter
                            }),
                            new Control
                            {
                                CustomMinimumSize   = (20, 0),
                                SizeFlagsHorizontal = SizeFlags.Expand
                            },
Exemple #22
0
        public CharacterSetupGui(
            IEntityManager entityManager,
            IResourceCache resourceCache,
            IClientPreferencesManager preferencesManager,
            IPrototypeManager prototypeManager)
        {
            AddChild(new ParallaxControl());

            _entityManager      = entityManager;
            _preferencesManager = preferencesManager;
            var margin = new Control
            {
                Margin = new Thickness(20),
            };

            AddChild(margin);

            var panelTex = resourceCache.GetTexture("/Textures/Interface/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
            {
                MinSize  = (0, 40),
                Children =
                {
                    new Label
                    {
                        Margin       = new Thickness(8, 0, 0, 0),
                        Text         = Loc.GetString("character-setup-gui-character-setup-label"),
                        StyleClasses ={ StyleNano.StyleClassLabelHeadingBigger                    },
                        VAlign       = Label.VAlignMode.Center,
                    },
                    (SaveButton = new Button
                    {
                        HorizontalExpand = true,
                        HorizontalAlignment = HAlignment.Right,
                        Text = Loc.GetString("character-setup-gui-character-setup-save-button"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                    }),
                    (CloseButton = new Button
                    {
                        Text = Loc.GetString("character-setup-gui-character-setup-close-button"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                    })
                }
            };

            vBox.AddChild(topHBox);

            vBox.AddChild(new PanelContainer
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = StyleNano.NanoGold,
                    ContentMarginTopOverride = 2
                }
            });

            var hBox = new HBoxContainer
            {
                VerticalExpand     = true,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            _charactersVBox = new VBoxContainer();

            hBox.AddChild(new ScrollContainer
            {
                MinSize  = (325, 0),
                Margin   = new Thickness(5, 5, 0, 0),
                Children =
                {
                    _charactersVBox
                }
            });
        protected StyleBase(IResourceCache resCache)
        {
            var notoSans12 = resCache.GetFont
                             (
                new []
            {
                "/Fonts/NotoSans/NotoSans-Regular.ttf",
                "/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
                "/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
            },
                12
                             );
            var notoSans12Italic = resCache.GetFont
                                   (
                new []
            {
                "/Fonts/NotoSans/NotoSans-Italic.ttf",
                "/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
                "/Fonts/NotoSans/NotoSansSymbols2-Regular.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 = DefaultGrabberSize,
                ContentMarginTopOverride = DefaultGrabberSize
            };
            var vScrollBarGrabberHover = new StyleBoxFlat
            {
                BackgroundColor          = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginLeftOverride = DefaultGrabberSize,
                ContentMarginTopOverride = DefaultGrabberSize
            };
            var vScrollBarGrabberGrabbed = new StyleBoxFlat
            {
                BackgroundColor          = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginLeftOverride = DefaultGrabberSize,
                ContentMarginTopOverride = DefaultGrabberSize
            };

            var hScrollBarGrabberNormal = new StyleBoxFlat
            {
                BackgroundColor = Color.Gray.WithAlpha(0.35f), ContentMarginTopOverride = DefaultGrabberSize
            };
            var hScrollBarGrabberHover = new StyleBoxFlat
            {
                BackgroundColor = new Color(140, 140, 140).WithAlpha(0.35f), ContentMarginTopOverride = DefaultGrabberSize
            };
            var hScrollBarGrabberGrabbed = new StyleBoxFlat
            {
                BackgroundColor = new Color(160, 160, 160).WithAlpha(0.35f), ContentMarginTopOverride = DefaultGrabberSize
            };


            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[] { DefaultWindow.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[] { DefaultWindow.StyleClassWindowCloseButton }, null,
                                        new[] { TextureButton.StylePseudoClassHover }),
                    new[]
                {
                    new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")),
                }),
                // Window close button pressed.
                new StyleRule(
                    new SelectorElement(typeof(TextureButton), new[] { DefaultWindow.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),
                }),
            };
        }
Exemple #24
0
        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 VBoxContainer
            {
                Children =
                {
                    (_topContainer = new VBoxContainer()),
                    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 HBoxContainer
            {
                Margin   = new Thickness(4, 2, 12, 2),
                Children =
                {
                    (_lblName               = new Label
                    {
                        Text                = Loc.GetString("Gas Tank"),
                        FontOverride        = font,
                        FontColorOverride   = StyleNano.NanoGold,
                        VerticalAlignment   = VAlignment.Center,
                        HorizontalExpand    = true,
                        HorizontalAlignment = HAlignment.Left,
                        Margin              = new Thickness(0,0, 20, 0),
                    }),
                    (btnClose               = new TextureButton
                    {
                        StyleClasses        = { SS14Window.StyleClassWindowCloseButton },
                        VerticalAlignment   = VAlignment.Center
                    })
                }
            };

            var middle = new PanelContainer
            {
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = Color.FromHex("#202025")
                },
                Children =
                {
                    (_contentContainer = new VBoxContainer
                    {
                        Margin         = new Thickness(8,4),
                    })
                }
            };

            _topContainer.AddChild(topRow);
            _topContainer.AddChild(new PanelContainer
            {
                MinSize       = (0, 2),
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = Color.FromHex("#525252ff")
                }
            });
Exemple #25
0
        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 notoSans16            = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 16);
            var notoSansBold16        = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 16);
            var notoSansBold20        = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 20);
            var textureCloseButton    = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png");
            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 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 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 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("/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, 5);

            // 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),
                }),
                // 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")),
                }),

                // 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),

                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")),
                }),

                // 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)
                }),

                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),
                }),

                // 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.
                Element <GameHud.TopButton>()
                .Prop(Button.StylePropertyStyleBox, BaseButton),

                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(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
                    }),
                })
            }).ToList());
        }
        public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache)
        {
            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 Panel
            {
                PanelOverride = back
            };

            AddChild(panel);

            panel.SetAnchorAndMarginPreset(LayoutPreset.Wide);

            var vBox = new VBoxContainer {
                SeparationOverride = 0
            };

            vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);

            vBox.MarginTop = 40;

            AddChild(vBox);

            AddChild(new Label
            {
                Text         = localization.GetString("Lobby"),
                StyleClasses = { NanoStyle.StyleClassLabelHeadingBigger },
                MarginBottom = 40,
                MarginLeft   = 8,
                VAlign       = Label.VAlignMode.Center
            });

            AddChild(ServerName = new Label
            {
                StyleClasses   = { NanoStyle.StyleClassLabelHeadingBigger },
                MarginBottom   = 40,
                GrowHorizontal = GrowDirection.Both,
                VAlign         = Label.VAlignMode.Center
            });

            ServerName.SetAnchorAndMarginPreset(LayoutPreset.CenterTop);

            AddChild(LeaveButton = new Button
            {
                SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
                Text           = localization.GetString("Leave"),
                StyleClasses   = { NanoStyle.StyleClassButtonBig },
                GrowHorizontal = GrowDirection.Begin
            });

            LeaveButton.SetAnchorAndMarginPreset(LayoutPreset.TopRight);

            vBox.AddChild(new Panel
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = NanoStyle.NanoGold,
                    ContentMarginTopOverride = 2
                },
            });

            var hBox = new HBoxContainer
            {
                SizeFlagsVertical  = SizeFlags.FillExpand,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            hBox.AddChild(new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SeparationOverride  = 0,
                Children            =
                {
                    new Placeholder(resourceCache)
                    {
                        SizeFlagsVertical = SizeFlags.FillExpand,
                        PlaceholderText   = localization.GetString("Character UI\nPlaceholder")
                    },

                    new StripeBack
                    {
                        Children =
                        {
                            new MarginContainer
                            {
                                MarginRightOverride  = 3,
                                MarginLeftOverride   = 3,
                                MarginTopOverride    = 3,
                                MarginBottomOverride = 3,
                                Children             =
                                {
                                    new HBoxContainer
                                    {
                                        SeparationOverride = 6,
                                        Children           =
                                        {
                                            (ObserveButton          = new Button
                                            {
                                                Text                = localization.GetString("Observe"),
                                                StyleClasses        = { NanoStyle.StyleClassButtonBig }
                                            }),
                                            (StartTime              = new Label
                                            {
                                                SizeFlagsHorizontal = SizeFlags.FillExpand,
                                                Align               = Label.AlignMode.Right,
                                                FontColorOverride   = Color.DarkGray,
                                                StyleClasses        = { NanoStyle.StyleClassLabelBig  }
                                            }),
                                            (ReadyButton            = new Button
                                            {
                                                ToggleMode          = true,
                                                Text                = localization.GetString("Ready Up"),
                                                StyleClasses        = { NanoStyle.StyleClassButtonBig }
                                            }),
                                        }
                                    }
                                }
                            }
                        }
                    },

                    new MarginContainer
                    {
                        MarginRightOverride  = 3,
                        MarginLeftOverride   = 3,
                        MarginTopOverride    = 3,
                        MarginBottomOverride = 3,
                        SizeFlagsVertical    = SizeFlags.FillExpand,
                        Children             =
                        {
                            (Chat     = new ChatBox
                            {
                                Input =     { PlaceHolder = localization.GetString("Say something!")}
                            })
                        }
                    },
                }
            });

            hBox.AddChild(new Panel
            {
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = NanoStyle.NanoGold
                }, CustomMinimumSize = (2, 0)
            });
Exemple #27
0
        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());
        }
Exemple #28
0
        public void Initialize()
        {
            RootControl = new Control {
                MouseFilter = Control.MouseFilterMode.Ignore
            };

            RootControl.SetAnchorPreset(Control.LayoutPreset.Wide);

            var escapeTexture    = _resourceCache.GetTexture("/Textures/UserInterface/hamburger.svg.96dpi.png");
            var characterTexture = _resourceCache.GetTexture("/Textures/UserInterface/character.svg.96dpi.png");
            var inventoryTexture = _resourceCache.GetTexture("/Textures/UserInterface/inventory.svg.96dpi.png");
            var craftingTexture  = _resourceCache.GetTexture("/Textures/UserInterface/hammer.svg.96dpi.png");
            var tutorialTexture  = _resourceCache.GetTexture("/Textures/UserInterface/students-cap.svg.96dpi.png");
            var sandboxTexture   = _resourceCache.GetTexture("/Textures/UserInterface/sandbox.svg.96dpi.png");

            _topButtonsContainer = new HBoxContainer
            {
                SeparationOverride = 4
            };

            RootControl.AddChild(_topButtonsContainer);
            _topButtonsContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.TopLeft, margin: 10);

            // TODO: Pull key names here from the actual key binding config.
            // Escape
            _buttonEscapeMenu = new TopButton(escapeTexture, "Esc")
            {
                ToolTip = _loc.GetString("Open escape menu.")
            };

            _topButtonsContainer.AddChild(_buttonEscapeMenu);

            _buttonEscapeMenu.OnToggled += args => EscapeButtonToggled?.Invoke(args.Pressed);

            // Tutorial
            _buttonTutorial = new TopButton(tutorialTexture, "F1")
            {
                ToolTip = _loc.GetString("Open tutorial.")
            };

            _topButtonsContainer.AddChild(_buttonTutorial);

            _buttonTutorial.OnToggled += a => ButtonTutorialOnOnToggled();

            // Character
            _buttonCharacterMenu = new TopButton(characterTexture, "C")
            {
                ToolTip = _loc.GetString("Open character menu."),
                Visible = false
            };

            _topButtonsContainer.AddChild(_buttonCharacterMenu);

            _buttonCharacterMenu.OnToggled += args => CharacterButtonToggled?.Invoke(args.Pressed);

            // Inventory
            _buttonInventoryMenu = new TopButton(inventoryTexture, "I")
            {
                ToolTip = _loc.GetString("Open inventory menu."),
                Visible = false
            };

            _topButtonsContainer.AddChild(_buttonInventoryMenu);

            _buttonInventoryMenu.OnToggled += args => InventoryButtonToggled?.Invoke(args.Pressed);

            // Crafting
            _buttonCraftingMenu = new TopButton(craftingTexture, "G")
            {
                ToolTip = _loc.GetString("Open crafting menu."),
                Visible = false
            };

            _topButtonsContainer.AddChild(_buttonCraftingMenu);

            _buttonCraftingMenu.OnToggled += args => CraftingButtonToggled?.Invoke(args.Pressed);

            // Sandbox
            _buttonSandboxMenu = new TopButton(sandboxTexture, "B")
            {
                ToolTip = _loc.GetString("Open sandbox menu."),
                Visible = true
            };

            _topButtonsContainer.AddChild(_buttonSandboxMenu);

            _buttonSandboxMenu.OnToggled += args => SandboxButtonToggled?.Invoke(args.Pressed);

            _tutorialWindow = new TutorialWindow();

            _tutorialWindow.OnClose += () => _buttonTutorial.Pressed = false;

            _inputManager.SetInputCommand(ContentKeyFunctions.OpenTutorial,
                                          InputCmdHandler.FromDelegate(s => ButtonTutorialOnOnToggled()));

            var inventoryContainer = new HBoxContainer
            {
                GrowHorizontal     = Control.GrowDirection.Begin,
                GrowVertical       = Control.GrowDirection.Begin,
                SeparationOverride = 10
            };

            RootControl.AddChild(inventoryContainer);
            inventoryContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomRight);

            InventoryQuickButtonContainer = new MarginContainer
            {
                GrowHorizontal = Control.GrowDirection.Begin,
                GrowVertical   = Control.GrowDirection.Begin,
            };

            HandsContainer = new MarginContainer
            {
                GrowHorizontal = Control.GrowDirection.Both,
                GrowVertical   = Control.GrowDirection.Begin
            };

            inventoryContainer.Children.Add(HandsContainer);
            inventoryContainer.Children.Add(InventoryQuickButtonContainer);
        }
        public CharacterSetupGui(IEntityManager entityManager,
                                 ILocalizationManager localization,
                                 IResourceCache resourceCache,
                                 IClientPreferencesManager preferencesManager,
                                 IPrototypeManager prototypeManager)
        {
            _entityManager      = entityManager;
            _preferencesManager = 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);

            CloseButton = new Button
            {
                SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkEnd,
                Text         = localization.GetString("Save and close"),
                StyleClasses = { NanoStyle.StyleClassButtonBig }
            };

            var topHBox = new HBoxContainer
            {
                CustomMinimumSize = (0, 40),
                Children          =
                {
                    new MarginContainer
                    {
                        MarginLeftOverride = 8,
                        Children           =
                        {
                            new Label
                            {
                                Text                = localization.GetString("Character Setup"),
                                StyleClasses        = { NanoStyle.StyleClassLabelHeadingBigger },
                                VAlign              = Label.VAlignMode.Center,
                                SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
                            }
                        }
                    },
                    CloseButton
                }
            };

            vBox.AddChild(topHBox);

            vBox.AddChild(new PanelContainer
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = NanoStyle.NanoGold,
                    ContentMarginTopOverride = 2
                }
            });

            var hBox = new HBoxContainer
            {
                SizeFlagsVertical  = SizeFlags.FillExpand,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            _charactersVBox = new VBoxContainer();

            hBox.AddChild(new MarginContainer
            {
                CustomMinimumSize   = (330, 0),
                SizeFlagsHorizontal = SizeFlags.Fill,
                MarginTopOverride   = 5,
                MarginLeftOverride  = 5,
                Children            =
                {
                    new ScrollContainer
                    {
                        SizeFlagsVertical = SizeFlags.FillExpand,
                        Children          =
                        {
                            _charactersVBox
                        }
                    }
                }
            });
        private async void PopulateChangelog()
        {
            // Changelog is not kept in memory so load it again.
            var changelog = await _changelog.LoadChangelog();

            var byDay = changelog
                        .GroupBy(e => e.Time.ToLocalTime().Date)
                        .OrderByDescending(c => c.Key);

            var hasRead = _changelog.MaxId <= _changelog.LastReadId;

            foreach (var dayEntries in byDay)
            {
                var day = dayEntries.Key;

                var groupedEntries = dayEntries
                                     .GroupBy(c => (c.Author, Read: c.Id <= _changelog.LastReadId))
                                     .OrderBy(c => c.Key.Read)
                                     .ThenBy(c => c.Key.Author);

                string dayNice;
                var    today = DateTime.Today;
                if (day == today)
                {
                    dayNice = Loc.GetString("changelog-today");
                }
                else if (day == today.AddDays(-1))
                {
                    dayNice = Loc.GetString("changelog-yesterday");
                }
                else
                {
                    dayNice = day.ToShortDateString();
                }

                ChangelogBody.AddChild(new Label
                {
                    Text         = dayNice,
                    StyleClasses = { "LabelHeading" },
                    Margin       = new Thickness(4, 6, 0, 0)
                });

                var first = true;

                foreach (var groupedEntry in groupedEntries)
                {
                    var(author, read) = groupedEntry.Key;

                    if (!first)
                    {
                        ChangelogBody.AddChild(new Control {
                            Margin = new Thickness(4)
                        });
                    }

                    if (read && !hasRead)
                    {
                        hasRead = true;

                        var upArrow =
                            _resourceCache.GetTexture("/Textures/Interface/Changelog/up_arrow.svg.192dpi.png");

                        var readDivider = new BoxContainer
                        {
                            Orientation = LayoutOrientation.Vertical
                        };

                        var hBox = new BoxContainer
                        {
                            Orientation         = LayoutOrientation.Horizontal,
                            HorizontalAlignment = HAlignment.Center,
                            Children            =
                            {
                                new TextureRect
                                {
                                    Texture = upArrow,
                                    ModulateSelfOverride = Color.FromHex("#888"),
                                    TextureScale         = (0.5f, 0.5f),
                                    Margin            = new Thickness(4, 3),
                                    VerticalAlignment = VAlignment.Bottom
                                },