mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Double click works on votes (and vote window disappears after server setting vote)
This commit is contained in:
parent
c473689be7
commit
b495b1681c
|
@ -251,8 +251,8 @@ class CMenus : public CComponent
|
|||
void RenderPlayers(CUIRect MainView);
|
||||
void RenderServerInfo(CUIRect MainView);
|
||||
void RenderServerControl(CUIRect MainView);
|
||||
void RenderServerControlKick(CUIRect MainView, bool FilterSpectators);
|
||||
void RenderServerControlServer(CUIRect MainView);
|
||||
bool RenderServerControlKick(CUIRect MainView, bool FilterSpectators);
|
||||
bool RenderServerControlServer(CUIRect MainView);
|
||||
|
||||
// found in menus_browser.cpp
|
||||
int m_SelectedIndex;
|
||||
|
|
|
@ -589,6 +589,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected)
|
|||
{
|
||||
gs_ListBoxDoneEvents = 1;
|
||||
|
||||
|
||||
if(m_EnterPressed || (UI()->ActiveItem() == pId && Input()->MouseDoubleClick()))
|
||||
{
|
||||
gs_ListBoxItemActivated = true;
|
||||
|
|
|
@ -452,7 +452,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
|||
TextRender()->Text(0, Motd.x+x, Motd.y+y, 16, m_pClient->m_pMotd->m_aServerMotd, (int)Motd.w);
|
||||
}
|
||||
|
||||
void CMenus::RenderServerControlServer(CUIRect MainView)
|
||||
bool CMenus::RenderServerControlServer(CUIRect MainView)
|
||||
{
|
||||
static int s_VoteList = 0;
|
||||
static float s_ScrollValue = 0;
|
||||
|
@ -493,12 +493,14 @@ void CMenus::RenderServerControlServer(CUIRect MainView)
|
|||
NumVoteOptions++;
|
||||
}
|
||||
|
||||
s_CurVoteOption = UiDoListboxEnd(&s_ScrollValue, 0);
|
||||
bool Call;
|
||||
s_CurVoteOption = UiDoListboxEnd(&s_ScrollValue, &Call);
|
||||
if(s_CurVoteOption < Total)
|
||||
m_CallvoteSelectedOption = aIndices[s_CurVoteOption];
|
||||
return Call;
|
||||
}
|
||||
|
||||
void CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
|
||||
bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
|
||||
{
|
||||
int NumOptions = 0;
|
||||
int Selected = -1;
|
||||
|
@ -544,8 +546,10 @@ void CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
|
|||
}
|
||||
}
|
||||
|
||||
Selected = UiDoListboxEnd(&s_ScrollValue, 0);
|
||||
bool Call;
|
||||
Selected = UiDoListboxEnd(&s_ScrollValue, &Call);
|
||||
m_CallvoteSelectedPlayer = Selected != -1 ? aPlayerIDs[Selected] : -1;
|
||||
return Call;
|
||||
}
|
||||
|
||||
void CMenus::RenderServerControl(CUIRect MainView)
|
||||
|
@ -594,12 +598,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
MainView.HSplitBottom(ms_ButtonHeight + 5*2, &MainView, &Bottom);
|
||||
Bottom.HMargin(5.0f, &Bottom);
|
||||
|
||||
bool Call = false;
|
||||
if(s_ControlPage == 0)
|
||||
RenderServerControlServer(MainView);
|
||||
Call = RenderServerControlServer(MainView);
|
||||
else if(s_ControlPage == 1)
|
||||
RenderServerControlKick(MainView, false);
|
||||
Call = RenderServerControlKick(MainView, false);
|
||||
else if(s_ControlPage == 2)
|
||||
RenderServerControlKick(MainView, true);
|
||||
Call = RenderServerControlKick(MainView, true);
|
||||
|
||||
// vote menu
|
||||
{
|
||||
|
@ -638,10 +643,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
Bottom.VSplitRight(120.0f, &Bottom, &Button);
|
||||
|
||||
static int s_CallVoteButton = 0;
|
||||
if(DoButton_Menu(&s_CallVoteButton, Localize("Call vote"), 0, &Button))
|
||||
if(DoButton_Menu(&s_CallVoteButton, Localize("Call vote"), 0, &Button) || Call)
|
||||
{
|
||||
if(s_ControlPage == 0)
|
||||
{
|
||||
m_pClient->m_pVoting->CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason);
|
||||
SetActive(false);
|
||||
}
|
||||
else if(s_ControlPage == 1)
|
||||
{
|
||||
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
|
||||
|
|
Loading…
Reference in a new issue