mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-27 18:43:48 +00:00
- Added logic to guiButtonBaseCtrl so if highlighted and is part of a group, will signal the siblings in the group as well
- Standardizes highlighting behavior between keybind and mouse highlighting of buttons - Standardized onHighlighted callback for buttonBase - Fixed handling of up/down nav with gamepad stick - Added logic to make holding down nav keybinds iterate over buttons in menu lists
This commit is contained in:
parent
36d00e09d3
commit
f5ab97242f
4 changed files with 301 additions and 247 deletions
|
|
@ -1,3 +1,6 @@
|
|||
$BaseUI::scrollSpeedTimeMs = 250;
|
||||
$BaseUI::scrollSchedule = 0;
|
||||
|
||||
function MainMenuGui::onAdd(%this)
|
||||
{
|
||||
}
|
||||
|
|
@ -38,6 +41,12 @@ function BaseUINavigatePrev(%val)
|
|||
$MenuList.listPosition = 0;
|
||||
|
||||
$MenuList.syncGUI();
|
||||
|
||||
$BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "BaseUINavigatePrev", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cancel($BaseUI::scrollSchedule);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,15 +59,25 @@ function BaseUINavigateNext(%val)
|
|||
$MenuList.listPosition = $MenuList.getCount()-1;
|
||||
|
||||
$MenuList.syncGUI();
|
||||
|
||||
$BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "BaseUINavigateNext", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cancel($BaseUI::scrollSchedule);
|
||||
}
|
||||
}
|
||||
|
||||
function BaseUIStickNavigate(%val)
|
||||
{
|
||||
if(%val == -1)
|
||||
if(%val == 1)
|
||||
BaseUINavigateNext(1);
|
||||
else if(%val == 1)
|
||||
mainMenuNavigateDown(1);
|
||||
else if(%val == -1)
|
||||
BaseUINavigatePrev(1);
|
||||
else
|
||||
{
|
||||
cancel($BaseUI::scrollSchedule);
|
||||
}
|
||||
}
|
||||
|
||||
function BaseUIBackOut(%val)
|
||||
|
|
@ -79,7 +98,7 @@ function BaseUIBackOut(%val)
|
|||
|
||||
function MainMenuButtonList::syncGUI(%this)
|
||||
{
|
||||
%this.callOnChildren("setHighlighted", false);
|
||||
//%this.callOnChildren("setHighlighted", false);
|
||||
|
||||
%btn = %this.getObject(%this.listPosition);
|
||||
%btn.setHighlighted(true);
|
||||
|
|
@ -93,6 +112,12 @@ function MainMenuButtonList::syncGUI(%this)
|
|||
MainMenuGoButton.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIActivateSelected"));
|
||||
}
|
||||
|
||||
function MainMenuButton::onHighlighted(%this, %highlighted)
|
||||
{
|
||||
if(%highlighted)
|
||||
$MenuList.listPosition = MainMenuButtonList.getObjectIndex(%this);
|
||||
}
|
||||
|
||||
function BaseUIActivateSelected()
|
||||
{
|
||||
%btn = $MenuList.getObject($MenuList.listPosition);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue