mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-24 13:55:34 +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
|
|
@ -83,6 +83,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "$pref::HostMultiPlayer=false;\nCanvas.pushDialog(ChooseLevelMenu);";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
|
||||
text = "Create Server";
|
||||
|
|
@ -91,6 +93,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "$pref::HostMultiPlayer=true;Canvas.pushDialog(ChooseLevelMenu);";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
|
||||
text = "Join Server";
|
||||
|
|
@ -99,6 +103,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "Canvas.pushDialog(JoinServerMenu);";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
new GuiButtonCtrl(MainMenuOptionBtn) {
|
||||
text = "Options";
|
||||
|
|
@ -107,6 +113,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "Canvas.pushDialog(OptionsMenu);";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
new GuiButtonCtrl(MainMenuWorldEditBtn) {
|
||||
text = "Open World Editor (F11)";
|
||||
|
|
@ -115,6 +123,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "fastLoadWorldEdit(1);";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
new GuiButtonCtrl(MainMenuGuiEditBtn) {
|
||||
text = "Open GUI Editor (F10)";
|
||||
|
|
@ -123,6 +133,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "fastLoadGUIEdit(1);";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
new GuiButtonCtrl(MainMenuExitBtn) {
|
||||
text = "Exit";
|
||||
|
|
@ -131,6 +143,8 @@ $guiContent = new GuiControl(MainMenuGui) {
|
|||
profile = "GuiMenuButtonProfile";
|
||||
command = "quit();";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
class="MainMenuButton";
|
||||
groupNum = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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