public override void Build(U.UiBuilder <U.Panel.UPanel> builder) { // Capacity 9 will fit all modifiers and separators and the text StringBuilder text = new StringBuilder(capacity: 9); text.Append($"<color {UConst.SHORTCUT_TEXT_HEX}>"); 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("</color> "); text.Append(this.localizedText_); using (UiBuilder <ULabel> labelB = builder.Label <U.Label.ULabel>(text.ToString())) { labelB.Control.processMarkup = true; labelB.ResizeFunction( r => { r.Stack(mode: UStackMode.NewRowBelow); }); } }
public override void Build(U.UiBuilder <U.UPanel> builder) { StringBuilder text = new StringBuilder(); List <string> keybindStrings = this.keybindSetting_.ToLocalizedStringList(); bool firstShortcut = true; // tracking | separators between multiple keybinds using (UiBuilder <ULabel> labelB = builder.Label <U.ULabel>(string.Empty)) { labelB.Control.processMarkup = true; labelB.ResizeFunction( r => { r.Stack(mode: UStackMode.NewRowBelow); }); foreach (string keybindStr in keybindStrings) { if (!firstShortcut) { text.Append("| "); } else { firstShortcut = false; } text.Append($"<color {UConst.SHORTCUT_TEXT_HEX}>{keybindStr}</color>"); } text.Append(" "); text.Append(this.localizedText_); labelB.Control.text = text.ToString(); } }
public override void Build(U.UiBuilder <U.Panel.UPanel> builder) { using (UiBuilder <ULabel> labelB = builder.Label <U.Label.ULabel>(string.Empty)) { labelB.ResizeFunction(r => { r.Stack(mode: UStackMode.NewRowBelow); }); labelB.Control.text = this.localizedText_; labelB.Control.opacity = 0.8f; } }