return TryGetShortKeyName(keyFunction, out var name) ? Loc.GetString(name) : " ";
}
+ public static bool IsBound(BoundKeyFunction keyFunction)
+ {
+ return TryGetShortKeyName(keyFunction, out _);
+ }
+
private static string? DefaultShortKeyName(BoundKeyFunction keyFunction)
{
var name = FormattedMessage.EscapeText(IoCManager.Resolve<IInputManager>().GetKeyFunctionButtonString(keyFunction));
Input = new HistoryLineEdit
{
Name = "Input",
- PlaceHolder = Loc.GetString("hud-chatbox-info", ("talk-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.FocusChat)), ("cycle-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.CycleChatChannelForward))),
+ PlaceHolder = GetChatboxInfoPlaceholder(),
HorizontalExpand = true,
StyleClasses = {"chatLineEdit"}
};
{
ActiveChannel = (ChatChannel) selectedChannel;
}
+
+ private static string GetChatboxInfoPlaceholder()
+ {
+ return (BoundKeyHelper.IsBound(ContentKeyFunctions.FocusChat), BoundKeyHelper.IsBound(ContentKeyFunctions.CycleChatChannelForward)) switch
+ {
+ (true, true) => Loc.GetString("hud-chatbox-info", ("talk-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.FocusChat)), ("cycle-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.CycleChatChannelForward))),
+ (true, false) => Loc.GetString("hud-chatbox-info-talk", ("talk-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.FocusChat))),
+ (false, true) => Loc.GetString("hud-chatbox-info-cycle", ("cycle-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.CycleChatChannelForward))),
+ (false, false) => Loc.GetString("hud-chatbox-info-unbound")
+ };
+ }
}
hud-chatbox-info = {$talk-key} to talk, {$cycle-key} to cycle channels.
+hud-chatbox-info-talk = {$talk-key} to talk.
+hud-chatbox-info-cycle = Click here to talk, {$cycle-key} to cycle channels.
+hud-chatbox-info-unbound = Click here to talk.
hud-chatbox-select-name-prefixed = {$prefix} {$name}
hud-chatbox-select-channel-Admin = Admin