public override void Build(UIComponent parent,
                                   U.UBuilder builder)
        {
            // Capacity 4 will fit color tags and modifier string and localised text
            var text            = new StringBuilder(capacity: 4);
            var modifierStrings = new List <string>(capacity: 3);

            text.Append(UConst.GetKeyboardShortcutColorTagOpener());

            if (this.shift_)
            {
                modifierStrings.Add(Translation.Options.Get("Shortcut.Modifier:Shift"));
            }

            if (this.ctrl_)
            {
                modifierStrings.Add(Translation.Options.Get("Shortcut.Modifier:Ctrl"));
            }

            if (this.alt_)
            {
                modifierStrings.Add(Translation.Options.Get("Shortcut.Modifier:Alt"));
            }

            text.Append(string.Join("+", modifierStrings.ToArray()));
            text.Append(UConst.KEYBOARD_SHORTCUT_CLOSING_TAG + " ");
            text.Append(this.localizedText_);

            builder.Label_(
                parent,
                t: text.ToString(),
                stack: UStackMode.NewRowBelow,
                processMarkup: true);
        }
        public override void Build(UIComponent parent,
                                   U.UBuilder builder)
        {
            StringBuilder text           = new StringBuilder();
            List <string> keybindStrings = this.keybindSetting_.ToLocalizedStringList();
            bool          firstShortcut  = true; // tracking | separators between multiple keybinds

            foreach (string keybindStr in keybindStrings)
            {
                if (!firstShortcut)
                {
                    text.Append("| ");
                }
                else
                {
                    firstShortcut = false;
                }

                text.Append(UConst.GetKeyboardShortcutColorTagOpener());
                text.Append(keybindStr);
                text.Append(UConst.KEYBOARD_SHORTCUT_CLOSING_TAG);
            }

            text.Append(" ");
            text.Append(this.localizedText_);

            builder.Label <U.ULabel>(
                parent,
                t: text.ToString(),
                stack: UStackMode.NewRowBelow,
                processMarkup: true);
        }
        public override void Build(UIComponent parent,
                                   U.UBuilder builder)
        {
            ULabel l = builder.Label <U.ULabel>(
                parent,
                this.localizedText_,
                stack: UStackMode.NewRowBelow,
                processMarkup: true);

            l.opacity = 0.8f;
        }
示例#4
0
        public override void Build(UIComponent parent,
                                   U.UBuilder builder)
        {
            // Capacity 9 will fit all modifiers and separators and the text
            StringBuilder text = new StringBuilder(capacity: 9);

            text.Append(UConst.GetKeyboardShortcutColorTagOpener());

            if (this.shift_)
            {
                text.Append(Translation.Options.Get("Shortcut.Modifier:Shift"));
                text.Append("+");
            }

            if (this.ctrl_)
            {
                text.Append(Translation.Options.Get("Shortcut.Modifier:Ctrl"));
                text.Append("+");
            }

            if (this.alt_)
            {
                text.Append(Translation.Options.Get("Shortcut.Modifier:Alt"));
                text.Append("+");
            }

            text.Append(TranslationForMouseButton(this.button_));
            text.Append(UConst.KEYBOARD_SHORTCUT_CLOSING_TAG + " ");
            text.Append(this.localizedText_);

            builder.Label <U.ULabel>(
                parent,
                t: text.ToString(),
                stack: UStackMode.NewRowBelow,
                processMarkup: true);
        }
 /// <summary>Called by the OnscreenDisplay to add the contents of this item.</summary>
 /// <param name="builder">UI builder used to populate the panel.</param>
 public abstract void Build(UIComponent parent,
                            U.UBuilder builder);