mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
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
89 lines
2.2 KiB
Plaintext
89 lines
2.2 KiB
Plaintext
function PauseMenu::onWake(%this)
|
|
{
|
|
if($Server::ServerType $= "SinglePlayer")
|
|
{
|
|
$timescale = 0;
|
|
|
|
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
|
|
}
|
|
|
|
PauseMenuList.hidden = false;
|
|
|
|
PauseMenuList.clear();
|
|
|
|
if($Tools::loaded && EditorIsActive())
|
|
{
|
|
%this.addPauseMenuButton("Exit Editor", "fastLoadWorldEdit();");
|
|
}
|
|
|
|
%this.addPauseMenuButton("Options", "openPauseMenuOptions();");
|
|
%this.addPauseMenuButton("Exit to Menu", "pauseMenuExitToMenu();");
|
|
%this.addPauseMenuButton("Exit to Desktop", "pauseMenuExitToDesktop();");
|
|
|
|
PauseMenuList.setAsActiveMenuList();
|
|
PauseButtonHolder.setActive();
|
|
PauseMenuInputHandler.setFirstResponder();
|
|
|
|
%this.resizePages = true;
|
|
}
|
|
|
|
|
|
function PauseMenu::onSleep(%this)
|
|
{
|
|
if($Server::ServerType $= "SinglePlayer")
|
|
{
|
|
$timescale = 1;
|
|
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
|
|
}
|
|
}
|
|
|
|
function openPauseMenuOptions()
|
|
{
|
|
PauseMenu.pushPage(OptionsMenu);
|
|
}
|
|
|
|
function pauseMenuExitToMenu()
|
|
{
|
|
MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
|
|
}
|
|
|
|
function pauseMenuExitToDesktop()
|
|
{
|
|
MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
|
|
}
|
|
|
|
function PauseButtonHolder::onWake(%this)
|
|
{
|
|
%this-->button1.disable();
|
|
%this-->button2.disable();
|
|
%this-->button3.disable();
|
|
%this-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();");
|
|
%this-->button4.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
|
|
}
|
|
|
|
function PauseMenu::addPauseMenuButton(%this, %buttonText, %buttonCallback)
|
|
{
|
|
%newButton = new GuiButtonCtrl() {
|
|
text = %buttonText;
|
|
groupNum = "-1";
|
|
buttonType = "PushButton";
|
|
useMouseEvents = "0";
|
|
position = "0 0";
|
|
extent = "400 55";
|
|
minExtent = "8 2";
|
|
horizSizing = "right";
|
|
vertSizing = "bottom";
|
|
profile = "GuiMenuButtonProfile";
|
|
visible = "1";
|
|
active = "1";
|
|
command = %buttonCallback;
|
|
tooltipProfile = "GuiToolTipProfile";
|
|
hovertime = "1000";
|
|
isContainer = "0";
|
|
canSave = "1";
|
|
canSaveDynamicFields = "0";
|
|
};
|
|
|
|
PauseMenuList.add(%newButton);
|
|
}
|