Disable wan buttons in init in case of connect-now going back

This commit is contained in:
Benau 2018-04-01 10:24:10 +08:00
parent 6b5a01755c
commit 47c679e398

View File

@ -50,12 +50,6 @@ OnlineProfileServers::OnlineProfileServers() : GUIEngine::Screen("online/profile
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void OnlineProfileServers::beforeAddingWidget() void OnlineProfileServers::beforeAddingWidget()
{ {
if (!PlayerManager::getCurrentOnlineId())
{
getWidget<IconButtonWidget>("find_wan_server")->setActive(false);
getWidget<IconButtonWidget>("create_wan_server")->setActive(false);
getWidget<IconButtonWidget>("quick_wan_play")->setActive(false);
}
#ifdef ANDROID #ifdef ANDROID
getWidget("create_wan_server")->setVisible(false); getWidget("create_wan_server")->setVisible(false);
#endif #endif
@ -65,10 +59,23 @@ void OnlineProfileServers::beforeAddingWidget()
void OnlineProfileServers::init() void OnlineProfileServers::init()
{ {
RibbonWidget* ribbon = getWidget<RibbonWidget>("wan"); if (!PlayerManager::getCurrentOnlineId())
assert(ribbon != NULL); {
ribbon->select("find_wan_server", PLAYER_ID_GAME_MASTER); getWidget("back")->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER); getWidget<IconButtonWidget>("find_wan_server")->setActive(false);
getWidget<IconButtonWidget>("create_wan_server")->setActive(false);
getWidget<IconButtonWidget>("quick_wan_play")->setActive(false);
}
else
{
getWidget<IconButtonWidget>("find_wan_server")->setActive(true);
getWidget<IconButtonWidget>("create_wan_server")->setActive(true);
getWidget<IconButtonWidget>("quick_wan_play")->setActive(true);
RibbonWidget* ribbon = getWidget<RibbonWidget>("wan");
assert(ribbon != NULL);
ribbon->select("find_wan_server", PLAYER_ID_GAME_MASTER);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
}
} // init } // init
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------