Private chat hotkey.

Patch by: OptimusShepard
Differential Revision: https://code.wildfiregames.com/D163
Fixes #4422.

This was SVN commit r19272.
This commit is contained in:
elexis 2017-03-04 21:24:14 +00:00
parent 08fbf223f6
commit 0b20e8c5f0
7 changed files with 21 additions and 5 deletions

View File

@ -167,6 +167,7 @@ session.highlightguarded = PgUp ; Toggle highlight of guarded units
; > HOTKEYS ONLY
chat = Return ; Toggle chat window
teamchat = "T" ; Toggle chat window in team chat mode
privatechat = "L" ; Toggle chat window and select the previous private chat partner
; > QUICKSAVE
quicksave = "Shift+F5"

View File

@ -145,6 +145,7 @@
{"nick": "Offensive ePeen", "name": "Jared Ryan Bills"},
{"nick": "Ols", "name": "Oliver Whiteman"},
{"nick": "olsner", "name": "Simon Brenner"},
{"nick": "OptimusShepard", "name": "Pirmin Stanglmeier"},
{"nick": "otero"},
{"name": "Nick Owens"},
{"nick": "Palaxin", "name": "David A. Freitag"},

View File

@ -62,6 +62,7 @@ F12: Show/hide time elapsed counter
ESC: Close all dialogs (chat, menu) or clear selected units
Enter/return: Open/send chat
T: Send team chat
L: Chat with the previously selected private chat partner
Pause: Pause/resume the game
Delete: Delete currently selected units/buildings
Shift + Delete: Delete currently selected units/buildings without confirmation

View File

@ -5,11 +5,15 @@
</object>
<object hotkey="chat">
<action on="Press">openChat(false);</action>
<action on="Press">openChat();</action>
</object>
<object hotkey="teamchat">
<action on="Press">openChat(true);</action>
<action on="Press">openChat(g_IsObserver ? "/observers" : "/allies");</action>
</object>
<object hotkey="privatechat">
<action on="Press">openChat(g_LastChatAddressee);</action>
</object>
<object hotkey="menu.toggle">

View File

@ -203,7 +203,7 @@ function openOptions()
});
}
function openChat(teamChat = false)
function openChat(command = "")
{
if (g_Disconnected)
return;
@ -211,7 +211,6 @@ function openChat(teamChat = false)
closeOpenDialogs();
let chatAddressee = Engine.GetGUIObjectByName("chatAddressee");
let command = teamChat ? (g_IsObserver ? "/observers" : "/allies") : "";
chatAddressee.selected = chatAddressee.list_data.indexOf(command);
Engine.GetGUIObjectByName("chatInput").focus();

View File

@ -29,6 +29,11 @@ var g_ChatHistory = [];
*/
var g_ChatTimers = [];
/**
* Command to send to the previously selected private chat partner.
*/
var g_LastChatAddressee = "";
/**
* Handle all netmessage types that can occur.
*/
@ -750,6 +755,10 @@ function submitChatInput()
if (chatAddressee.selected > 0 && (text.indexOf("/") != 0 || text.indexOf("/me ") == 0))
text = chatAddressee.list_data[chatAddressee.selected] + " " + text;
let selectedChat = chatAddressee.list_data[chatAddressee.selected]
if (selectedChat.startsWith("/msg"))
g_LastChatAddressee = selectedChat;
submitChatDirectly(text);
}

View File

@ -387,7 +387,8 @@ function updateHotkeyTooltips()
"\n" + (g_IsObserver ?
translate("Press %(hotkey)s to open the observer chat.") :
translate("Press %(hotkey)s to open the ally chat.")),
"teamchat");
"teamchat") +
colorizeHotkey("\n" + translate("Press %(hotkey)s to open the previously selected private chat."), "privatechat");
Engine.GetGUIObjectByName("idleWorkerButton").tooltip =
colorizeHotkey("%(hotkey)s" + " ", "selection.idleworker") +