mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Replace POPUP_DISCONNECT(_DUMMY)
with generic confirmation popup
This commit is contained in:
parent
f4708a3a00
commit
620e3e56db
|
@ -1591,16 +1591,6 @@ int CMenus::Render()
|
|||
pTitle = Localize("Quit");
|
||||
pExtraText = Localize("Are you sure that you want to quit?");
|
||||
}
|
||||
else if(m_Popup == POPUP_DISCONNECT)
|
||||
{
|
||||
pTitle = Localize("Disconnect");
|
||||
pExtraText = Localize("Are you sure that you want to disconnect?");
|
||||
}
|
||||
else if(m_Popup == POPUP_DISCONNECT_DUMMY)
|
||||
{
|
||||
pTitle = Localize("Disconnect Dummy");
|
||||
pExtraText = Localize("Are you sure that you want to disconnect your dummy?");
|
||||
}
|
||||
else if(m_Popup == POPUP_FIRST_LAUNCH)
|
||||
{
|
||||
pTitle = Localize("Welcome to DDNet");
|
||||
|
@ -1756,50 +1746,6 @@ int CMenus::Render()
|
|||
Client()->Quit();
|
||||
}
|
||||
}
|
||||
else if(m_Popup == POPUP_DISCONNECT)
|
||||
{
|
||||
CUIRect Yes, No;
|
||||
Box.HSplitBottom(20.f, &Box, &Part);
|
||||
Box.HSplitBottom(24.f, &Box, &Part);
|
||||
|
||||
// buttons
|
||||
Part.VMargin(80.0f, &Part);
|
||||
Part.VSplitMid(&No, &Yes);
|
||||
Yes.VMargin(20.0f, &Yes);
|
||||
No.VMargin(20.0f, &No);
|
||||
|
||||
static CButtonContainer s_ButtonAbort;
|
||||
if(DoButton_Menu(&s_ButtonAbort, Localize("No"), 0, &No) || UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE))
|
||||
m_Popup = POPUP_NONE;
|
||||
|
||||
static CButtonContainer s_ButtonTryAgain;
|
||||
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || UI()->ConsumeHotkey(CUI::HOTKEY_ENTER))
|
||||
Client()->Disconnect();
|
||||
}
|
||||
else if(m_Popup == POPUP_DISCONNECT_DUMMY)
|
||||
{
|
||||
CUIRect Yes, No;
|
||||
Box.HSplitBottom(20.f, &Box, &Part);
|
||||
Box.HSplitBottom(24.f, &Box, &Part);
|
||||
|
||||
// buttons
|
||||
Part.VMargin(80.0f, &Part);
|
||||
Part.VSplitMid(&No, &Yes);
|
||||
Yes.VMargin(20.0f, &Yes);
|
||||
No.VMargin(20.0f, &No);
|
||||
|
||||
static CButtonContainer s_ButtonAbort;
|
||||
if(DoButton_Menu(&s_ButtonAbort, Localize("No"), 0, &No) || UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE))
|
||||
m_Popup = POPUP_NONE;
|
||||
|
||||
static CButtonContainer s_ButtonTryAgain;
|
||||
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || UI()->ConsumeHotkey(CUI::HOTKEY_ENTER))
|
||||
{
|
||||
Client()->DummyDisconnect(0);
|
||||
m_Popup = POPUP_NONE;
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
else if(m_Popup == POPUP_PASSWORD)
|
||||
{
|
||||
CUIRect Label, TextBox, TryAgain, Abort;
|
||||
|
|
|
@ -529,6 +529,8 @@ protected:
|
|||
|
||||
// found in menus_ingame.cpp
|
||||
void RenderGame(CUIRect MainView);
|
||||
void PopupConfirmDisconnect();
|
||||
void PopupConfirmDisconnectDummy();
|
||||
void RenderPlayers(CUIRect MainView);
|
||||
void RenderServerInfo(CUIRect MainView);
|
||||
void RenderServerControl(CUIRect MainView);
|
||||
|
@ -729,8 +731,6 @@ public:
|
|||
POPUP_SOUNDERROR,
|
||||
POPUP_PASSWORD,
|
||||
POPUP_QUIT,
|
||||
POPUP_DISCONNECT,
|
||||
POPUP_DISCONNECT_DUMMY,
|
||||
POPUP_WARNING,
|
||||
POPUP_SWITCH_SERVER,
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void CMenus::RenderGame(CUIRect MainView)
|
|||
{
|
||||
if(Client()->GetCurrentRaceTime() / 60 >= g_Config.m_ClConfirmDisconnectTime && g_Config.m_ClConfirmDisconnectTime >= 0)
|
||||
{
|
||||
m_Popup = POPUP_DISCONNECT;
|
||||
PopupConfirm(Localize("Disconnect"), Localize("Are you sure that you want to disconnect?"), Localize("Yes"), Localize("No"), &CMenus::PopupConfirmDisconnect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ void CMenus::RenderGame(CUIRect MainView)
|
|||
{
|
||||
if(Client()->GetCurrentRaceTime() / 60 >= g_Config.m_ClConfirmDisconnectTime && g_Config.m_ClConfirmDisconnectTime >= 0)
|
||||
{
|
||||
m_Popup = POPUP_DISCONNECT_DUMMY;
|
||||
PopupConfirm(Localize("Disconnect Dummy"), Localize("Are you sure that you want to disconnect your dummy?"), Localize("Yes"), Localize("No"), &CMenus::PopupConfirmDisconnectDummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -208,6 +208,17 @@ void CMenus::RenderGame(CUIRect MainView)
|
|||
}
|
||||
}
|
||||
|
||||
void CMenus::PopupConfirmDisconnect()
|
||||
{
|
||||
Client()->Disconnect();
|
||||
}
|
||||
|
||||
void CMenus::PopupConfirmDisconnectDummy()
|
||||
{
|
||||
Client()->DummyDisconnect(0);
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
void CMenus::RenderPlayers(CUIRect MainView)
|
||||
{
|
||||
CUIRect Button, Button2, ButtonBar, Options, Player;
|
||||
|
|
Loading…
Reference in a new issue