Ongoing wipwork of the BaseUI update. Some bugfixes pending

This commit is contained in:
Areloch 2023-12-16 23:18:33 -06:00
parent 616d974212
commit ce4c8dabc9
53 changed files with 2033 additions and 3892 deletions

View file

@ -1,5 +0,0 @@
<GUIAsset
AssetName="ChooseLevelDlg"
scriptFile="@assetFile=chooseLevelDlg"
GUIFile="@assetFile=chooseLevelDlg.gui"
VersionId="1"/>

View file

@ -0,0 +1,5 @@
<GUIAsset
AssetName="ChooseLevelMenu"
scriptFile="@assetFile=ChooseLevelMenu"
GUIFile="@assetFile=ChooseLevelMenu.gui"
VersionId="1"/>

View file

@ -0,0 +1,97 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiChunkedBitmapCtrl(ChooseLevelMenu) {
BitmapAsset = "UI:backgrounddark_image";
extent = "1280 720";
minExtent = "8 8";
horizSizing = "width";
vertSizing = "height";
profile = "GuiNonModalDefaultProfile";
category = "BaseUI";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
launchInEditor = "0";
new GuiInputCtrl(ChooseLevelInputHandler) {
ignoreMouseEvents = "1";
ActionMap = "ChooseLevelActionMap";
position = "-50 0";
extent = "2186 851";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiPanel(ChooseLevelTitlePanel) {
extent = "1281 80";
horizSizing = "width";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiTextCtrl(ChooseLevelTitleText) {
text = "SINGLE PLAYER";
position = "22 23";
extent = "220 28";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
};
new GuiPanel(ChooseLevelButtonPanel) {
position = "0 683";
extent = "1281 40";
horizSizing = "width";
vertSizing = "top";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiIconButtonCtrl(ChooseLevelStartBtn) {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Start";
position = "1115 0";
extent = "140 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "OptionsMenu.applySettings();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiIconButtonCtrl(ChooseLevelBackBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Back";
position = "16 0";
extent = "140 40";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "Canvas.popDialog();";
tooltipProfile = "GuiToolTipProfile";
};
};
new GuiScrollCtrl(LevelPreviewScroll) {
hScrollBar = "dynamic";
vScrollBar = "alwaysOff";
position = "0 118";
extent = "1283 500";
horizSizing = "width";
vertSizing = "center";
profile = "GuiMenuScrollProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiStackControl(LevelPreviewArray) {
position = "1 1";
extent = "1280 480";
vertSizing = "center";
profile = "GuiMenuDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
padding = "5";
stackingType = "Horizontal";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,211 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//----------------------------------------
function ChooseLevelMenu::onAdd( %this )
{
if(!isObject(ChooseLevelAssetQuery))
new AssetQuery(ChooseLevelAssetQuery);
}
function ChooseLevelMenu::onWake(%this)
{
LevelPreviewArray.clear();
ChooseLevelAssetQuery.clear();
AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset");
%count = ChooseLevelAssetQuery.getCount();
if(%count == 0 && !IsDirectory("tools"))
{
//We have no levels found. Prompt the user to open the editor to the default level if the tools are present
MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.",
"Canvas.popDialog(ChooseLevelMenu); if(isObject(ChooseLevelMenu.returnGui) && ChooseLevelMenu.returnGui.isMethod(\"onReturnTo\")) ChooseLevelMenu.returnGui.onReturnTo();");
ChooseLevelAssetQuery.delete();
return;
}
for(%i=0; %i < %count; %i++)
{
%assetId = ChooseLevelAssetQuery.getAsset(%i);
if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
continue;
%levelAsset = AssetDatabase.acquireAsset(%assetId);
%file = %levelAsset.getLevelPath();
if ( !isFile(%file) )
continue;
%levelPreviewImg = %levelAsset.getPreviewImagePath();
if (!isFile(%levelPreviewImg))
%levelPreviewImg = "UI:no_preview_image";
%preview = new GuiContainer() {
extent = "480 480";
levelAssetId = %assetId;
new GuiButtonCtrl() {
position = "0 0";
extent = "480 480";
buttonType = "ToggleButton";
profile = LevelPreviewButtonProfile;
horizSizing = "width";
vertSizing = "height";
internalName = "button";
class = "LevelPreviewButton";
command = "$selectedLevelAsset = " @ %assetId @ ";";
altCommand = "ChooseLevelBegin(1);"; //allow doubleclick to quick action it
};
new GuiBitmapCtrl() {
position = "20 0";
extent = "440 440";
BitmapAsset = %levelPreviewImg;
horizSizing = "width";
vertSizing = "bottom";
profile = GuiNonModalDefaultProfile;
};
new GuiTextCtrl() {
position = "20 445";
extent = "440 15";
text = %levelAsset.levelName;
profile = MenuSubHeaderText;
internalName = "levelNameTxt";
};
new GuiMLTextCtrl() {
position = "20 465";
extent = "440 15";
text = %levelAsset.levelDescription;
profile = GuiMLTextProfile;
internalName = "levelDescTxt";
};
};
LevelPreviewArray.add(%preview);
}
// Also add the new level mission as defined in the world editor settings
// if we are choosing a level to launch in the editor.
if ( %this.launchInEditor )
{
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
}
//LevelList.setSelected(0);
if(!$pref::HostMultiPlayer)
ChooseLevelTitleText.setText("SINGLE PLAYER");
else
ChooseLevelTitleText.setText("CREATE SERVER");
$MenuList = LevelPreviewArray;
$MenuList.listPosition = 0;
$MenuList.syncGui();
}
if(!isObject( ChooseLevelActionMap ) )
{
new ActionMap(ChooseLevelActionMap){};
//Null the up/down nav so we can swap in left/right nav
ChooseLevelActionMap.bindCmd( keyboard, w, "" );
ChooseLevelActionMap.bindCmd( keyboard, s, "" );
ChooseLevelActionMap.bindCmd( gamepad, yaxis, "" );
ChooseLevelActionMap.bindCmd( gamepad, upov, "" );
ChooseLevelActionMap.bindCmd( gamepad, dpov, "" );
ChooseLevelActionMap.bind( keyboard, a, BaseUINavigatePrev );
ChooseLevelActionMap.bind( keyboard, d, BaseUINavigateNext );
ChooseLevelActionMap.bind( gamepad, xaxis, "D", "-0.23 0.23", BaseUIStickNavigate );
ChooseLevelActionMap.bind( gamepad, lpov, BaseUINavigatePrev );
ChooseLevelActionMap.bind( gamepad, rpov, BaseUINavigateNext );
ChooseLevelActionMap.bind( keyboard, Enter, ChooseLevelBegin );
ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
}
function LevelPreviewArray::syncGUI(%this)
{
%this.callOnChildren("setHighlighted", false);
%btn = %this.getObject(%this.listPosition);
%btn-->button.setHighlighted(true);
$selectedLevelAsset = %btn.levelAssetId;
}
function ChooseLevelBegin(%val)
{
if(%val)
{
// So we can't fire the button when loading is in progress.
if ( isObject( ServerGroup ) )
return;
Canvas.popDialog();
%entry = LevelPreviewArray.getObject(LevelPreviewArray.listPosition);
if(!AssetDatabase.isDeclaredAsset(%entry.levelAssetId))
{
MessageBoxOK("Error", "Selected level preview does not have a valid level asset!");
return;
}
// Launch the chosen level with the editor open?
if ( ChooseLevelMenu.launchInEditor )
{
activatePackage( "BootEditor" );
ChooseLevelMenu.launchInEditor = false;
StartGame(%entry.levelAssetId, "SinglePlayer");
}
else
{
StartGame(%entry.levelAssetId);
}
}
}
function ChooseLevelMenu::onSleep( %this )
{
// This is set from the outside, only stays true for a single wake/sleep
// cycle.
%this.launchInEditor = false;
}
function LevelPreviewButton::onHighlighted(%this, %highlighted)
{
%container = %this.getParent();
%container-->levelNameTxt.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText;
%container-->levelDescTxt.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile;
LevelPreviewScroll.scrollToObject(%this);
}

View file

@ -0,0 +1,5 @@
<GUIAsset
AssetName="GameMenu"
scriptFile="@assetFile=GameMenu"
GUIFile="@assetFile=GameMenu.gui"
VersionId="1"/>

View file

@ -0,0 +1,97 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(GameMenu) {
extent = "1280 720";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
superClass = "UINavigation";
canSaveDynamicFields = "1";
currentMenu = "SystemMenu";
gameMenusArray = "17288";
resizePages = "1";
new GuiInputCtrl(GameMenuInputHandler) {
ignoreMouseEvents = "1";
ActionMap = "GameMenuActionMap";
position = "-50 0";
extent = "50 50";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiChunkedBitmapCtrl(GameMenuBG) {
BitmapAsset = "UI:hudfill_image";
extent = "1280 720";
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
new GuiPanel(GameMenuTitlePanel) {
extent = "1281 60";
horizSizing = "width";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiStackControl(GameMenuButtonList){
position = "40 0";
extent = "1240 60";
profile = GuiDefaultProfile;
stackingType = "Horizontal";
padding = "10";
horizSizing = "center";
vertSizing = "center";
};
new GuiControl(GameMenuNavButtonOverlay) {
extent = "1281 60";
horizSizing = "width";
vertSizing = "height";
profile = GuiNonModalDefaultProfile;
new GuiBitmapCtrl(GameMenuPrevNavIcon) {
BitmapAsset = "UI:Keyboard_Black_Q_image";
position = "0 24";
extent = "40 40";
profile = GuiNonModalDefaultProfile;
vertSizing = "top";
};
new GuiBitmapCtrl(GameMenuNextNavIcon) {
BitmapAsset = "UI:Keyboard_Black_E_image";
position = "0 24";
extent = "40 40";
profile = GuiNonModalDefaultProfile;
vertSizing = "top";
};
};
};
};
new GuiPanel(GameMenuButtonPanel) {
position = "0 683";
extent = "1281 40";
horizSizing = "width";
vertSizing = "top";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiIconButtonCtrl(GameMenuBackBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Back";
position = "16 0";
extent = "140 40";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "Canvas.popDialog(GameMenu);";
tooltipProfile = "GuiToolTipProfile";
class = "MenuInputButton";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,186 @@
function GameMenu::onAdd(%this)
{
%this.gameMenusArray = new ArrayObject(){};
}
function GameMenu::onWake(%this)
{
if($Server::ServerType $= "SinglePlayer")
{
$timescale = 0;
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
}
callOnModules("registerGameMenus", "", %this.gameMenusArray);
//Remove duplicates as needed
%this.gameMenusArray.uniqueKey();
GameMenuButtonList.clear();
%stackWidth = 0;
//process the entries and give 'em buttons on the button array
for(%i=0; %i < %this.gameMenusArray.count(); %i++)
{
%buttonText = %this.gameMenusArray.getKey(%i);
%textWidth = GuiMenuButtonProfile.getStringWidth(%buttonText);
%btn = new GuiButtonCtrl() {
extent = %textWidth + 80 SPC 40;
profile = GuiMenuButtonProfile;
text = %buttonText;
class = "GameMenuButton";
command = "GameMenu.openGameMenu(\"" @ %buttonText @ "\");";
};
%stackWidth += %textWidth + 40;
GameMenuButtonList.add(%btn);
}
GameMenuButtonList.resize(GameMenuTitlePanel.extent.x/2 - %stackWidth/2, 0, %stackWidth, GameMenuTitlePanel.extent.y);
%this.openGameMenu("System");
//give a slight delay for the canvas to be fully refreshed before we sync things
%this.schedule(500, "syncGUI");
}
function GameMenu::onSleep(%this)
{
if($Server::ServerType $= "SinglePlayer")
{
$timescale = 1;
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
}
if(isObject(%this.currentMenu))
{
Canvas.popDialog(%this.currentMenu);
}
}
if(!isObject( GameMenuActionMap ) )
{
new ActionMap(GameMenuActionMap){};
//We'll just use the existing BaseUI nav functions because it'd be the same logic anyways
GameMenuActionMap.bind( keyboard, w, BaseUINavigatePrev );
GameMenuActionMap.bind( keyboard, s, BaseUINavigateNext );
GameMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", BaseUIStickNavigate );
GameMenuActionMap.bind( gamepad, upov, BaseUINavigatePrev );
GameMenuActionMap.bind( gamepad, dpov, BaseUINavigateNext );
GameMenuActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
GameMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
GameMenuActionMap.bindCmd( keyboard, Escape, "Canvas.popDialog(GameMenu);", "" );
GameMenuActionMap.bindCmd( gamepad, btn_b, "Canvas.popDialog(GameMenu);", "" );
GameMenuActionMap.bindCmd( gamepad, btn_start, "Canvas.popDialog(GameMenu);", "" );
GameMenuActionMap.bind( keyboard, q, GameMenuPrevMenu );
GameMenuActionMap.bind( gamepad, btn_l, GameMenuPrevMenu );
GameMenuActionMap.bind( keyboard, e, GameMenuNextMenu );
GameMenuActionMap.bind( gamepad, btn_r, GameMenuNextMenu );
}
function GameMenu::openGameMenu(%this, %menuName)
{
%menuIdx = %this.gameMenusArray.getIndexFromKey(%menuName);
if(%menuIdx != -1)
{
%newMenu = %this.gameMenusArray.getValue(%menuIdx);
if(isObject(%this.currentMenu))
Canvas.popDialog(%this.currentMenu);
Canvas.pushDialog(%newMenu);
%this.currentMenu = %newMenu;
%this.currentMenuIdx = %menuIdx;
}
%this.syncGui();
}
function openPauseMenuOptions()
{
GameMenu.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 GameMenuPrevMenu(%val)
{
if(%val)
{
%currentIdx = GameMenu.currentMenuIdx;
GameMenu.currentMenuIdx -= 1;
if(GameMenu.currentMenuIdx < 0)
GameMenu.currentMenuIdx = 0;
if(%currentIdx == GameMenu.currentMenuIdx)
return;
%menuName = GameMenu.gameMenusArray.getKey(GameMenu.currentMenuIdx);
GameMenu.openGameMenu(%menuName);
}
}
function GameMenuNextMenu(%val)
{
if(%val)
{
%currentIdx = GameMenu.currentMenuIdx;
GameMenu.currentMenuIdx += 1;
if(GameMenu.currentMenuIdx >= GameMenu.gameMenusArray.count())
GameMenu.currentMenuIdx = GameMenu.gameMenusArray.count()-1;
if(%currentIdx == GameMenu.currentMenuIdx)
return;
%menuName = GameMenu.gameMenusArray.getKey(GameMenu.currentMenuIdx);
GameMenu.openGameMenu(%menuName);
}
}
function GameMenu::syncGui(%this)
{
GameMenuButtonList.callOnChildren("setHighlighted", false);
%btn = GameMenuButtonList.getObject(%this.currentMenuIdx);
%btn.setHighlighted(true);
%buttonPosX = %btn.position.x + GameMenuButtonList.position.x;
GameMenuPrevNavIcon.position.x = %buttonPosX;
GameMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
//Update the button imagery to comply to the last input device we'd used
%device = Canvas.getLastInputDevice();
if(%device $= "mouse")
%device = "keyboard";
GameMenuBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
GameMenuPrevNavIcon.setBitmap(GameMenuActionMap.getCommandButtonBitmap(%device, "GameMenuPrevMenu"));
GameMenuNextNavIcon.setBitmap(GameMenuActionMap.getCommandButtonBitmap(%device, "GameMenuNextMenu"));
%this.schedule(500, "syncGUI");
}
/*
*/

View file

@ -1,5 +0,0 @@
<GUIAsset
AssetName="GuiMusicPlayer"
scriptFile="@assetFile=guiMusicPlayer"
GUIFile="@assetFile=guiMusicPlayer.gui"
VersionId="1"/>

View file

@ -1,4 +0,0 @@
<GUIAsset
AssetName="IODropdownDlg"
GUIFile="@assetFile=IODropdownDlg.ed.gui"
VersionId="1"/>

View file

@ -1,159 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(IODropdownDlg) {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiWindowCtrl(IODropdownFrame) {
canSaveDynamicFields = "0";
Profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "272 77";
extent = "256 117";
minExtent = "256 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
maxLength = "255";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
text = "";
closeCommand="IOCallback(IODropdownDlg,IODropdownDlg.cancelCallback);";
new GuiMLTextCtrl(IODropdownText) {
text = "";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
isContainer = "0";
profile = "GuiMLTextProfile";
horizSizing = "center";
vertSizing = "bottom";
position = "9 26";
extent = "237 16";
minExtent = "8 8";
canSave = "1";
visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiBitmapBorderCtrl() {
isContainer = "0";
profile = "GuiGroupBorderProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "7 51";
extent = "243 28";
minExtent = "0 0";
canSave = "1";
visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
new GuiTextCtrl(IOInputText) {
text = "Decal Datablock";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
isContainer = "0";
profile = "GuiTextRightProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 5";
extent = "105 18";
minExtent = "8 2";
canSave = "1";
visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiPopUpMenuCtrl(IODropdownMenu) {
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
isContainer = "0";
profile = "GuiPopUpMenuProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "115 5";
extent = "122 18";
minExtent = "8 2";
canSave = "1";
visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
};
new GuiButtonCtrl() {
text = "OK";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
isContainer = "0";
profile = "GuiButtonProfile";
horizSizing = "width";
vertSizing = "top";
position = "7 85";
extent = "156 24";
minExtent = "8 8";
canSave = "1";
visible = "1";
accelerator = "return";
command = "IOCallback(IODropdownDlg,IODropdownDlg.callback);";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Cancel";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
isContainer = "0";
profile = "GuiButtonProfile";
horizSizing = "left";
vertSizing = "top";
position = "170 85";
extent = "80 24";
minExtent = "8 8";
canSave = "1";
visible = "1";
accelerator = "escape";
command = "IOCallback(IODropdownDlg,IODropdownDlg.cancelCallback);";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1,5 +0,0 @@
<GUIAsset
AssetName="MainMenuButtons"
scriptFile="@assetFile=MainMenuButtons.tscript"
GUIFile="@assetFile=MainMenuButtons.gui"
VersionId="1"/>

View file

@ -1,84 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(MainMenuButtons) {
extent = "1024 768";
horizSizing = "width";
vertSizing = "height";
profile = "GuiNonModalDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
originalAssetName = "MainMenuButtons";
new GuiStackControl(MainMenuButtonList) {
padding = "15";
dynamicSize = "0";
position = "312 145";
extent = "400 477";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
new GuiButtonCtrl(MainMenuSinglePlayerBtn) {
text = "Single Player";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "openSinglePlayerMenu();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
text = "Create Server";
position = "0 70";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "openMultiPlayerMenu();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
text = "Join Server";
position = "0 140";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "openJoinServerMenu();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuOptionBtn) {
text = "Options";
position = "0 210";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "openOptionsMenu();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuWorldEditBtn) {
text = "Open World Editor (F11)";
position = "0 280";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "openWorldEditorBtn();";
tooltipProfile = "GuiToolTipProfile";
enabled = (ModuleDatabase.findModule("ToolsModule") !$= "");
visible = (ModuleDatabase.findModule("ToolsModule") !$= "");
};
new GuiButtonCtrl(MainMenuGuiEditBtn) {
text = "Open GUI Editor (F10)";
position = "0 350";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "openGUIEditorBtn();";
tooltipProfile = "GuiToolTipProfile";
enabled = (ModuleDatabase.findModule("ToolsModule") !$= "");
visible = (ModuleDatabase.findModule("ToolsModule") !$= "");
};
new GuiButtonCtrl(MainMenuExitBtn) {
text = "Exit";
position = "0 420";
extent = "400 55";
profile = "GuiMenuButtonProfile";
command = "quit();";
tooltipProfile = "GuiToolTipProfile";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1,107 +0,0 @@
function MainMenuButtons::onWake(%this)
{
}
function MainMenuButtons::onSleep(%this)
{
}
//==============================================================================
// This gets called by the MainMenuGUI beacuse it, being a UINavigation classed control
// set MainMenuButtonList as it's root page.
// This is an optional function, but is called as part of the validation that the page
// CAN be opened, so it's shown here as an example
function MainMenuButtons::canOpen(%this)
{
return true;
}
//==============================================================================
// This gets called by the MainMenuGUI beacuse it, being a UINavigation classed control
// set MainMenuButtonList as it's root page.
// Once the page is added to the MainMenuGUI's UINavigation page stack, onOpen here is called
// Which allows us to actually do the work we need to do for display
function MainMenuButtons::onOpen(%this)
{
//Here, we set the MainMenuButtonList - a GuiStackControl with the MenuList class
// to be the active menu list.
// This means that when the MainMenuGUI's MainMenuInputHandler receives an input
// or we have one of the buttons in the MainMenuButtonHolder be actioned, we know
// we're working/navigating this list of buttons specifically
// In practice, it sets the $activeMenuList global variable so the various menu class code
// can reference it consistently
MainMenuButtonList.setAsActiveMenuList();
//Because MainMenuGUI set it's MainMenuButtonHolder as the active button container, we can reference it
//by $activeMenuButtonContainer and set the menu button/accelerator prompts we need for the MainMenuButtonList
//specifically.
//In particular, being a simple list of buttons, the only one we NEED is a simple activate, so we'll
//disable all the other ones to keep them clear in case they were set by other pages at some point
$activeMenuButtonContainer-->button1.disable();
$activeMenuButtonContainer-->button2.disable();
$activeMenuButtonContainer-->button3.disable();
//Here we set the 4th button in the container
//All the buttons have the MenuInputButton class, which, like the other classes
//help keep things accessible and consistent. Here we use that class's set function to
//configure the accelerator behavior
//The first parameter sets the gamepad button to the 'A' button
//The second sets the keyboard button to Enter or Return
//Third is what the displayed text will be
//And finally we set the command when the button is clicked, or either key inputs are caught by
//our MenuInputHandler
//The menu buttons automatically detect which input device you're using and swap the display between
//gamepad or keyboard for consistent behavior
$activeMenuButtonContainer-->button4.set("btn_a", "Return", "Go", "MainMenuButtonList.activate();");
$activeMenuButtonContainer-->button5.disable();
}
//Optional, as the check defaults to true, but here as an example case
function MainMenuButtons::canClose(%this)
{
return true;
}
function MainMenuButtons::onClose(%this)
{
}
//Our actual commands when we activate the buttons
function openSinglePlayerMenu()
{
$pref::HostMultiPlayer=false;
MainMenuGui.pushPage(ChooseLevelDlg);
}
function openMultiPlayerMenu()
{
$pref::HostMultiPlayer=true;
//Here, like the other commands, we add a new page onto the stack
//In this case, we'll push the ChooseLevelDlg control onto the stack. This will
//invoke the canClose() and then onClose() functions for MainMenuButtonList
//before calling the onOpen() for ChooseLevelDlg then displaying.
MainMenuGui.pushPage(ChooseLevelDlg);
}
function openJoinServerMenu()
{
//Here, like the other commands, we add a new page onto the stack
//In this case, we'll push the JoinServerMenu control onto the stack. This will
//invoke the canClose() and then onClose() functions for MainMenuButtonList
//before calling the onOpen() for JoinServerMenu then displaying.
MainMenuGui.pushPage(JoinServerMenu);
}
function openWorldEditorBtn()
{
fastLoadWorldEdit(1);
}
function openGUIEditorBtn()
{
fastLoadGUIEdit(1);
}

View file

@ -1,5 +0,0 @@
<GUIAsset
AssetName="PauseMenu"
scriptFile="@assetFile=pauseMenu"
GUIFile="@assetFile=pauseMenu.gui"
VersionId="1"/>

View file

@ -1,230 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(recordingsDlg) {
position = "0 0";
extent = "1024 768";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
helpTag = "0";
new GuiWindowCtrl() {
text = "Demo Recordings";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
canCollapse = "0";
closeCommand = "Canvas.popDialog(recordingsDlg);";
edgeSnap = "1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "247 215";
extent = "530 338";
minExtent = "48 92";
horizSizing = "center";
vertSizing = "center";
profile = "GuiWindowProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
lockHorizScroll = "0";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "23 60";
extent = "484 237";
minExtent = "32 32";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextListCtrl(RecordingsDlgList) {
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
position = "1 1";
extent = "469 32";
minExtent = "8 20";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextArrayProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiButtonCtrl(DR_CancelBtn) {
text = "Cancel";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "396 306";
extent = "110 20";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "top";
profile = "GuiButtonProfile";
visible = "1";
active = "1";
command = "Canvas.popDialog(recordingsDlg);";
accelerator = "escape";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(DR_StartDemoBtn) {
text = "Play";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "25 305";
extent = "110 20";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "top";
profile = "GuiButtonProfile";
visible = "1";
active = "1";
command = "StartSelectedDemo();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "During gameplay press the following keys:";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "23 30";
extent = "206 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Start = F3";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "253 32";
extent = "50 15";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Stop = F4";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "320 32";
extent = "49 13";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(DR_DelDemoBtn) {
text = "Delete";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "210 305";
extent = "110 20";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiButtonProfile";
visible = "1";
active = "1";
command = "deleteDemoRecord();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,5 @@
<GUIAsset
AssetName="SystemMenu"
ScriptFile="@assetFile=SystemMenu.tscript"
GUIFile="@assetFile=SystemMenu.gui"
VersionId="1"/>

View file

@ -0,0 +1,53 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(SystemMenu) {
extent = "1280 720";
profile = "GuiNonModalDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
new GuiStackControl(SystemMenuButtonList) {
padding = "5";
dynamicSize = "0";
position = "440 263";
extent = "400 189";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
new GuiButtonCtrl() {
text = "Return to Game";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "Canvas.popDialog(GameMenu);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Options";
position = "0 45";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "Canvas.pushDialog(OptionsMenu);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Exit to Menu";
position = "0 90";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "systemMenuExitToMenu();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Exit to Desktop";
position = "0 135";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "systemMenuExitToDesktop();";
tooltipProfile = "GuiToolTipProfile";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,37 @@
function SystemMenu::onWake(%this)
{
$MenuList = SystemMenuButtonList;
$MenuList.listPosition = 0;
}
function SystemMenu::onSleep(%this)
{
}
function systemMenuExitToMenu()
{
MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
}
function systemMenuExitToDesktop()
{
MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
}
function SystemMenuButtonList::syncGUI(%this)
{
%this.callOnChildren("setHighlighted", false);
%btn = %this.getObject(%this.listPosition);
%btn.setHighlighted(true);
//
//Update the button imagery to comply to the last input device we'd used
%device = Canvas.getLastInputDevice();
if(%device $= "mouse")
%device = "keyboard";
//We'll call back to the GameMenu parent just to be sure everything's on the same page
GameMenu.syncGui();
}

View file

@ -1,106 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(ChooseLevelDlg) {
extent = "1024 768";
minExtent = "8 8";
horizSizing = "width";
vertSizing = "height";
profile = "GuiNonModalDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
Enabled = "1";
launchInEditor = "0";
returnGui = "MainMenuGui";
new GuiControl(ChooseLevelWindow) {
position = "48 56";
extent = "928 655";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
new GuiBitmapBarCtrl() {
BitmapAsset = "UI:panel_image";
extent = "927 40";
horizSizing = "width";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl(LevelSelectTitle) {
text = "SINGLE PLAYER";
position = "22 10";
extent = "307 28";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
new GuiBitmapBarCtrl() {
BitmapAsset = "UI:panel_low_image";
position = "0 40";
extent = "927 618";
horizSizing = "width";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiBitmapCtrl() {
BitmapAsset = "Core_Rendering:missingTexture_image";
position = "513 71";
extent = "400 300";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "CurrentPreview";
canSaveDynamicFields = "1";
Enabled = "1";
};
new GuiTextCtrl() {
text = "Example Level";
maxLength = "255";
position = "514 375";
extent = "398 27";
minExtent = "8 8";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
internalName = "LevelName";
};
new GuiTextCtrl() {
text = "Description:";
maxLength = "255";
position = "522 410";
extent = "91 18";
minExtent = "8 8";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
internalName = "LevelDescriptionLabel";
};
new GuiMLTextCtrl() {
text = "This is placeholder text";
position = "522 436";
extent = "391 14";
minExtent = "8 8";
profile = "GuiMLWhiteTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "LevelDescription";
};
new GuiScrollCtrl() {
hScrollBar = "dynamic";
vScrollBar = "dynamic";
position = "0 40";
extent = "450 580";
profile = "GuiMenuScrollProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiGameListMenuCtrl(LevelList) {
callbackOnInputs = "1";
position = "1 1";
extent = "450 90";
profile = "DefaultListMenuProfile";
tooltipProfile = "GuiToolTipProfile";
class = "UIMenuButtonList";
};
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1,210 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//----------------------------------------
function ChooseLevelDlg::onWake( %this )
{
if(!isObject(LevelListEntries))
new ArrayObject(LevelListEntries){};
if(!isObject(ChooseLevelAssetQuery))
new AssetQuery(ChooseLevelAssetQuery);
}
function ChooseLevelDlg::onOpen(%this)
{
LevelList.clearRows();
LevelListEntries.empty();
ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image");
ChooseLevelWindow->LevelDescriptionLabel.visible = false;
ChooseLevelWindow->LevelDescription.visible = false;
ChooseLevelAssetQuery.clear();
AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset");
%count = ChooseLevelAssetQuery.getCount();
if(%count == 0 && !IsDirectory("tools"))
{
//We have no levels found. Prompt the user to open the editor to the default level if the tools are present
MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.",
"Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();");
ChooseLevelAssetQuery.delete();
return;
}
for(%i=0; %i < %count; %i++)
{
%assetId = ChooseLevelAssetQuery.getAsset(%i);
if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
continue;
%levelAsset = AssetDatabase.acquireAsset(%assetId);
%file = %levelAsset.getLevelPath();
if ( !isFile(%file @ ".mis") && !isFile(%file @ ".mis.dso") &&!isFile(%file) )
continue;
// Skip our new level/mission if we arent choosing a level
// to launch in the editor.
if ( !%this.launchInEditor )
{
%fileName = fileName(%file);
if (strstr(%fileName, "newMission.mis") > -1 || strstr(%fileName, "newLevel.mis") > -1)
continue;
}
%this.addLevelAsset( %levelAsset );
}
// Also add the new level mission as defined in the world editor settings
// if we are choosing a level to launch in the editor.
if ( %this.launchInEditor )
{
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
}
for(%i=0; %i < LevelListEntries.count(); %i++)
{
%levelAsset = LevelListEntries.getKey(%i);
LevelList.addRow(%levelAsset.LevelName, "", -1, -30);
}
LevelList.setSelected(0);
LevelList.onChange();
if(!$pref::HostMultiPlayer)
LevelSelectTitle.setText("SINGLE PLAYER");
else
LevelSelectTitle.setText("CREATE SERVER");
$activeMenuButtonContainer-->button1.disable();
$activeMenuButtonContainer-->button2.disable();
$activeMenuButtonContainer-->button3.disable();
$activeMenuButtonContainer-->button4.set("btn_a", "Return", "Start Level", "ChooseLevelDlg.beginLevel();");
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
}
function ChooseLevelDlg::onSleep( %this )
{
// This is set from the outside, only stays true for a single wake/sleep
// cycle.
%this.launchInEditor = false;
}
function ChooseLevelDlg::addMissionFile( %this, %file )
{
%levelName = fileBase(%file);
%levelDesc = "A Torque level";
%LevelInfoObject = getLevelInfo(%file);
if (%LevelInfoObject != 0)
{
if(%LevelInfoObject.levelName !$= "")
%levelName = %LevelInfoObject.levelName;
else if(%LevelInfoObject.name !$= "")
%levelName = %LevelInfoObject.name;
if (%LevelInfoObject.desc0 !$= "")
%levelDesc = %LevelInfoObject.desc0;
if (%LevelInfoObject.preview !$= "")
%levelPreview = %LevelInfoObject.preview;
%LevelInfoObject.delete();
}
LevelListEntries.add( %levelName TAB %file TAB %levelDesc TAB %levelPreview );
}
function ChooseLevelDlg::addLevelAsset( %this, %levelAsset )
{
LevelListEntries.add( %levelAsset );
}
function LevelList::onChange(%this)
{
%index = %this.getSelectedRow();
%levelAsset = LevelListEntries.getKey(%index);
// Get the name
ChooseLevelWindow->LevelName.text = %levelAsset.LevelName;
// Get the level id
$selectedLevelAsset = %levelAsset.getAssetId();
// Find the preview image
%levelPreview = %levelAsset.getPreviewImagePath();
// Test against all of the different image formats
// This should probably be moved into an engine function
if (isFile(%levelPreview))
ChooseLevelWindow->CurrentPreview.setBitmap(%levelPreview);
else
ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image");
// Get the description
%levelDesc = %levelAsset.description;
if(%levelDesc !$= "")
{
ChooseLevelWindow->LevelDescriptionLabel.setVisible(true);
ChooseLevelWindow->LevelDescription.setVisible(true);
ChooseLevelWindow->LevelDescription.setText(%levelDesc);
}
else
{
ChooseLevelWindow->LevelDescriptionLabel.setVisible(false);
ChooseLevelWindow->LevelDescription.setVisible(false);
}
}
// Do this onMouseUp not via Command which occurs onMouseDown so we do
// not have a lingering mouseUp event lingering in the ether.
function ChooseLevelDlg::beginLevel(%this)
{
// So we can't fire the button when loading is in progress.
if ( isObject( ServerGroup ) )
return;
%this.navigation.popPage();
// Launch the chosen level with the editor open?
if ( ChooseLevelDlg.launchInEditor )
{
activatePackage( "BootEditor" );
ChooseLevelDlg.launchInEditor = false;
StartGame("", "SinglePlayer");
}
else
{
StartGame();
}
}

View file

@ -1,192 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(GuiMusicPlayer) {
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "1";
superClass = "GuiMusicPlayerClass";
new GuiWindowCtrl() {
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
EdgeSnap = "1";
text = "Torque Music Player";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "29 35";
Extent = "518 377";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
closeCommand = "toggleMusicPlayer();";
new GuiCheckBoxCtrl(GuiMusicPlayerFadeCheckBox) {
useInactiveState = "0";
text = "Fade";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "GuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "457 347";
Extent = "53 30";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl(GuiMusicPlayerLoopCheckBox) {
useInactiveState = "0";
text = "Loop";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "GuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "457 330";
Extent = "44 30";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
lockHorizScroll = "0";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "1";
Profile = "GuiScrollProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "9 31";
Extent = "500 298";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
new GuiListBoxCtrl(GuiMusicPlayerMusicList) {
AllowMultipleSelections = "1";
fitParentWidth = "1";
isContainer = "0";
Profile = "GuiListBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "1 1";
Extent = "485 2";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
superClass = "GuiMusicPlayerMusicListClass";
};
};
new GuiSliderCtrl(GuiMusicPlayerScrubber) {
range = "0 1";
ticks = "10";
value = "0";
snap = "false";
isContainer = "0";
Profile = "GuiSliderProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "114 343";
Extent = "331 23";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "$thisControl.onDragComplete();";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
class = "GuiMusicPlayerScrubberClass";
className = "GuiMusicPlayerScrubberClass";
};
new GuiButtonCtrl(GuiMusicPlayerStopButton) {
text = "Stop";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "57 338";
Extent = "40 30";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "GuiMusicPlayer.stop();";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(GuiMusicPlayerPlayButton) {
text = "Play";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "13 338";
Extent = "40 30";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "GuiMusicPlayer.play();";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1,236 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// A very simple music player.
//---------------------------------------------------------------------------------------------
// Preferences.
$pref::GuiMusicPlayer::filePattern = "*.ogg\t*.wav";
$pref::GuiMusicPlayer::fadeTime = "3.0";
//---------------------------------------------------------------------------------------------
// Datablocks.
singleton SFXDescription( GuiMusicPlayerStream : AudioMusic2D )
{
volume = 1.0;
isLooping = false;
isStreaming = true;
is3D = false;
};
singleton SFXDescription( GuiMusicPlayerLoopingStream : AudioMusic2D )
{
volume = 1.0;
isLooping = true;
isStreaming = true;
is3D = false;
};
//---------------------------------------------------------------------------------------------
// Functions.
function toggleMusicPlayer()
{
if( !GuiMusicPlayer.isAwake() )
{
GuiMusicPlayer.setExtent( Canvas.getExtent() );
GuiMusicPlayer.setPosition( 0, 0 );
Canvas.pushDialog( GuiMusicPlayer );
}
else
Canvas.popDialog( GuiMusicPlayer );
}
//---------------------------------------------------------------------------------------------
// Methods.
function GuiMusicPlayer_onSFXSourceStatusChange( %id, %status )
{
if( %status $= "Stopped" )
GuiMusicPlayer.onStop();
}
function GuiMusicPlayerClass::play( %this )
{
if( %this.status $= "Stopped"
|| %this.status $= "Paused"
|| %this.status $= "" )
{
%isPlaying = true;
if( %this.status $= "Paused" && isObject( %this.sfxSource ) )
%this.sfxSource.play();
else
{
%sel = GuiMusicPlayerMusicList.getSelectedItem();
if( %sel == -1 )
%isPlaying = false;
else
{
%desc = GuiMusicPlayerStream;
if( GuiMusicPlayerLoopCheckBox.getValue() )
%desc = GuiMusicPlayerLoopingStream;
if( GuiMusicPlayerFadeCheckBox.getValue() )
{
%desc.fadeInTime = $pref::GuiMusicPlayer::fadeTime;
%desc.fadeOutTime = $pref::GuiMusicPlayer::fadeTime;
}
else
{
%desc.fadeInTime = 0;
%desc.fadeOutTime = 0;
}
%file = GuiMusicPlayerMusicList.getItemText( %sel );
%this.sfxSource = sfxPlayOnce( %desc, %file );
if( !%this.sfxSource )
%isPlaying = false;
else
{
%this.sfxSource.statusCallback = "GuiMusicPlayer_onSFXSourceStatusChange";
GuiMusicPlayer.status = "Playing";
GuiMusicPlayerScrubber.setActive( true );
GuiMusicPlayerScrubber.setup( %this.sfxSource.getDuration() );
}
}
}
if( %isPlaying )
{
GuiMusicPlayerPlayButton.setText( "Pause" );
GuiMusicPlayerPlayButton.command = "GuiMusicPlayer.pause();";
GuiMusicPlayerLoopCheckBox.setActive( false );
GuiMusicPlayerFadeCheckBox.setActive( false );
%this.status = "Playing";
}
}
}
function GuiMusicPlayerClass::stop( %this )
{
if( %this.status $= "Playing"
|| %this.status $= "Paused" )
{
if( isObject( %this.sfxSource ) )
%this.sfxSource.stop( 0 ); // Stop immediately.
}
}
function GuiMusicPlayerClass::onStop( %this )
{
%this.sfxSource = 0;
GuiMusicPlayerLoopCheckBox.setActive( true );
GuiMusicPlayerFadeCheckBox.setActive( true );
GuiMusicPlayerScrubber.setActive( false );
GuiMusicPlayerPlayButton.setText( "Play" );
GuiMusicPlayerPlayButton.Command = "GuiMusicPlayer.play();";
%this.status = "Stopped";
GuiMusicPlayerScrubber.setValue( 0 );
}
function GuiMusicPlayerClass::pause( %this )
{
if( %this.status $= "Playing" )
{
if( isObject( %this.sfxSource ) )
%this.sfxSource.pause( 0 );
GuiMusicPlayerPlayButton.setText( "Play" );
GuiMusicPlayerPlayButton.command = "GuiMusicPlayer.play();";
%this.status = "Paused";
}
}
function GuiMusicPlayerClass::seek( %this, %playtime )
{
if( ( %this.status $= "Playing"
|| %this.status $= "Paused" )
&& isObject( %this.sfxSource ) )
%this.sfxSource.setPosition( %playtime );
}
function GuiMusicPlayer::onWake( %this )
{
GuiMusicPlayerMusicList.load();
}
function GuiMusicPlayerMusicListClass::load( %this )
{
// Remove all the files currently in the list.
%this.clearItems();
// Find the file matching pattern we should use.
%filePattern = $pref::GuiMusicPlayer::filePattern;
%sfxProvider = getWord( sfxGetDeviceInfo(), 0 );
%filePatternVarName = "$pref::GuiMusicPlayer::filePattern" @ %sfxProvider;
if( isDefined( %filePatternVarName ) )
eval( "%filePattern = " @ %filePatternVarName @ ";" );
// Find all files matching the pattern.
for( %file = findFirstFileMultiExpr( %filePattern );
%file !$= "";
%file = findNextFileMultiExpr( %filePattern ) )
%this.addItem( makeRelativePath( %file, getMainDotCsDir() ) );
}
function GuiMusicPlayerMusicList::onDoubleClick( %this )
{
GuiMusicPlayer.stop();
GuiMusicPlayer.play();
}
function GuiMusicPlayerScrubber::onMouseDragged( %this )
{
%this.isBeingDragged = true;
}
function GuiMusicPlayerScrubberClass::setup( %this, %totalPlaytime )
{
%this.range = "0 " @ %totalPlaytime;
%this.ticks = %totalPlaytime / 5; // One tick per five seconds.
%this.update();
}
function GuiMusicPlayerScrubberClass::update( %this )
{
if( GuiMusicPlayer.status $= "Playing"
&& !%this.isBeingDragged )
%this.setValue( GuiMusicPlayer.sfxSource.getPosition() );
if( GuiMusicPlayer.status $= "Playing"
|| GuiMusicPlayer.status $= "Paused" )
%this.schedule( 5, "update" );
}
function GuiMusicPlayerScrubberClass::onDragComplete( %this )
{
GuiMusicPlayer.seek( %this.getValue() );
%this.isBeingDragged = false;
}

View file

@ -1,159 +1,161 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(JoinServerMenu) {
extent = "1024 768";
profile = "GuiNonModalDefaultProfile";
extent = "1280 720";
horizSizing = "width";
vertSizing = "height";
profile = "GuiMenuBackgroundProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
new GuiInputCtrl(JoinServerInputHandler) {
ignoreMouseEvents = "1";
ActionMap = "JoinServerActionMap";
position = "-50 0";
extent = "50 50";
horizSizing = "width";
vertSizing = "height";
canSaveDynamicFields = "0";
new GuiControl(JoinServerWindow) {
position = "48 56";
extent = "928 655";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiPanel(JoinServerTitlePanel) {
extent = "1281 80";
horizSizing = "width";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
new GuiBitmapBarCtrl() {
BitmapAsset = "UI:panel_image";
extent = "927 40";
horizSizing = "width";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl() {
text = "JOIN SERVER";
position = "22 10";
extent = "207 28";
position = "22 23";
extent = "220 28";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
new GuiBitmapBarCtrl() {
BitmapAsset = "UI:panel_low_image";
position = "0 40";
extent = "927 618";
horizSizing = "width";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl(JS_status) {
text = "No servers found.";
maxLength = "255";
position = "392 47";
extent = "148 18";
minExtent = "8 8";
};
new GuiContainer() {
position = "203 81";
extent = "900 30";
profile = GuiMenuPanelProfile;
tooltipProfile = "GuiToolTipProfile";
horizSizing = "center";
vertSizing = "bottom";
new GuiTextCtrl() {
text = "Server Details";
position = "0 0";
extent = "730 30";
horizSizing = "right";
vertSizing = "center";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl() {
text = "Players";
maxLength = "255";
position = "269 67";
extent = "36 18";
minExtent = "8 8";
profile = "GuiMLWhiteTextProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiTextCtrl() {
text = "Version";
maxLength = "255";
position = "335 67";
extent = "38 18";
minExtent = "8 8";
profile = "GuiMLWhiteTextProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiTextCtrl() {
text = "Game";
maxLength = "255";
position = "412 67";
extent = "28 18";
minExtent = "8 8";
profile = "GuiMLWhiteTextProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiTextCtrl() {
text = "Ping";
maxLength = "255";
position = "212 67";
extent = "20 18";
minExtent = "8 8";
profile = "GuiMLWhiteTextProfile";
position = "730 0";
extent = "50 30";
horizSizing = "left";
vertSizing = "center";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiTextCtrl() {
text = "Server Name";
maxLength = "255";
position = "12 67";
extent = "63 18";
minExtent = "8 8";
profile = "GuiMLWhiteTextProfile";
text = "Player Count";
position = "780 0";
extent = "120 30";
horizSizing = "left";
vertSizing = "center";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiScrollCtrl() {
hScrollBar = "dynamic";
vScrollBar = "dynamic";
position = "19 98";
extent = "890 501";
minExtent = "8 8";
profile = "GuiMenuScrollProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiScrollCtrl() {
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
position = "203 111";
extent = "900 601";
minExtent = "8 8";
horizSizing = "center";
vertSizing = "height";
profile = "GuiMenuScrollProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiStackControl(JoinServerList) {
padding = "10";
changeChildSizeToFit = "0";
position = "1 1";
extent = "888 16";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
};
new GuiStackControl(JoinServerList) {
padding = "10";
changeChildSizeToFit = "0";
position = "1 1";
extent = "888 16";
horizSizing = "center";
vertSizing = "center";
profile = "GuiMenuDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
};
new GuiControl(JS_queryStatus) {
position = "16 615";
extent = "900 35";
profile = "GuiDefaultProfile";
visible = "0";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
hidden = "1";
new GuiProgressCtrl(JS_statusBar) {
position = "84 0";
extent = "695 35";
minExtent = "8 8";
profile = "GuiProgressProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiButtonCtrl(JS_cancelQuery) {
text = "Cancel!";
extent = "84 35";
minExtent = "8 8";
profile = "GuiMenuButtonProfile";
command = "JoinServerDlg.cancel();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl(JS_statusText) {
text = "Querying master server";
maxLength = "255";
position = "84 0";
extent = "695 35";
minExtent = "8 8";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "0";
};
new GuiPanel(JoinServerButtonPanel) {
position = "0 683";
extent = "1281 40";
horizSizing = "width";
vertSizing = "top";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiIconButtonCtrl(JoinServerJoinBtn) {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Join";
position = "1115 0";
extent = "140 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "JoinServerMenu.query();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiIconButtonCtrl(JoinServerQLanBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Query Lan";
position = "965 0";
extent = "140 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "JoinServerMenu.queryLan();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiIconButtonCtrl(JoinServerQServerBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Query Server";
position = "817 0";
extent = "140 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "JoinServerMenu.join();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiIconButtonCtrl(JoinServerBackBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Back";
position = "16 0";
extent = "140 40";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "Canvas.popDialog();";
tooltipProfile = "GuiToolTipProfile";
};
};
};

View file

@ -1,17 +1,19 @@
function JoinServerMenu::onWake(%this)
{
$MenuList = JoinServerList;
JoinServerList.listPosition = 0;
}
function JoinServerMenu::onOpen(%this)
if(!isObject( JoinServerActionMap ) )
{
JoinServerList.setAsActiveMenuList();
$activeMenuButtonContainer-->button1.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
$activeMenuButtonContainer-->button2.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
$activeMenuButtonContainer-->button3.set("btn_x", "E", "Query Online", "JoinServerMenu.query();");
$activeMenuButtonContainer-->button4.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "cancelServerQuery(); " @ %this @ ".navigation.popPage();");
new ActionMap(JoinServerActionMap){};
JoinServerActionMap.bindCmd( keyboard, q, "JoinServerMenu.query();" );
JoinServerActionMap.bindCmd( gamepad, btn_x, "JoinServerMenu.query();" );
JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" );
JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" );
}
//----------------------------------------
@ -93,19 +95,17 @@ function JoinServerMenu::update(%this)
%sc = getServerCount();
for( %i = 0; %i < %sc; %i ++ ) {
setServerInfo(%i);
%serverBtn = new GuiButtonCtrl(){
text = $ServerInfo::Name TAB
$ServerInfo::Ping TAB
$ServerInfo::PlayerCount @ "/" @ $ServerInfo::MaxPlayers TAB
$ServerInfo::Version TAB
$ServerInfo::MissionName;
profile = GuiJoinServerButtonProfile;
extent = JoinServerList.extent.x SPC 30;
};
JoinServerList.add(%serverBtn);
%serverEntry = %this.addServerEntry();
%serverEntry-->serverNameTxt.text = $ServerInfo::Name;
%serverEntry-->serverDetailsTxt.text = $ServerInfo::Version @ " | " @ $ServerInfo::MissionName @ " | " @ $ServerInfo::MissionType;
%serverEntry-->pingTxt.text = $ServerInfo::Ping @ " ms";
%serverEntry-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers;
%serverEntry.resize(0, 0, JoinServerList.extent.x, %serverEntry.extent.y);
JoinServerList.add(%serverEntry);
}
$activeMenuButtonContainer-->button4.setActive(JoinServerList.getCount() > 0);
}
//----------------------------------------
@ -138,3 +138,109 @@ function onServerQueryStatus(%status, %msg, %value)
JoinServerMenu.update();
}
}
function JoinServerMenu::addServerEntry(%this)
{
%entry = new GuiContainer() {
position = "0 0";
extent = "900 40";
profile = GuiMenuDefaultProfile;
tooltipProfile = "GuiToolTipProfile";
horizSizing = "width";
vertSizing = "bottom";
class = "JoinServerServerEntry";
new GuiButtonCtrl() {
profile = GuiMenuButtonProfile;
position = "0 0";
extent = "900 40";
horizSizing = "width";
vertSizing = "height";
internalName = "button";
};
new GuiTextCtrl() {
position = "0 0";
extent = "730 20";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "serverNameTxt";
};
new GuiTextCtrl() {
position = $optionsEntryPad SPC 17;
extent = "730 18";
profile = "GuiMLTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "serverDetailsTxt";
};
new GuiTextCtrl() {
position = "730 0";
extent = "50 40";
horizSizing = "left";
vertSizing = "center";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "pingTxt";
};
new GuiTextCtrl() {
position = "780 0";
extent = "120 40";
horizSizing = "left";
vertSizing = "center";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "playerCountTxt";
};
};
return %entry;
}
function JoinServerMenu::addStatusEntry(%this)
{
%entry = new GuiContainer() {
position = "0 0";
extent = "900 40";
profile = GuiMenuDefaultProfile;
tooltipProfile = "GuiToolTipProfile";
horizSizing = "width";
vertSizing = "bottom";
class = "JoinServerStatusEntry";
new GuiTextCtrl() {
position = "0 0";
extent = "730 20";
profile = "MenuSubHeaderCenteredText";
tooltipProfile = "GuiToolTipProfile";
internalName = "statusTxt";
};
};
return %entry;
}
function JoinServerList::syncGui(%this)
{
%this.callOnChildren("setHighlighted", false);
if(%this.listPosition < %this.getCount())
{
%btn = %this.getObject(%this.listPosition);
%btn-->button.setHighlighted(true);
}
//
//Update the button imagery to comply to the last input device we'd used
%device = Canvas.getLastInputDevice();
if(%device $= "mouse")
%device = "keyboard";
JoinServerBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
JoinServerJoinBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIActivateSelected"));
JoinServerQLanBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.queryLan();"));
JoinServerQServerBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.query();"));
//JoinServerJoinBtn.setActive($selectedLevelAsset !$= "");
}

View file

@ -6,22 +6,20 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
category = "BaseUI";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
new GuiInputCtrl(MainMenuInputHandler) {
sendAxisEvents = "0";
sendBreakEvents = "0";
ignoreMouseEvents = "1";
ActionMap = "BaseUIActionMap";
position = "-50 0";
extent = "2186 851";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
//class = "MenuInputHandler";
actionMap = MainMenuActionMap;
};
new GuiBitmapCtrl(SideBackgroundImage) {
BitmapAsset = "UI:menu_side_background_image";
@ -33,7 +31,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
};
new GuiBitmapCtrl(MainMenuAppLogo) {
BitmapAsset = "UI:Torque_3D_logo_image";
position = "462 30";
position = "460 78";
extent = "360 100";
horizSizing = "center";
profile = "GuiDefaultProfile";
@ -73,7 +71,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
new GuiStackControl(MainMenuButtonList) {
padding = "5";
dynamicSize = "0";
position = "440 185";
position = "440 199";
extent = "400 322";
horizSizing = "center";
vertSizing = "center";
@ -85,7 +83,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
text = "Single Player";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "openSinglePlayerMenu();";
command = "$pref::HostMultiPlayer=false;\nCanvas.pushDialog(ChooseLevelMenu);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
@ -93,7 +91,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
position = "0 45";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "openMultiPlayerMenu();";
command = "$pref::HostMultiPlayer=true;Canvas.pushDialog(ChooseLevelMenu);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
@ -101,7 +99,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
position = "0 90";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "openJoinServerMenu();";
command = "Canvas.pushDialog(JoinServerMenu);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuOptionBtn) {
@ -117,7 +115,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
position = "0 180";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "openWorldEditorBtn();";
command = "fastLoadWorldEdit(1);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuGuiEditBtn) {
@ -125,7 +123,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
position = "0 225";
extent = "400 40";
profile = "GuiMenuButtonProfile";
command = "openGUIEditorBtn();";
command = "fastLoadGUIEdit(1);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl(MainMenuExitBtn) {

View file

@ -4,60 +4,84 @@ function MainMenuGui::onAdd(%this)
function MainMenuGui::onWake(%this)
{
MainMenuButtonList.listPosition = 0;
$MenuList = MainMenuButtonList;
$MenuList.listPosition = 0;
}
if(!isObject( MainMenuActionMap ) )
function MainMenuGui::onSleep(%this)
{
new ActionMap(MainMenuActionMap){};
MainMenuActionMap.bind( keyboard, w, mainMenuNavigateUp );
MainMenuActionMap.bind( keyboard, s, mainMenuNavigateDown );
MainMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", mainMenuStickNavigate );
MainMenuActionMap.bind( gamepad, upov, mainMenuNavigateUp );
MainMenuActionMap.bind( gamepad, dpov, mainMenuNavigateDown );
MainMenuActionMap.bind( keyboard, Enter, activateSelected );
MainMenuActionMap.bind( gamepad, btn_a, activateSelected );
}
function mainMenuNavigateUp(%val)
if(!isObject( BaseUIActionMap ) )
{
new ActionMap(BaseUIActionMap){};
BaseUIActionMap.bind( keyboard, w, BaseUINavigatePrev );
BaseUIActionMap.bind( keyboard, s, BaseUINavigateNext );
BaseUIActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", BaseUIStickNavigate );
BaseUIActionMap.bind( gamepad, upov, BaseUINavigatePrev );
BaseUIActionMap.bind( gamepad, dpov, BaseUINavigateNext );
BaseUIActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
BaseUIActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
BaseUIActionMap.bind( keyboard, Escape, BaseUIBackOut );
BaseUIActionMap.bind( gamepad, btn_b, BaseUIBackOut );
}
function BaseUINavigatePrev(%val)
{
if(%val)
{
MainMenuButtonList.listPosition -= 1;
if(MainMenuButtonList.listPosition < 0)
MainMenuButtonList.listPosition = 0;
$MenuList.listPosition -= 1;
if($MenuList.listPosition < 0)
$MenuList.listPosition = 0;
MainMenuGUI.syncGUI();
$MenuList.syncGUI();
}
}
function mainMenuNavigateDown(%val)
function BaseUINavigateNext(%val)
{
if(%val)
{
MainMenuButtonList.listPosition += 1;
if(MainMenuButtonList.listPosition >= MainMenuButtonList.getCount())
MainMenuButtonList.listPosition = MainMenuButtonList.getCount()-1;
$MenuList.listPosition += 1;
if($MenuList.listPosition >= $MenuList.getCount())
$MenuList.listPosition = $MenuList.getCount()-1;
MainMenuGUI.syncGUI();
$MenuList.syncGUI();
}
}
function mainMenuStickNavigate(%val)
function BaseUIStickNavigate(%val)
{
if(%val == -1)
mainMenuNavigateUp(1);
BaseUINavigateNext(1);
else if(%val == 1)
mainMenuNavigateDown(1);
}
function MainMenuGUI::syncGUI(%this)
function BaseUIBackOut(%val)
{
MainMenuButtonList.callOnChildren("setHighlighted", false);
//we can't navigate further back than the MainMenuGui
if(%val && Canvas.getObject(Canvas.getCount()-1) != MainMenuGui)
{
Canvas.popDialog();
%topMenu = Canvas.getObject(Canvas.getCount()-1);
if(isObject(%topMenu))
{
//re-kick the on-wake so we can be fully up to date and relevently
//contexted
%topMenu.onWake();
}
}
}
function MainMenuButtonList::syncGUI(%this)
{
%this.callOnChildren("setHighlighted", false);
%btn = MainMenuButtonList.getObject(MainMenuButtonList.listPosition);
%btn = %this.getObject(%this.listPosition);
%btn.setHighlighted(true);
//
@ -66,25 +90,13 @@ function MainMenuGUI::syncGUI(%this)
if(%device $= "mouse")
%device = "keyboard";
%binding = MainMenuActionMap.getBinding("activateSelected");
%bindingCount = getFieldCount(%binding);
for(%i=0; %i < %bindingCount; %i+=2)
{
%mapDevice = stripTrailingNumber(getField(%binding, %i));
if(%mapDevice $= %device)
{
%button = getField(%binding, %i+1);
break;
}
}
%assetId = getButtonBitmap(%device, %button);
MainMenuGoButton.setBitmap(%assetId);
MainMenuGoButton.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIActivateSelected"));
}
function activateSelected()
function BaseUIActivateSelected()
{
%btn = MainMenuButtonList.getObject(MainMenuButtonList.listPosition);
%btn.performClick();
%btn = $MenuList.getObject($MenuList.listPosition);
if(%btn.isMethod("performClick"))
%btn.performClick();
}

View file

@ -1,347 +1,75 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(MessageBoxDlg) {
position = "0 0";
extent = "1024 768";
extent = "1280 720";
minExtent = "8 8";
horizSizing = "width";
vertSizing = "height";
profile = "GuiOverlayProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
helpTag = "0";
new GuiControl(MessageBoxCtrl) {
position = "192 197";
extent = "641 381";
minExtent = "8 2";
new GuiInputCtrl(MessageBoxInputHandler) {
ignoreMouseEvents = "1";
ActionMap = "MessageBoxActionMap";
position = "-50 0";
extent = "2186 851";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiBitmapCtrl() {
BitmapAsset = "UI:backdrop_image";
position = "272 128";
extent = "735 463";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiControl(MessageBoxCtrl) {
position = "319 169";
extent = "641 381";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiBitmapBarCtrl() {
percent = "100";
vertical = "0";
flipClip = "0";
bitmapAsset = "UI:panel_image";
color = "255 255 255 255";
position = "0 0";
extent = "641 40";
minExtent = "8 2";
new GuiPanel() {
extent = "641 381";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
vertSizing = "height";
profile = "GuiMenuBasePanelProfile";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl(MessageBoxTitleText) {
text = "OPTIONS";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "32 7";
extent = "577 28";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "MenuHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiBitmapBarCtrl() {
percent = "100";
vertical = "0";
flipClip = "0";
bitmapAsset = "UI:panel_low_image";
color = "255 255 255 255";
position = "0 40";
extent = "641 341";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiMLTextCtrl(MessageBoxText) {
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
useURLMouseCursor = "0";
position = "81 83";
extent = "481 19";
minExtent = "8 8";
horizSizing = "center";
vertSizing = "center";
profile = "MenuMLSubHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiControl(MessageBoxOKButtonHolder) {
position = "0 285";
extent = "642 40";
minExtent = "8 2";
horizSizing = "center";
new GuiStackControl(MessageBoxButtonHolder) {
stackingType = "Horizontal";
position = "250 285";
extent = "140 40";
horizSizing = "width";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
class = "MenuInputButtonContainer";
canSave = "1";
canSaveDynamicFields = "0";
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Go";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "251 0";
extent = "140 40";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuButtonList.activateRow();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "OKButton";
class = "MenuInputButton";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl(MessageBoxOCButtonHolder) {
position = "0 285";
extent = "642 40";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
class = "MenuInputButtonContainer";
canSave = "1";
canSaveDynamicFields = "0";
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Go";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "171 0";
extent = "140 40";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuButtonList.activateRow();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "OKButton";
class = "MenuInputButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Go";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "323 0";
extent = "140 40";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuButtonList.activateRow();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "CancelButton";
class = "MenuInputButton";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl(MessageBoxYNCButtonHolder) {
position = "0 285";
extent = "642 40";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
class = "MenuInputButtonContainer";
canSave = "1";
canSaveDynamicFields = "0";
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Go";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "99 0";
extent = "140 40";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuButtonList.activateRow();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "yesButton";
class = "MenuInputButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Go";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "251 0";
extent = "140 40";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuButtonList.activateRow();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "noButton";
class = "MenuInputButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Go";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "403 0";
extent = "140 40";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuButtonList.activateRow();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "CancelButton";
class = "MenuInputButton";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
};

View file

@ -0,0 +1,218 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// --------------------------------------------------------------------
// Message Sound
// --------------------------------------------------------------------
/*new SFXDescription(MessageBoxAudioDescription)
{
volume = 1.0;
isLooping = false;
is3D = false;
channel = $GuiAudioType;
};
new SFXProfile(messageBoxBeep)
{
filename = "./messageBoxSound";
description = MessageBoxAudioDescription;
preload = true;
};*/
//---------------------------------------------------------------------------------------------
// messageCallback
// Calls a callback passed to a message box.
//---------------------------------------------------------------------------------------------
function messageCallback(%dlg, %callback)
{
Canvas.popDialog(%dlg);
eval(%callback);
}
//---------------------------------------------------------------------------------------------
// MBSetText
// Sets the text of a message box and resizes it to accomodate the new string.
//---------------------------------------------------------------------------------------------
function MBSetText(%text, %frame, %msg)
{
// Get the extent of the text box.
%ext = %text.getExtent();
// Set the text in the center of the text box.
%text.setText("<just:center>" @ %msg);
// Force the textbox to resize itself vertically.
%text.forceReflow();
// Grab the new extent of the text box.
%newExtent = %text.getExtent();
// Get the vertical change in extent.
%deltaY = getWord(%newExtent, 1) - getWord(%ext, 1);
// Resize the window housing the text box.
%windowPos = %frame.getPosition();
%windowExt = %frame.getExtent();
%frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2),
getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY);
%frame.canMove = "0";
//%frame.canClose = "0";
%frame.resizeWidth = "0";
%frame.resizeHeight = "0";
%frame.canMinimize = "0";
%frame.canMaximize = "0";
//sfxPlayOnce( messageBoxBeep );
}
function MessageBoxCtrl::onWake(%this)
{
%this.callback = "";
%this.cancelCallback = "";
}
//---------------------------------------------------------------------------------------------
// Various message box display functions. Each one takes a window title, a message, and a
// callback for each button.
//---------------------------------------------------------------------------------------------
function MessageBoxCtrl::createButton(%this, %text, %command, %bitmap)
{
%btn = new GuiIconButtonCtrl() {
BitmapAsset = %bitmap;
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
iconLocation = "Left";
text = %text;
position = "251 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
command = %command;
tooltipProfile = "GuiToolTipProfile";
};
MessageBoxButtonHolder.add(%btn);
//update positioning of the holder to be centered
MessageBoxButtonHolder.position.x = MessageBoxCtrl.extent.x/2 - MessageBoxButtonHolder.extent.x/2;
return %btn;
}
function MessageBoxDlg::onWake(%this)
{
}
if(!isObject( MessageBoxActionMap ) )
{
new ActionMap(MessageBoxActionMap){};
MessageBoxActionMap.bind( keyboard, Enter, messageBoxYesClicked );
MessageBoxActionMap.bind( gamepad, btn_a, messageBoxYesClicked );
MessageBoxActionMap.bind( keyboard, Escape, messageBoxNoClicked );
MessageBoxActionMap.bind( gamepad, btn_b, messageBoxNoClicked );
}
function MessageBoxCtrl::syncGui(%this)
{
}
function messageBoxYesClicked(%this)
{
MessageCallback(MessageBoxDlg, MessageBoxDlg.callback);
}
function messageBoxNoClicked(%this)
{
MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);
}
//MessageBoxOK("Test", "This is a test message box", "echo(\"Uhhhhhawhat?\"");
function MessageBoxOK(%title, %message, %callback)
{
MessageBoxButtonHolder.clear();
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
%okButton = MessageBoxCtrl.createButton("OK", "messageBoxYesClicked();");
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked");
%okButton.setBitmap(%bitmapAssetId);
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
MessageBoxDlg.callback = %callback;
}
function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride)
{
MessageBoxButtonHolder.clear();
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
if(%okLabelOverride $= "")
%okLabel = "OK";
else
%okLabel = %okLabelOverride;
if(%cancelLabelOverride $= "")
%cancelLabel = "Cancel";
else
%cancelLabel = %cancelLabelOverride;
%okButton = MessageBoxCtrl.createButton(%okLabel, "messageBoxYesClicked();");
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked");
%okButton.setBitmap(%bitmapAssetId);
%cancelButton = MessageBoxCtrl.createButton(%cancelLabel, "messageBoxNoClicked();");
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxNoClicked");
%cancelButton.setBitmap(%bitmapAssetId);
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
MessageBoxDlg.callback = %callback;
MessageBoxDlg.cancelCallback = %cancelCallback;
}
function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback)
{
MessageBoxOKCancel(%title, %message, %yesCallback, %noCallback, "Yes", "No");
}
//---------------------------------------------------------------------------------------------
// MessagePopup
// Displays a message box with no buttons. Disappears after %delay milliseconds.
//---------------------------------------------------------------------------------------------
function MessagePopup(%title, %message, %delay)
{
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
if (%delay !$= "")
schedule(%delay, 0, CloseMessagePopup);
}
function CloseMessagePopup()
{
Canvas.popDialog(MessageBoxDlg);
}

View file

@ -6,73 +6,94 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
category = "BaseUI";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
currentCategory = "Graphics";
optionsCategories = "17233";
unappliedChanges = "17234";
optionsCategories = "17237";
unappliedChanges = "17238";
new GuiControl(OptionsMenuContainer) {
position = "208 32";
extent = "870 655";
horizSizing = "aspectCenter";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
};
new GuiInputCtrl(MainMenuInputHandler) {
new GuiInputCtrl(OptionsMenuInputHandler) {
ignoreMouseEvents = "1";
ActionMap = "MainMenuActionMap";
position = "-49 0";
ActionMap = "OptionsMenuActionMap";
position = "-50 0";
extent = "2186 851";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiStackControl(OptionsMenuCategoryList) {
stackingType = "Horizontal";
padding = "10";
dynamicSize = "0";
position = "398 80";
extent = "471 40";
new GuiControl(OptionsMenuCategoryContainer) {
position = "332 80";
extent = "617 49";
horizSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
isContainer = "1";
new GuiButtonCtrl() {
text = "Video";
extent = "100 40";
new GuiIconButtonCtrl(OptionsMenuCatPrevBtn) {
BitmapAsset = "UI:Keyboard_Black_Q_image";
iconLocation = "Center";
makeIconSquare = "1";
textLocation = "Center";
bitmapMargin = "30";
position = "1 4";
extent = "50 40";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "populateDisplaySettingsList();";
command = "OptionsMenuCategoryPrev();";
tooltipProfile = "GuiToolTipProfile";
class = "MenuInputButton";
};
new GuiButtonCtrl() {
text = "Audio";
position = "110 0";
extent = "100 40";
new GuiIconButtonCtrl(OptionsMenuCatNextBtn) {
BitmapAsset = "UI:Keyboard_Black_E_image";
iconLocation = "Center";
makeIconSquare = "1";
bitmapMargin = "30";
position = "568 4";
extent = "50 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "populateAudioSettingsList();";
command = "OptionsMenuCategoryNext();";
tooltipProfile = "GuiToolTipProfile";
class = "MenuInputButton";
};
new GuiButtonCtrl() {
text = "Keyboard & Mouse";
position = "220 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
command = "populateKeyboardMouseSettingsList();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Gamepad";
position = "370 0";
extent = "100 40";
profile = "GuiMenuButtonProfile";
command = "populateGamepadSettingsList();";
new GuiStackControl(OptionsMenuCategoryList) {
stackingType = "Horizontal";
padding = "10";
dynamicSize = "0";
position = "137 3";
extent = "358 40";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
new GuiButtonCtrl() {
text = "Video";
extent = "100 40";
profile = "GuiMenuButtonProfile";
command = "populateDisplaySettingsList();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Audio";
position = "110 0";
extent = "100 40";
profile = "GuiMenuButtonProfile";
command = "populateAudioSettingsList();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Controls";
position = "220 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
command = "populateKeyboardMouseSettingsList();";
tooltipProfile = "GuiToolTipProfile";
};
};
};
new GuiScrollCtrl(OptionsMenuSettingsScroll) {
@ -89,13 +110,227 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
padding = "5";
changeChildSizeToFit = "0";
position = "1 1";
extent = "603 245";
extent = "603 200";
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
visible = true;
new GuiTextCtrl() {
text = "Basic";
extent = "500 30";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
new GuiContainer() {
position = "0 35";
extent = "603 40";
horizSizing = "width";
profile = "GuiMenuDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
class = "OptionsListEntry";
new GuiButtonCtrl() {
extent = "603 40";
horizSizing = "width";
vertSizing = "height";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "Button";
class = "optionsMenuButton";
};
new GuiTextCtrl() {
text = "Graphical Quality";
position = "10 -1";
extent = "250 20";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "OptionName";
};
new GuiTextCtrl() {
text = "Controls the general graphical quality";
position = "10 17";
extent = "178 18";
profile = "GuiMLTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "OptionDescription";
};
new GuiContainer() {
position = "353 0";
extent = "250 40";
horizSizing = "left";
vertSizing = "height";
profile = "GuiModelessDialogProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "valuesContainer";
new GuiButtonCtrl() {
text = "<";
position = "160 0";
extent = "20 40";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl() {
text = "High";
position = "180 0";
extent = "50 40";
vertSizing = "center";
profile = "GuiMenuTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "optionValue";
};
new GuiButtonCtrl() {
text = ">";
position = "230 0";
extent = "20 40";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
};
};
};
new GuiContainer() {
position = "0 80";
extent = "603 40";
horizSizing = "width";
profile = "GuiMenuDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
class = "OptionsListEntry";
new GuiButtonCtrl() {
extent = "603 40";
horizSizing = "width";
vertSizing = "height";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "Button";
class = "optionsMenuButton";
};
new GuiTextCtrl() {
text = "Lighting Quality";
position = "10 -1";
extent = "250 20";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "OptionName";
};
new GuiTextCtrl() {
text = "Controls the lighting and shadows quality";
position = "10 17";
extent = "198 18";
profile = "GuiMLTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "OptionDescription";
};
new GuiContainer() {
position = "353 0";
extent = "250 40";
horizSizing = "left";
vertSizing = "height";
profile = "GuiModelessDialogProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "valuesContainer";
new GuiButtonCtrl() {
text = "<";
position = "160 0";
extent = "20 40";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl() {
text = "High";
position = "180 0";
extent = "50 40";
vertSizing = "center";
profile = "GuiMenuTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "optionValue";
};
new GuiButtonCtrl() {
text = ">";
position = "230 0";
extent = "20 40";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
};
};
};
new GuiTextCtrl() {
text = "Advanced";
position = "0 125";
extent = "500 30";
profile = "MenuHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
new GuiContainer() {
position = "0 160";
extent = "603 40";
horizSizing = "width";
profile = "GuiMenuDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
class = "OptionsListEntry";
new GuiButtonCtrl() {
extent = "603 40";
horizSizing = "width";
vertSizing = "height";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "Button";
class = "optionsMenuButton";
};
new GuiTextCtrl() {
text = "Mesh Detail";
position = "10 -1";
extent = "250 20";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "OptionName";
};
new GuiTextCtrl() {
text = "Controls the max quality of mesh objects";
position = "10 17";
extent = "195 18";
profile = "GuiMLTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "OptionDescription";
};
new GuiContainer() {
position = "353 0";
extent = "250 40";
horizSizing = "left";
vertSizing = "height";
profile = "GuiModelessDialogProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "valuesContainer";
new GuiButtonCtrl() {
text = "<";
position = "160 0";
extent = "20 40";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextCtrl() {
text = "High";
position = "180 0";
extent = "50 40";
vertSizing = "center";
profile = "GuiMenuTextProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "optionValue";
};
new GuiButtonCtrl() {
text = ">";
position = "230 0";
extent = "20 40";
profile = "GuiMenuButtonProfile";
tooltipProfile = "GuiToolTipProfile";
};
};
};
};
new GuiStackControl(AudioSettingsList) {
padding = "5";
@ -105,9 +340,10 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
visible = "0";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
visible = false;
hidden = "1";
};
new GuiStackControl(ControlSettingsList) {
padding = "5";
@ -117,9 +353,10 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
visible = "0";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
visible = false;
hidden = "1";
};
};
new GuiPanel(OptionMenuTitlePanel) {
@ -136,7 +373,7 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
tooltipProfile = "GuiToolTipProfile";
};
};
new GuiPanel(MainMenuButtonPanel) {
new GuiPanel(OptionsMenuButtonPanel) {
position = "0 683";
extent = "1281 40";
horizSizing = "width";
@ -144,7 +381,7 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiIconButtonCtrl() {
new GuiIconButtonCtrl(OptionsMenuApplyBtn) {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -155,12 +392,11 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "MainMenuSelectButton(1);";
command = "OptionsMenu.applySettings();";
tooltipProfile = "GuiToolTipProfile";
internalName = "button4";
class = "MenuInputButton";
};
new GuiIconButtonCtrl() {
new GuiIconButtonCtrl(OptionsMenuBackBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -168,44 +404,27 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) {
text = "Back";
position = "16 0";
extent = "140 40";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "Canvas.popDialog();";
tooltipProfile = "GuiToolTipProfile";
class = "MenuInputButton";
};
new GuiIconButtonCtrl(OptionsMenuResetBtn) {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Center";
text = "Reset";
position = "947 0";
extent = "140 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "MainMenuSelectButton(1);";
command = "OptionsMenu.resetSettings();";
tooltipProfile = "GuiToolTipProfile";
internalName = "button4";
class = "MenuInputButton";
};
};
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_E_image";
iconLocation = "Center";
sizeIconToButton = "1";
makeIconSquare = "1";
position = "899 80";
extent = "50 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "MainMenuSelectButton(1);";
tooltipProfile = "GuiToolTipProfile";
internalName = "button4";
class = "MenuInputButton";
};
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_Q_image";
iconLocation = "Center";
sizeIconToButton = "1";
makeIconSquare = "1";
position = "331 80";
extent = "50 40";
horizSizing = "left";
vertSizing = "center";
profile = "GuiMenuButtonProfile";
command = "MainMenuSelectButton(1);";
tooltipProfile = "GuiToolTipProfile";
internalName = "button4";
class = "MenuInputButton";
};
};
//--- OBJECT WRITE END ---

View file

@ -48,6 +48,7 @@
$yesNoList = "No\tYes";
$onOffList = "Off\tOn";
$optionsEntryPad = 10;
function OptionsMenu::onAdd(%this)
{
@ -63,12 +64,6 @@ function OptionsMenu::onAdd(%this)
%this.currentCategory = "";
addOptionsMenuCategory("Display", "populateDisplaySettingsList();");
addOptionsMenuCategory("Graphics", "populateGraphicsSettingsList();");
addOptionsMenuCategory("Audio", "populateAudioSettingsList();");
addOptionsMenuCategory("Keyboard & Mouse", "populateKeyboardMouseSettingsList();");
addOptionsMenuCategory("Gamepad", "populateGamepadSettingsList();");
callOnModules("populateOptionsMenuCategories", "Game");
}
@ -93,28 +88,147 @@ function OptionsMenu::onWake(%this)
{
%option = %setting.getObject(%s);
%optionsEntry = addOptionEntry();
%optionsEntry-->optionName.text = %option.OptionName;
%optionsEntry-->optionDescription.text = %option.Description;
%optionsEntry-->optionValue.text = %option.getObject(0).displayName;
%optionsEntry = addOptionEntry(%option);
if(isObject(%optionsEntry))
{
%optionsEntry.resize(0, 0, VideoSettingsList.extent.x, %optionsEntry.extent.y);
VideoSettingsList.add(%optionsEntry);
}
}
}
else if(%setting.class $= "OptionsSettings")
{
%entry = addOptionEntry();
%entry-->optionName.text = %setting.displayName;
%entry-->optionDescription.text = %setting.description;
%entry-->optionValue.text = %setting.getObject(0).displayName;
if(isObject(%entry))
VideoSettingsList.add(%entry);
%optionsEntry = addOptionEntry(%option);
if(isObject(%optionsEntry))
{
%optionsEntry.resize(0, 0, VideoSettingsList.extent.x, %optionsEntry.extent.y);
VideoSettingsList.add(%optionsEntry);
}
}
}
$MenuList = VideoSettingsList;
//Find our first non-group entry
while($MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry && $MenuList.listPosition < $MenuList.getCount())
{
$MenuList.listPosition += 1;
}
}
if(!isObject( OptionsMenuActionMap ) )
{
new ActionMap(OptionsMenuActionMap){};
OptionsMenuActionMap.bind( keyboard, w, OptionMenuNavigatePrev );
OptionsMenuActionMap.bind( keyboard, s, OptionMenuNavigateNext );
OptionsMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", OptionMenuStickNavigate );
OptionsMenuActionMap.bind( gamepad, upov, OptionMenuNavigatePrev );
OptionsMenuActionMap.bind( gamepad, dpov, OptionMenuNavigateNext );
OptionsMenuActionMap.bind( keyboard, a, OptionMenuPrevSetting );
OptionsMenuActionMap.bind( keyboard, d, OptionMenuNextSetting );
OptionsMenuActionMap.bind( gamepad, xaxis, "D", "-0.23 0.23", OptionMenuStickChangeSetting );
OptionsMenuActionMap.bind( gamepad, lpov, OptionMenuPrevSetting );
OptionsMenuActionMap.bind( gamepad, lpov, OptionMenuNextSetting );
//OptionsMenuActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
//OptionsMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
}
function VideoSettingsList::syncGui(%this)
{
%this.callOnChildren("setHighlighted", false);
%btn = %this.getObject(%this.listPosition);
if(%btn.class $= "OptionsListEntry")
%btn-->button.setHighlighted(true);
}
//
function OptionMenuNavigatePrev(%val)
{
if(%val)
{
$MenuList.listPosition -= 1;
while( $MenuList.listPosition >= 0 && $MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry)
{
$MenuList.listPosition -= 1;
}
if($MenuList.listPosition < 0)
$MenuList.listPosition = 0;
$MenuList.syncGUI();
}
}
function OptionMenuNavigateNext(%val)
{
if(%val)
{
$MenuList.listPosition += 1;
while($MenuList.listPosition < $MenuList.getCount() && $MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry)
{
$MenuList.listPosition += 1;
}
if($MenuList.listPosition >= $MenuList.getCount())
$MenuList.listPosition = $MenuList.getCount()-1;
$MenuList.syncGUI();
}
}
function OptionMenuStickNavigate(%val)
{
if(%val == -1)
BaseUINavigateNext(1);
else if(%val == 1)
mainMenuNavigateDown(1);
}
function OptionMenuPrevSetting(%val)
{
%option = $MenuList.getObject($MenuList.listPosition);
echo("Option: " @ %option.className);
%optionObject = %option.optionsObject;
%currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
echo("Changed option: " @ %optionObject.optionName @ " to level: " @ %currentOptionLevel.displayName);
/*$MenuList.listPosition -= 1;
if($MenuList.listPosition < 0)
$MenuList.listPosition = 0;*/
$MenuList.syncGUI();
}
function OptionMenuNextSetting(%val)
{
%option = $MenuList.getObject($MenuList.listPosition);
%optionObject = %option.optionsObject;
%currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
echo("Changed option: " @ %optionObject.optionName @ " to level: " @ %currentOptionLevel.displayName);
/*$MenuList.listPosition += 1;
if($MenuList.listPosition >= $MenuList.getCount())
$MenuList.listPosition = $MenuList.getCount()-1;*/
$MenuList.syncGUI();
}
function OptionMenuStickChangeSetting(%val)
{
}
//
function OptionsMenu::onOpen(%this)
{
OptionsMenuCategoryList.clear();
@ -173,7 +287,7 @@ function OptionsMenu::canClose(%this)
//UINavigation to not close the page
if(OptionsMenuSettingsList.isActiveMenuList())
{
OptionsMenuCategoryList.setAsActiveMenuList();
OptionsMenuCategoryList.setAsActiveMenuList();
return false;
}
else
@ -1238,28 +1352,66 @@ function addOptionGroup()
};
return %group;
}
function addOptionEntry()
function optionsMenuButton::onHighlighted(%this, %highlighted)
{
%container = %this.getParent();
%container-->optionName.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText;
%container-->optionDescription.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile;
%valuesContainer = %container-->valuesContainer;
%valuesContainer-->optionValue.profile = %highlighted ? GuiMenuTextProfileHighlighted : GuiMenuTextProfile;
}
function optionsMenuButton::onMouseDown(%this)
{
//check if we're clicking on the left or right of the value and adjust it accordingly
}
function addOptionEntry(%optionObj)
{
if(!isObject(%optionObj) || %optionObj.class !$= "OptionsSettings")
{
error("addOptionsEntry() - attempting to create a new options entry, but was provided an invalid options object");
return 0;
}
%qualityLevel = %optionObj.getObject(0);
%entry = new GuiContainer() {
position = "0 0";
extent = "500 40";
profile = "GuiMenuPanelProfile";
profile = GuiMenuDefaultProfile;
tooltipProfile = "GuiToolTipProfile";
horizSizing = "width";
vertSizing = "bottom";
class = "OptionsListEntry";
optionsObject = %optionObj;
currentOptionIndex = 0;
new GuiButtonCtrl() {
profile = GuiMenuButtonProfile;
position = "0 0";
extent = "500 40";
horizSizing = "width";
vertSizing = "height";
internalName = "button";
class = "optionsMenuButton";
};
new GuiTextCtrl() {
text = "";
position = "1 -1";
text = %optionObj.OptionName;
position = $optionsEntryPad SPC -1;
extent = "250 20";
profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
internalName = "optionName";
};
new GuiTextCtrl() {
text = "Sets the resolution and detail of shadows";
position = "1 17";
text = %optionObj.Description;
position = $optionsEntryPad SPC 17;
extent = "250 18";
profile = "GuiMLTextProfile";
tooltipProfile = "GuiToolTipProfile";
@ -1273,17 +1425,32 @@ function addOptionEntry()
tooltipProfile = "GuiToolTipProfile";
horizSizing = "left";
vertSizing = "height";
internalName = "valuesContainer";
new GuiButtonCtrl() {
position = "160 0";
extent = "20 40";
text = "<";
profile = GuiMenuButtonProfile;
};
new GuiTextCtrl() {
text = "< High >";
text = %qualityLevel.displayName;
position = "180 0";
extent = "70 40";
extent = "50 40";
profile = "GuiMenuTextProfile";
tooltipProfile = "GuiToolTipProfile";
horizSizing = "left";
horizSizing = "right";
vertSizing = "center";
internalName = "optionValue";
};
new GuiButtonCtrl() {
position = "230 0";
extent = "20 40";
text = ">";
profile = GuiMenuButtonProfile;
};
};
};

View file

@ -1,163 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(PauseMenu) {
extent = "1024 768";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
superClass = "UINavigation";
canSaveDynamicFields = "1";
new GuiChunkedBitmapCtrl(PauseMenuBG) {
BitmapAsset = "UI:hudfill_image";
extent = "1024 768";
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "1";
};
new GuiInputCtrl(PauseMenuInputHandler) {
sendAxisEvents = "1";
sendBreakEvents = "1";
ignoreMouseEvents = "1";
position = "-50 0";
extent = "10 10";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile";
class = "MenuInputHandler";
};
new GuiControl(PauseMenuButtons) {
position = "162 125";
extent = "700 518";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
new GuiStackControl(PauseMenuList) {
padding = "15";
dynamicSize = "0";
extent = "700 320";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
superClass = "MenuList";
new GuiButtonCtrl() {
text = "Options";
extent = "700 55";
profile = "GuiMenuButtonProfile";
command = "openPauseMenuOptions();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Exit to Menu";
position = "0 70";
extent = "700 55";
profile = "GuiMenuButtonProfile";
command = "pauseMenuExitToMenu();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Exit to Desktop";
position = "0 140";
extent = "700 55";
profile = "GuiMenuButtonProfile";
command = "pauseMenuExitToDesktop();";
tooltipProfile = "GuiToolTipProfile";
};
};
};
new GuiControl(PauseButtonHolder) {
position = "144 711";
extent = "736 40";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
class = "MenuInputButtonContainer";
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
position = "11 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
tooltipProfile = "GuiToolTipProfile";
internalName = "button1";
class = "MenuInputButton";
hidden = "1";
};
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
position = "155 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
tooltipProfile = "GuiToolTipProfile";
internalName = "button2";
class = "MenuInputButton";
hidden = "1";
};
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
position = "299 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
tooltipProfile = "GuiToolTipProfile";
internalName = "button3";
class = "MenuInputButton";
hidden = "1";
};
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
position = "443 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
tooltipProfile = "GuiToolTipProfile";
internalName = "button4";
class = "MenuInputButton";
hidden = "1";
};
new GuiIconButtonCtrl() {
BitmapAsset = "UI:Keyboard_Black_Return_image";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
position = "587 0";
extent = "140 40";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
tooltipProfile = "GuiToolTipProfile";
internalName = "button5";
class = "MenuInputButton";
hidden = "1";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1,93 +0,0 @@
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)
{
}

View file

@ -1,4 +0,0 @@
<GUIAsset
AssetName="recordingsDlg"
GUIFile="@assetFile=RecordingsDlg.gui"
VersionId="1"/>