[Client] Clean up GUIChat slightly

pull/366/head
David Cernat 7 years ago
parent a818140c14
commit 502df7d9c1

@ -52,7 +52,7 @@ namespace mwmp
{
// Give keyboard focus to the combo box whenever the console is
// turned on
SetEditState(0);
setEditState(0);
windowState = CHAT_ENABLED;
}
@ -61,7 +61,7 @@ namespace mwmp
// Apparently, hidden widgets can retain key focus
// Remove for MyGUI 3.2.2
windowState = CHAT_DISABLED;
SetEditState(0);
setEditState(0);
}
bool GUIChat::exit()
@ -79,7 +79,7 @@ namespace mwmp
if (cm.empty())
{
mCommandLine->setCaption("");
SetEditState(0);
setEditState(0);
return;
}
@ -96,7 +96,7 @@ namespace mwmp
// It prevents the re-triggering of the acceptCommand() event for the same command
// during the actual command execution
mCommandLine->setCaption("");
SetEditState(0);
setEditState(0);
send (cm);
}
@ -173,7 +173,7 @@ namespace mwmp
{
case CHAT_DISABLED:
this->mMainWidget->setVisible(false);
SetEditState(0);
setEditState(0);
break;
case CHAT_ENABLED:
this->mMainWidget->setVisible(true);
@ -184,7 +184,7 @@ namespace mwmp
}
}
void GUIChat::SetEditState(bool state)
void GUIChat::setEditState(bool state)
{
editState = state;
mCommandLine->setVisible(editState);
@ -195,17 +195,17 @@ namespace mwmp
{
if (windowState == CHAT_DISABLED)
return;
else if (windowState == CHAT_HIDDENMODE)
if (!mCommandLine->getVisible())
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat.");
if (windowState == CHAT_HIDDENMODE)
{
setVisible(true);
curTime = 0;
editState = true;
}
else // CHAT_ENABLED
editState = true;
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat.");
SetEditState(editState);
setEditState(true);
}
void GUIChat::keyPress(MyGUI::Widget *_sender, MyGUI::KeyCode key, MyGUI::Char _char)
@ -241,14 +241,14 @@ namespace mwmp
}
void GUIChat::Update(float dt)
void GUIChat::update(float dt)
{
if (windowState == CHAT_HIDDENMODE && !editState && isVisible())
{
curTime += dt;
if (curTime >= delay)
{
SetEditState(false);
setEditState(false);
this->mMainWidget->setVisible(false);
}
}

@ -41,7 +41,7 @@ namespace mwmp
void pressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED)
void setDelay(float delay);
void Update(float dt);
void update(float dt);
virtual void onOpen();
virtual void onClose();
@ -78,7 +78,7 @@ namespace mwmp
void acceptCommand(MyGUI::EditBox* _sender);
void SetEditState(bool state);
void setEditState(bool state);
int windowState;
bool editState;

@ -198,7 +198,7 @@ bool mwmp::GUIController::hasFocusedElement()
void mwmp::GUIController::update(float dt)
{
if (mChat != nullptr)
mChat->Update(dt);
mChat->update(dt);
// Make sure we read the pressed button without resetting it, because it may also get
// checked somewhere else

Loading…
Cancel
Save