mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-10-07 03:26:31 +00:00
[Client] Clean up GUIChat slightly
This commit is contained in:
parent
a818140c14
commit
502df7d9c1
3 changed files with 17 additions and 17 deletions
|
@ -52,7 +52,7 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
// Give keyboard focus to the combo box whenever the console is
|
// Give keyboard focus to the combo box whenever the console is
|
||||||
// turned on
|
// turned on
|
||||||
SetEditState(0);
|
setEditState(0);
|
||||||
windowState = CHAT_ENABLED;
|
windowState = CHAT_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace mwmp
|
||||||
// Apparently, hidden widgets can retain key focus
|
// Apparently, hidden widgets can retain key focus
|
||||||
// Remove for MyGUI 3.2.2
|
// Remove for MyGUI 3.2.2
|
||||||
windowState = CHAT_DISABLED;
|
windowState = CHAT_DISABLED;
|
||||||
SetEditState(0);
|
setEditState(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GUIChat::exit()
|
bool GUIChat::exit()
|
||||||
|
@ -79,7 +79,7 @@ namespace mwmp
|
||||||
if (cm.empty())
|
if (cm.empty())
|
||||||
{
|
{
|
||||||
mCommandLine->setCaption("");
|
mCommandLine->setCaption("");
|
||||||
SetEditState(0);
|
setEditState(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ namespace mwmp
|
||||||
// It prevents the re-triggering of the acceptCommand() event for the same command
|
// It prevents the re-triggering of the acceptCommand() event for the same command
|
||||||
// during the actual command execution
|
// during the actual command execution
|
||||||
mCommandLine->setCaption("");
|
mCommandLine->setCaption("");
|
||||||
SetEditState(0);
|
setEditState(0);
|
||||||
send (cm);
|
send (cm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
case CHAT_DISABLED:
|
case CHAT_DISABLED:
|
||||||
this->mMainWidget->setVisible(false);
|
this->mMainWidget->setVisible(false);
|
||||||
SetEditState(0);
|
setEditState(0);
|
||||||
break;
|
break;
|
||||||
case CHAT_ENABLED:
|
case CHAT_ENABLED:
|
||||||
this->mMainWidget->setVisible(true);
|
this->mMainWidget->setVisible(true);
|
||||||
|
@ -184,7 +184,7 @@ namespace mwmp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::SetEditState(bool state)
|
void GUIChat::setEditState(bool state)
|
||||||
{
|
{
|
||||||
editState = state;
|
editState = state;
|
||||||
mCommandLine->setVisible(editState);
|
mCommandLine->setVisible(editState);
|
||||||
|
@ -195,17 +195,17 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
if (windowState == CHAT_DISABLED)
|
if (windowState == CHAT_DISABLED)
|
||||||
return;
|
return;
|
||||||
else if (windowState == CHAT_HIDDENMODE)
|
|
||||||
|
if (!mCommandLine->getVisible())
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat.");
|
||||||
|
|
||||||
|
if (windowState == CHAT_HIDDENMODE)
|
||||||
{
|
{
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
curTime = 0;
|
curTime = 0;
|
||||||
editState = true;
|
|
||||||
}
|
}
|
||||||
else // CHAT_ENABLED
|
|
||||||
editState = true;
|
|
||||||
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat.");
|
setEditState(true);
|
||||||
SetEditState(editState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::keyPress(MyGUI::Widget *_sender, MyGUI::KeyCode key, MyGUI::Char _char)
|
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())
|
if (windowState == CHAT_HIDDENMODE && !editState && isVisible())
|
||||||
{
|
{
|
||||||
curTime += dt;
|
curTime += dt;
|
||||||
if (curTime >= delay)
|
if (curTime >= delay)
|
||||||
{
|
{
|
||||||
SetEditState(false);
|
setEditState(false);
|
||||||
this->mMainWidget->setVisible(false);
|
this->mMainWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace mwmp
|
||||||
void pressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED)
|
void pressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED)
|
||||||
void setDelay(float delay);
|
void setDelay(float delay);
|
||||||
|
|
||||||
void Update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
virtual void onOpen();
|
virtual void onOpen();
|
||||||
virtual void onClose();
|
virtual void onClose();
|
||||||
|
@ -78,7 +78,7 @@ namespace mwmp
|
||||||
|
|
||||||
void acceptCommand(MyGUI::EditBox* _sender);
|
void acceptCommand(MyGUI::EditBox* _sender);
|
||||||
|
|
||||||
void SetEditState(bool state);
|
void setEditState(bool state);
|
||||||
|
|
||||||
int windowState;
|
int windowState;
|
||||||
bool editState;
|
bool editState;
|
||||||
|
|
|
@ -198,7 +198,7 @@ bool mwmp::GUIController::hasFocusedElement()
|
||||||
void mwmp::GUIController::update(float dt)
|
void mwmp::GUIController::update(float dt)
|
||||||
{
|
{
|
||||||
if (mChat != nullptr)
|
if (mChat != nullptr)
|
||||||
mChat->Update(dt);
|
mChat->update(dt);
|
||||||
|
|
||||||
// Make sure we read the pressed button without resetting it, because it may also get
|
// Make sure we read the pressed button without resetting it, because it may also get
|
||||||
// checked somewhere else
|
// checked somewhere else
|
||||||
|
|
Loading…
Reference in a new issue