Beispiel #1
0
        /// <summary>
        /// On Screen Display feature: Add a click info to the panel.
        /// </summary>
        /// <param name="localizedText">Text from Translation.Get() or English if doesn't exist.</param>
        public static void Click(bool shift, bool ctrl, bool alt, string localizedText)
        {
            MainMenuWindow mainMenu = ModUI.Instance.MainMenu;

            mainMenu.KeybindsPanel.isVisible = true;

            var builder = new UiBuilder <U.Panel.UPanel>(mainMenu.KeybindsPanel);

            using (var modifierLabel = builder.ModifierLabel(shift, ctrl, alt)) {
                modifierLabel.ResizeFunction(r => { r.Stack(UStackMode.NewRowBelow); });
            }

            using (var plusLabel = builder.Label <U.Label.ULabel>("+ ")) {
                plusLabel.ResizeFunction(r => { r.Stack(UStackMode.ToTheRight); });
            }

            string clickText = Translation.Options.Get("Shortcut:Click");

            using (var clickLabel = builder.Label <U.Label.ULabel>(clickText)) {
                clickLabel.Control.backgroundSprite = "GenericPanelDark";
                clickLabel.Control.textColor        = UConst.SHORTCUT_KEYBIND_TEXT;
                clickLabel.ResizeFunction(r => { r.Stack(UStackMode.ToTheRight); });
            }

            using (var descriptionLabel = builder.Label <U.Label.ULabel>(localizedText)) {
                descriptionLabel.ResizeFunction(
                    r => {
                    r.Stack(
                        mode: UStackMode.ToTheRight,
                        spacing: UConst.UIPADDING * 2f);     // double space
                });
            }
        }