Arrow left and right in browser (internet/lan/favorites)

Closed #9038
This commit is contained in:
ChillerDragon 2024-09-30 14:44:22 +08:00
parent 8da5957ef0
commit 2b0fb83140

View file

@ -660,6 +660,27 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState)
} }
GameClient()->m_Tooltips.DoToolTip(&s_FavoritesButton, &Button, Localize("Favorites")); GameClient()->m_Tooltips.DoToolTip(&s_FavoritesButton, &Button, Localize("Favorites"));
int MaxPage = PAGE_FAVORITES + ServerBrowser()->FavoriteCommunities().size();
if(
!Ui()->IsPopupOpen() &&
CLineInput::GetActiveInput() == nullptr &&
(g_Config.m_UiPage >= PAGE_INTERNET && g_Config.m_UiPage <= MaxPage) &&
(m_MenuPage >= PAGE_INTERNET && m_MenuPage <= PAGE_FAVORITE_COMMUNITY_5))
{
if(Input()->KeyPress(KEY_RIGHT))
{
NewPage = g_Config.m_UiPage + 1;
if(NewPage > MaxPage)
NewPage = PAGE_INTERNET;
}
if(Input()->KeyPress(KEY_LEFT))
{
NewPage = g_Config.m_UiPage - 1;
if(NewPage < PAGE_INTERNET)
NewPage = MaxPage;
}
}
size_t FavoriteCommunityIndex = 0; size_t FavoriteCommunityIndex = 0;
static CButtonContainer s_aFavoriteCommunityButtons[5]; static CButtonContainer s_aFavoriteCommunityButtons[5];
static_assert(std::size(s_aFavoriteCommunityButtons) == (size_t)PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1); static_assert(std::size(s_aFavoriteCommunityButtons) == (size_t)PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1);