Torque3D/Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript
JeffR 6d2bfa0368 Adds animations for Playerbot
Fixes PauseMenu navigation behavior and confirms the menu buttons and page nav to standard
Fixes PauseMenu and OptionMenu menu buttons that were not being set correctly on wake
Fixes logic in the shape editor where it wouldn't add new sequences if you were working off a non-assetId sequence in the sequence list(such as ambient)
2022-06-21 00:25:03 -05:00

94 lines
2.4 KiB
Plaintext

function PauseMenu::onWake(%this)
{
if($Server::ServerType $= "SinglePlayer")
{
$timescale = 0;
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
}
PauseButtonHolder.setActive();
PauseMenuInputHandler.setFirstResponder();
%this.resizePages = true;
%this.setRootPage(PauseMenuButtons);
}
function PauseMenuButtons::onOpen(%this)
{
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();
$activeMenuButtonContainer-->button1.disable();
$activeMenuButtonContainer-->button2.disable();
$activeMenuButtonContainer-->button3.disable();
$activeMenuButtonContainer-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();");
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
}
function PauseMenuButtons::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);
}
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)
{
}