mirror of
https://github.com/ddnet/ddnet.git
synced 2024-10-29 12:18:19 +00:00
Merge pull request #9157 from Robyt3/Client-Settings-Skin-Reveal
Scroll to selected skin when entering name and switching tabs
This commit is contained in:
commit
baddafefa0
|
@ -95,6 +95,7 @@ class CMenus : public CComponent
|
|||
void DoJoystickBar(const CUIRect *pRect, float Current, float Tolerance, bool Active);
|
||||
|
||||
bool m_SkinListNeedsUpdate = false;
|
||||
bool m_SkinListScrollToSelected = false;
|
||||
|
||||
int m_DirectionQuadContainerIndex;
|
||||
|
||||
|
|
|
@ -459,12 +459,14 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
if(DoButton_MenuTab(&s_PlayerTabButton, Localize("Player"), !m_Dummy, &PlayerTab, IGraphics::CORNER_L, nullptr, nullptr, nullptr, nullptr, 4.0f))
|
||||
{
|
||||
m_Dummy = false;
|
||||
m_SkinListScrollToSelected = true;
|
||||
}
|
||||
|
||||
static CButtonContainer s_DummyTabButton;
|
||||
if(DoButton_MenuTab(&s_DummyTabButton, Localize("Dummy"), m_Dummy, &DummyTab, IGraphics::CORNER_R, nullptr, nullptr, nullptr, nullptr, 4.0f))
|
||||
{
|
||||
m_Dummy = true;
|
||||
m_SkinListScrollToSelected = true;
|
||||
}
|
||||
|
||||
if(Client()->State() == IClient::STATE_ONLINE && m_pClient->m_NextChangeInfo && m_pClient->m_NextChangeInfo > Client()->GameTick(g_Config.m_ClDummy))
|
||||
|
@ -611,6 +613,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
if(Ui()->DoClearableEditBox(&s_SkinInput, &Button, 14.0f))
|
||||
{
|
||||
SetNeedSendInfo();
|
||||
m_SkinListScrollToSelected = true;
|
||||
}
|
||||
|
||||
// Random skin button
|
||||
|
@ -762,7 +765,14 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
{
|
||||
const CSkin *pSkinToBeDraw = s_vSkinList[i].m_pSkin;
|
||||
if(str_comp(pSkinToBeDraw->GetName(), pSkinName) == 0)
|
||||
{
|
||||
OldSelected = i;
|
||||
if(m_SkinListScrollToSelected)
|
||||
{
|
||||
s_ListBox.ScrollToSelected();
|
||||
m_SkinListScrollToSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
const CListboxItem Item = s_ListBox.DoNextItem(pSkinToBeDraw, OldSelected >= 0 && (size_t)OldSelected == i);
|
||||
if(!Item.m_Visible)
|
||||
|
|
Loading…
Reference in a new issue