Chat channel switching improvements (#4000)
* IC is default when joining; switch to IC channel if IC channel becomes unavailable before trying OOC * Allow channel cycling while the textbox is focused * Fix focus channel keybinds not actually focusing * Whitespess * Fix duplicate radio * Smol CycleChatChannel cleanup * Revert style change
This commit is contained in:
@@ -79,10 +79,10 @@ namespace Content.Client.State
|
||||
InputCmdHandler.FromDelegate(_ => FocusChannel(_gameChat, ChatChannel.AdminChat)));
|
||||
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelForward,
|
||||
InputCmdHandler.FromDelegate(_ => CycleChatChannel(_gameChat, true)));
|
||||
InputCmdHandler.FromDelegate(_ => _gameChat.CycleChatChannel(true)));
|
||||
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelBackward,
|
||||
InputCmdHandler.FromDelegate(_ => CycleChatChannel(_gameChat, false)));
|
||||
InputCmdHandler.FromDelegate(_ => _gameChat.CycleChatChannel(false)));
|
||||
|
||||
SetupPresenters();
|
||||
|
||||
@@ -136,27 +136,9 @@ namespace Content.Client.State
|
||||
return;
|
||||
}
|
||||
|
||||
chat.Input.IgnoreNext = true;
|
||||
chat.SelectChannel(channel);
|
||||
}
|
||||
|
||||
internal static void CycleChatChannel(ChatBox chat, bool forward)
|
||||
{
|
||||
chat.Input.IgnoreNext = true;
|
||||
var channels = chat.SelectableChannels;
|
||||
var idx = channels.IndexOf(chat.SelectedChannel);
|
||||
if (forward)
|
||||
{
|
||||
idx++;
|
||||
idx = MathHelper.Mod(idx, channels.Count());
|
||||
}
|
||||
else
|
||||
{
|
||||
idx--;
|
||||
idx = MathHelper.Mod(idx, channels.Count());
|
||||
}
|
||||
|
||||
chat.SelectChannel(channels[idx]);
|
||||
chat.Input.GrabKeyboardFocus();
|
||||
}
|
||||
|
||||
public override void FrameUpdate(FrameEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user