close the emote selector, chat history and the scoreboard when closing the chat, console or ingame menu. Closes #111

This commit is contained in:
oy 2010-09-12 12:43:03 +02:00
parent d913af1ab2
commit e226b47212
11 changed files with 43 additions and 3 deletions

View file

@ -35,6 +35,7 @@ public:
virtual void OnInit() {};
virtual void OnReset() {};
virtual void OnRender() {};
virtual void OnRelease() {};
virtual void OnMapLoad() {};
virtual void OnMessage(int Msg, void *pRawMsg) {}
virtual bool OnMouseMove(float x, float y) { return false; }

View file

@ -33,6 +33,11 @@ void CChat::OnReset()
m_Show = false;
}
void CChat::OnRelease()
{
m_Show = false;
}
void CChat::OnStateChange(int NewState, int OldState)
{
if(OldState <= IClient::STATE_CONNECTING)
@ -84,12 +89,16 @@ bool CChat::OnInput(IInput::CEvent e)
return false;
if(e.m_Flags&IInput::FLAG_PRESS && e.m_Key == KEY_ESCAPE)
{
m_Mode = MODE_NONE;
m_pClient->OnRelease();
}
else if(e.m_Flags&IInput::FLAG_PRESS && (e.m_Key == KEY_RETURN || e.m_Key == KEY_KP_ENTER))
{
if(m_Input.GetString()[0])
Say(m_Mode == MODE_ALL ? 0 : 1, m_Input.GetString());
m_Mode = MODE_NONE;
m_pClient->OnRelease();
}
else
m_Input.ProcessInput(e);

View file

@ -56,6 +56,7 @@ public:
virtual void OnConsoleInit();
virtual void OnStateChange(int NewState, int OldState);
virtual void OnRender();
virtual void OnRelease();
virtual void OnMessage(int MsgType, void *pRawMsg);
virtual bool OnInput(IInput::CEvent Event);
};

View file

@ -565,6 +565,7 @@ void CGameConsole::Toggle(int Type)
{
Input()->MouseModeRelative();
m_pClient->m_pMenus->UseMouseButtons(true);
m_pClient->OnRelease();
m_ConsoleState = CONSOLE_CLOSING;
}
}

View file

@ -39,6 +39,11 @@ void CEmoticon::OnReset()
m_SelectedEmote = -1;
}
void CEmoticon::OnRelease()
{
m_Active = false;
}
void CEmoticon::OnMessage(int MsgType, void *pRawMsg)
{
}

View file

@ -22,6 +22,7 @@ public:
virtual void OnReset();
virtual void OnConsoleInit();
virtual void OnRender();
virtual void OnRelease();
virtual void OnMessage(int MsgType, void *pRawMsg);
virtual bool OnMouseMove(float x, float y);

View file

@ -1015,10 +1015,18 @@ int CMenus::Render()
void CMenus::SetActive(bool Active)
{
m_MenuActive = Active;
if(!m_MenuActive && m_NeedSendinfo)
if(!m_MenuActive)
{
m_pClient->SendInfo(false);
m_NeedSendinfo = false;
if(m_NeedSendinfo)
{
m_pClient->SendInfo(false);
m_NeedSendinfo = false;
}
if(Client()->State() == IClient::STATE_ONLINE)
{
m_pClient->OnRelease();
}
}
}

View file

@ -27,6 +27,11 @@ void CScoreboard::OnReset()
m_Active = false;
}
void CScoreboard::OnRelease()
{
m_Active = false;
}
void CScoreboard::OnConsoleInit()
{
Console()->Register("+scoreboard", "", CFGFLAG_CLIENT, ConKeyScoreboard, this, "Show scoreboard");

View file

@ -18,6 +18,7 @@ public:
virtual void OnReset();
virtual void OnConsoleInit();
virtual void OnRender();
virtual void OnRelease();
bool Active();
};

View file

@ -471,6 +471,13 @@ void CGameClient::OnRender()
}
}
void CGameClient::OnRelease()
{
// release all systems
for(int i = 0; i < m_All.m_Num; i++)
m_All.m_paComponents[i]->OnRelease();
}
void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
{

View file

@ -167,6 +167,7 @@ public:
// hooks
virtual void OnConnected();
virtual void OnRender();
virtual void OnRelease();
virtual void OnInit();
virtual void OnConsoleInit();
virtual void OnStateChange(int NewState, int OldState);