Implements a more standardized way to format usual UI pages by having the ability to utilize the UINavigation namespace for page stack navigation

Also fixes behavior handling of menu input buttons not refreshing reliably
Adds ability to define a control on a MenuList to act as a highlighter over the currently selected control
Cleaned up BaseUI pages to use UINavigation which reduced a lot of duplication of elements and code
This commit is contained in:
JeffR 2022-05-06 23:39:16 -05:00
parent 22db2d4291
commit 41add628ad
20 changed files with 811 additions and 1217 deletions

View file

@ -1,26 +1,17 @@
function JoinServerMenu::onWake(%this)
{
JoinServerButtonHolder.setActive();
JoinServerList.setAsActiveMenuList();
JoinServerMenuInputHandler.setFirstResponder();
}
function JoinServerButtonHolder::onWake(%this)
function JoinServerMenu::onOpen(%this)
{
%this-->joinButton.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
%this-->backButton.set("btn_b", "Escape", "Back", "JoinServerMenu.backOut();");
%this-->refreshButton.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
%this-->queryLANButton.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
%this-->queryInternetButton.set("btn_x", "E", "Query Online", "JoinServerMenu.query();");
}
JoinServerList.setAsActiveMenuList();
function JoinServerMenuInputHandler::onInputEvent(%this, %device, %action, %state)
{
if(%state)
$activeMenuButtonContainer.processInputs(%device, %action);
$activeMenuButtonContainer-->button1.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
$activeMenuButtonContainer-->button2.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
$activeMenuButtonContainer-->button3.set("btn_x", "E", "Query Online", "JoinServerMenu.query();");
$activeMenuButtonContainer-->button4.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "cancelServerQuery(); " @ %this @ ".navigation.popPage();");
}
//----------------------------------------
@ -79,7 +70,7 @@ function JoinServerMenu::join(%this)
function JoinServerMenu::refresh(%this)
{
cancelServerQuery();
%index= JS_serverList.getSelectedId();
%index= JoinServerList.getActiveRow();
// The server info index is stored in the row along with the
// rest of displayed info.
@ -93,16 +84,6 @@ function JoinServerMenu::refreshSelectedServer( %this )
querySingleServer( $JoinGameAddress, 0 );
}
//----------------------------------------
function JoinServerMenu::backOut(%this)
{
cancelServerQuery();
Canvas.popDialog(JoinServerMenu);
if(isObject(JoinServerMenu.returnGui) && JoinServerMenu.returnGui.isMethod("onReturnTo"))
JoinServerMenu.returnGui.onReturnTo();
}
//----------------------------------------
function JoinServerMenu::update(%this)
{
@ -124,7 +105,7 @@ function JoinServerMenu::update(%this)
JoinServerList.add(%serverBtn);
}
JoinServerButtonHolder-->joinButton.setActive(JoinServerList.getCount() > 0);
$activeMenuButtonContainer-->button4.setActive(JoinServerList.getCount() > 0);
}
//----------------------------------------