1
0
forked from 0ad/0ad

Fix chat input not getting cleared when ESC is pressed

Allow chat messages to be sent internally (bypass chat input box)
Show chat message when the developer console is opened or closed.
(moved dev console back to the right side)

This was SVN commit r8376.
This commit is contained in:
WhiteTreePaladin 2010-10-16 19:49:48 +00:00
parent fe5bd12301
commit 86cb0db407
3 changed files with 22 additions and 2 deletions

View File

@ -18,6 +18,9 @@ function cacheMenuObjects()
function toggleDeveloperOverlay()
{
var text = devCommands.hidden? "opened." : "closed.";
submitChatDirectly("The Developer Console was " + text);
devCommands.hidden = !devCommands.hidden;
}
@ -57,9 +60,16 @@ function togglePause()
function escapeKeyAction() // runs multiple times, so always closes all for now...
{
if (!menu.hidden)
{
menu.hidden = true;
}
else if (!chatWindow.hidden)
{
chatWindow.hidden = true;
chatInput.caption = "";
}
else if (!settingsWindow.hidden)
{
settingsWindow.hidden = true;
}
}

View File

@ -95,6 +95,17 @@ function handleNetMessage(message)
}
}
function submitChatDirectly(text)
{
if (text.length)
{
if (g_IsNetworked)
Engine.SendNetworkChat(text);
else
addChatMessage({ "type": "message", "guid": "local", "text": text });
}
}
function submitChatInput()
{
var input = getGUIObjectByName("chatInput");
@ -118,7 +129,6 @@ function addChatMessage(msg)
{
// TODO: we ought to escape all values before displaying them,
// to prevent people inserting colours and newlines etc
var n = g_PlayerAssignments[msg.guid].player;
var username = g_PlayerAssignments[msg.guid].name;
var playerColor = g_Players[n].color.r + " " + g_Players[n].color.g + " " + g_Players[n].color.b;

View File

@ -96,7 +96,7 @@
/>
<!-- Dev/cheat commands -->
<object name="devCommands" size="16 44 156 172" type="image" sprite="devCommandsBackground"
<object name="devCommands" size="100%-156 72 100%-16 200" type="image" sprite="devCommandsBackground"
hidden="true" hotkey="session.devcommands.toggle">
<action on="Press">
this.hidden = !this.hidden;