mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
deactivate player ignore setting if show just friends chat is active and player isn't a friend
This commit is contained in:
parent
4efd65359e
commit
e8f9145a0d
|
@ -94,14 +94,16 @@ int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect)
|
||||
int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GUIBUTTONS].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
if(!Active)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
RenderTools()->SelectSprite(Checked?SPRITE_GUIBUTTON_ON:SPRITE_GUIBUTTON_OFF);
|
||||
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
if((UI()->HotItem() == pID))
|
||||
if(UI()->HotItem() == pID && Active)
|
||||
{
|
||||
RenderTools()->SelectSprite(SPRITE_GUIBUTTON_HOVER);
|
||||
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
||||
|
@ -109,7 +111,7 @@ int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect)
|
|||
}
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
return UI()->DoButtonLogic(pID, "", Checked, pRect);
|
||||
return Active ? UI()->DoButtonLogic(pID, "", Checked, pRect) : 0;
|
||||
}
|
||||
|
||||
int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect)
|
||||
|
|
|
@ -40,7 +40,7 @@ class CMenus : public CComponent
|
|||
|
||||
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
int DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners);
|
||||
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect);
|
||||
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
|
||||
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners);
|
||||
|
||||
|
|
|
@ -183,15 +183,18 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
|||
ButtonBar.VSplitLeft(Width, &Button, &ButtonBar);
|
||||
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
|
||||
Button.VSplitLeft(Button.h, &Button, 0);
|
||||
if(DoButton_Toggle(&s_aPlayerIDs[Index][0], m_pClient->m_aClients[Index].m_ChatIgnore, &Button))
|
||||
m_pClient->m_aClients[Index].m_ChatIgnore ^= 1;
|
||||
if(&g_Config.m_ClShowChatFriends && !m_pClient->m_aClients[Index].m_Friend)
|
||||
DoButton_Toggle(&s_aPlayerIDs[Index][0], 1, &Button, false);
|
||||
else
|
||||
if(DoButton_Toggle(&s_aPlayerIDs[Index][0], m_pClient->m_aClients[Index].m_ChatIgnore, &Button, true))
|
||||
m_pClient->m_aClients[Index].m_ChatIgnore ^= 1;
|
||||
|
||||
// friend button
|
||||
ButtonBar.VSplitLeft(20.0f, &Button, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(Width, &Button, &ButtonBar);
|
||||
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
|
||||
Button.VSplitLeft(Button.h, &Button, 0);
|
||||
if(DoButton_Toggle(&s_aPlayerIDs[Index][1], m_pClient->m_aClients[Index].m_Friend, &Button))
|
||||
if(DoButton_Toggle(&s_aPlayerIDs[Index][1], m_pClient->m_aClients[Index].m_Friend, &Button, true))
|
||||
{
|
||||
if(m_pClient->m_aClients[Index].m_Friend)
|
||||
m_pClient->Friends()->RemoveFriend(m_pClient->m_aClients[Index].m_aName, m_pClient->m_aClients[Index].m_aClan);
|
||||
|
|
Loading…
Reference in a new issue