mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
close the emote selector, chat history and the scoreboard when closing the chat, console or ingame menu. Closes #111
This commit is contained in:
parent
d913af1ab2
commit
e226b47212
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -565,6 +565,7 @@ void CGameConsole::Toggle(int Type)
|
|||
{
|
||||
Input()->MouseModeRelative();
|
||||
m_pClient->m_pMenus->UseMouseButtons(true);
|
||||
m_pClient->OnRelease();
|
||||
m_ConsoleState = CONSOLE_CLOSING;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ void CEmoticon::OnReset()
|
|||
m_SelectedEmote = -1;
|
||||
}
|
||||
|
||||
void CEmoticon::OnRelease()
|
||||
{
|
||||
m_Active = false;
|
||||
}
|
||||
|
||||
void CEmoticon::OnMessage(int MsgType, void *pRawMsg)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
virtual void OnReset();
|
||||
virtual void OnConsoleInit();
|
||||
virtual void OnRender();
|
||||
virtual void OnRelease();
|
||||
|
||||
bool Active();
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue