Esempio n. 1
0
        /// <summary>
        /// On Screen Display feature: Add another keybind to the panel.
        /// </summary>
        /// <param name="kbSetting">KeybindSetting to show.</param>
        /// <param name="localizedText">Text from Translation.Get() or English if doesn't exist.</param>
        public static void Shortcut(KeybindSetting kbSetting, string localizedText)
        {
            MainMenuWindow mainMenu = ModUI.Instance.MainMenu;

            mainMenu.KeybindsPanel.isVisible = true;

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

            using (var shortcutLabel = builder.ShortcutLabel(kbSetting)) {
                shortcutLabel.ResizeFunction(r => { r.Stack(UStackMode.NewRowBelow); });
            }

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