mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-19 19:35:26 +00:00
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:
parent
22db2d4291
commit
41add628ad
20 changed files with 811 additions and 1217 deletions
|
|
@ -72,16 +72,7 @@ function OptionsMenu::onAdd(%this)
|
|||
callOnModules("populateOptionsMenuCategories", "Game");
|
||||
}
|
||||
|
||||
function OptionsMenuSettingsList::onAdd(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function OptionsMenuSettingsList::getOptionsList(%this, %index)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function OptionsMenu::onWake(%this)
|
||||
function OptionsMenu::onOpen(%this)
|
||||
{
|
||||
OptionsMenuCategoryList.clear();
|
||||
|
||||
|
|
@ -116,22 +107,48 @@ function OptionsMenu::onWake(%this)
|
|||
|
||||
%this.unappliedChanges.empty();
|
||||
|
||||
MainMenuButtonList.hidden = true;
|
||||
|
||||
OptionsMenuCategoryList.setAsActiveMenuList();
|
||||
|
||||
OptionsButtonHolder.setActive();
|
||||
$activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
|
||||
$activeMenuButtonContainer-->button1.disable();
|
||||
$activeMenuButtonContainer-->button3.set("", "Space", "Apply", "OptionsMenu.apply();");
|
||||
$activeMenuButtonContainer-->button4.set("btn_a", "", "Select", "OptionsMenu.select();");
|
||||
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
|
||||
}
|
||||
|
||||
OptionsMenuInputHandler.setFirstResponder();
|
||||
function OptionsMenu::canClose(%this)
|
||||
{
|
||||
if(OptionsMenuSettingsList.isActiveMenuList())
|
||||
{
|
||||
OptionsMenuCategoryList.setAsActiveMenuList();
|
||||
%this.updateSelectButton();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%this.unappliedChanges.count() != 0)
|
||||
{
|
||||
MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?",
|
||||
"OptionsMenu.apply(); MainMenuGUI.popPage();", "%this.unappliedChanges.empty(); " @ %this @ ".navigation.popPage();",
|
||||
"Apply", "Discard");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function OptionsButtonHolder::onWake(%this)
|
||||
function OptionsMenu::onClose(%this)
|
||||
{
|
||||
%this-->resetButton.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
|
||||
%this-->selectButton.set("btn_a", "Return", "Select", "OptionsMenu.select();", true);
|
||||
%this-->backButton.set("btn_b", "Escape", "Back", "OptionsMenu.backOut();");
|
||||
|
||||
//OptionsMenuCategoryList.getObject(0).performClick();
|
||||
}
|
||||
|
||||
function OptionsMenuSettingsList::onAdd(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function OptionsMenuSettingsList::getOptionsList(%this, %index)
|
||||
{
|
||||
}
|
||||
|
||||
function OptionsMenu::select(%this)
|
||||
|
|
@ -281,9 +298,6 @@ function OptionsMenu::apply(%this)
|
|||
export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
|
||||
|
||||
OptionsMenu.unappliedChanges.empty();
|
||||
|
||||
//Now we can back out of the options menu
|
||||
OptionsMenu.doOptionsMenuBackOut();
|
||||
}
|
||||
|
||||
function OptionsMenu::resetToDefaults(%this)
|
||||
|
|
@ -346,7 +360,9 @@ function populateDisplaySettingsList()
|
|||
|
||||
OptionsMenu.currentCategory = "Display";
|
||||
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText("");
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText("");
|
||||
|
||||
%apiList = "";
|
||||
|
|
@ -433,7 +449,9 @@ function populateGraphicsSettingsList()
|
|||
|
||||
OptionsMenu.currentCategory = "Graphics";
|
||||
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText("");
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText("");
|
||||
|
||||
%yesNoList = "No\tYes";
|
||||
|
|
@ -598,7 +616,9 @@ function populateAudioSettingsList()
|
|||
|
||||
OptionsMenu.currentCategory = "Audio";
|
||||
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText("");
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText("");
|
||||
|
||||
%buffer = sfxGetAvailableDevices();
|
||||
|
|
@ -691,7 +711,9 @@ function populateKeyboardMouseSettingsList()
|
|||
|
||||
OptionsMenu.currentCategory = "Keyboard & Mouse";
|
||||
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText("");
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText("");
|
||||
|
||||
$remapListDevice = "keyboard";
|
||||
|
|
@ -706,7 +728,9 @@ function populateGamepadSettingsList()
|
|||
|
||||
OptionsMenu.currentCategory = "Gamepad";
|
||||
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText("");
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText("");
|
||||
|
||||
$remapListDevice = "gamepad";
|
||||
|
|
@ -723,48 +747,6 @@ function OptionsMenuList::activateRow(%this)
|
|||
OptionsMenuSettingsList.setFirstResponder();
|
||||
}
|
||||
|
||||
function OptionsMenu::backOut(%this)
|
||||
{
|
||||
if(OptionsMenuSettingsList.isActiveMenuList())
|
||||
{
|
||||
OptionsMenuCategoryList.setAsActiveMenuList();
|
||||
%this.updateSelectButton();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%this.unappliedChanges.count() != 0)
|
||||
{
|
||||
MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", "OptionsMenu.apply();", "OptionsMenu.doOptionsMenuBackOut();", "Apply", "Discard");
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.doOptionsMenuBackOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OptionsMenu::doOptionsMenuBackOut(%this)
|
||||
{
|
||||
//save the settings and then back out
|
||||
if(OptionsMain.hidden == false)
|
||||
{
|
||||
//we're not in a specific menu, so we're actually exiting
|
||||
Canvas.popDialog(OptionsMenu);
|
||||
|
||||
if(isObject(OptionsMenu.returnGui) && OptionsMenu.returnGui.isMethod("onReturnTo"))
|
||||
OptionsMenu.returnGui.onReturnTo();
|
||||
}
|
||||
else
|
||||
{
|
||||
OptionsMain.hidden = false;
|
||||
ControlsMenu.hidden = true;
|
||||
GraphicsMenu.hidden = true;
|
||||
CameraMenu.hidden = true;
|
||||
AudioMenu.hidden = true;
|
||||
ScreenBrightnessMenu.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
|
||||
{
|
||||
%option = %this.getObject(%row);
|
||||
|
|
@ -955,16 +937,25 @@ function getDisplayDeviceName()
|
|||
//
|
||||
function MenuOptionsButton::onMouseEnter(%this)
|
||||
{
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText(%this.getLabel());
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText(%this.getToolTip());
|
||||
}
|
||||
|
||||
function MenuOptionsButton::onMouseLeave(%this)
|
||||
{
|
||||
if(isObject(OptionName))
|
||||
OptionName.setText("");
|
||||
if(isObject(OptionDescription))
|
||||
OptionDescription.setText("");
|
||||
}
|
||||
|
||||
function MenuOptionsButton::onHighlighted(%this, %state)
|
||||
{
|
||||
MenuListButton::onHighlighted(%this, %state);
|
||||
}
|
||||
|
||||
function MenuOptionsButton::onChange(%this)
|
||||
{
|
||||
%optionMode = %this.getMode();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue