Initial pass to rework and cleanup the main UI interface

Implements interface buttons that react to input type and visually display keybinds
Updates the T3D icon and splash screen
This commit is contained in:
Areloch 2020-05-20 17:19:52 -05:00
parent 157b114ec7
commit bc27125e90
188 changed files with 2553 additions and 758 deletions

View file

@ -14,7 +14,6 @@
function UI::onCreate( %this )
{
%bool = true;
}
function UI::onDestroy( %this )
@ -36,9 +35,14 @@ function UI::initClient(%this)
//Profiles
exec("./scripts/profiles.cs");
exec("./scripts/menu.keybinds.cs");
//Now gui files
exec("./guis/mainMenu.gui");
exec("./guis/guiGamepadButton.cs");
exec("./guis/guiGamepadButton.gui");
exec("./guis/mainMenu.cs");
exec("./guis/mainMenu.gui");
exec("./guis/chooseLevelDlg.gui");
exec("./guis/chooseLevelDlg.cs");
@ -48,8 +52,8 @@ function UI::initClient(%this)
exec("./guis/loadingGui.gui");
exec("./guis/optionsMenu.gui");
exec("./guis/optionsMenu.cs");
exec("./guis/optionsMenu.gui");
exec("./guis/pauseMenu.gui");
exec("./guis/pauseMenu.cs");
@ -73,8 +77,7 @@ function UI::initClient(%this)
exec("./guis/startupGui.cs");
// Load Editor Dialogs
exec("./guis/messageBoxOk.gui");
exec("./guis/messageBoxYesNo.gui");
exec("./guis/messageBoxDlg.gui");
//Load scripts
exec("./scripts/optionsList.cs");
@ -89,9 +92,13 @@ function UI::initClient(%this)
exec("./guis/menuGraphics.gui");
exec("./guis/menuGraphics.cs");
//exec("./scripts/menu.keybinds.cs");
//exec("./scripts/GuiTreeViewCtrl.cs");
loadStartup();
//menuMoveMap.push();
}
function UI::onCreateClientConnection(%this){}

View file

@ -23,13 +23,15 @@
//----------------------------------------
function ChooseLevelDlg::onWake( %this )
{
CL_levelList.clear();
ChooseLevelWindow->SmallPreviews.clear();
if(!isObject(LevelListEntries))
new ArrayObject(LevelListEntries){};
LevelList.clearRows();
LevelListEntries.empty();
%this->CurrentPreview.visible = false;
%this->levelName.visible = false;
%this->LevelDescriptionLabel.visible = false;
%this->LevelDescription.visible = false;
ChooseLevelWindow->CurrentPreview.setBitmap("data/ui/images/no-preview");
ChooseLevelWindow->LevelDescriptionLabel.visible = false;
ChooseLevelWindow->LevelDescription.visible = false;
%assetQuery = new AssetQuery();
AssetDatabase.findAssetType(%assetQuery, "LevelAsset");
@ -76,13 +78,22 @@ function ChooseLevelDlg::onWake( %this )
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
}
// Sort our list
CL_levelList.sort(0);
// Set the first row as the selected row
CL_levelList.setSelectedRow(0);
for (%i = 0; %i < CL_levelList.rowCount(); %i++)
for(%i=0; %i < LevelListEntries.count(); %i++)
{
%levelEntry = LevelListEntries.getKey(%i);
LevelList.addRow(getField(%levelEntry, 0), "", -1, -30);
}
LevelList.setSelected(0);
LevelList.onChange();
if(!$pref::HostMultiPlayer)
LevelSelectTitle.setText("SINGLE PLAYER");
else
LevelSelectTitle.setText("CREATE SERVER");
/*for (%i = 0; %i < LevelList.rowCount(); %i++)
{
%preview = new GuiButtonCtrl() {
profile = "GuiMenuButtonProfile";
@ -127,67 +138,31 @@ function ChooseLevelDlg::onWake( %this )
%desc = getField(CL_levelList.getRowText(%i), 2);
%preview.levelDesc = %desc;
}
}*/
}
ChooseLevelWindow->SmallPreviews.firstVisible = -1;
ChooseLevelWindow->SmallPreviews.lastVisible = -1;
function ChooseLevelButtonHolder::onWake(%this)
{
%this.refresh();
}
if (ChooseLevelWindow->SmallPreviews.getCount() > 0)
{
ChooseLevelWindow->SmallPreviews.firstVisible = 0;
function ChooseLevelButtonHolder::refresh(%this)
{
ChooseLevelButtonHolder.add(GamepadButtonsGui);
GamepadButtonsGui.clearButtons();
GamepadButtonsGui.setButton(2, "A", "Enter", "Start Level", "ChooseLevelDlg.beginLevel();");
GamepadButtonsGui.setButton(3, "B", "Esc", "Back", "ChooseLevelDlg.backOut();");
GamepadButtonsGui.refreshButtons();
}
if (ChooseLevelWindow->SmallPreviews.getCount() < 6)
ChooseLevelWindow->SmallPreviews.lastVisible = ChooseLevelWindow->SmallPreviews.getCount() - 1;
else
ChooseLevelWindow->SmallPreviews.lastVisible = 4;
}
if (ChooseLevelWindow->SmallPreviews.getCount() > 0)
ChooseLevelWindow.previewSelected(ChooseLevelWindow->SmallPreviews.getObject(0));
// If we have 5 or less previews then hide our next/previous buttons
// and resize to fill their positions
if (ChooseLevelWindow->SmallPreviews.getCount() < 6)
{
ChooseLevelWindow->PreviousSmallPreviews.setVisible(false);
ChooseLevelWindow->NextSmallPreviews.setVisible(false);
%previewPos = ChooseLevelWindow->SmallPreviews.getPosition();
%previousPos = ChooseLevelWindow->PreviousSmallPreviews.getPosition();
%previewPosX = getWord(%previousPos, 0);
%previewPosY = getWord(%previewPos, 1);
ChooseLevelWindow->SmallPreviews.setPosition(%previewPosX, %previewPosY);
ChooseLevelWindow->SmallPreviews.colSpacing = 10;//((getWord(NextSmallPreviews.getPosition(), 0)+11)-getWord(PreviousSmallPreviews.getPosition(), 0))/4;
ChooseLevelWindow->SmallPreviews.refresh();
}
/*if (ChooseLevelWindow->SmallPreviews.getCount() <= 1)
{
// Hide the small previews
ChooseLevelWindow->SmallPreviews.setVisible(false);
// Shrink the ChooseLevelWindow so that we don't have a large blank space
%extentX = getWord(ChooseLevelWindow.getExtent(), 0);
%extentY = getWord(ChooseLevelWindow->SmallPreviews.getPosition(), 1);
ChooseLevelWIndow.setExtent(%extentX, %extentY);
}
else
{
// Make sure the small previews are visible
ChooseLevelWindow->SmallPreviews.setVisible(true);
%extentX = getWord(ChooseLevelWindow.getExtent(), 0);
%extentY = getWord(ChooseLevelWindow->SmallPreviews.getPosition(), 1);
%extentY = %extentY + getWord(ChooseLevelWindow->SmallPreviews.getExtent(), 1);
%extentY = %extentY + 9;
//ChooseLevelWIndow.setExtent(%extentX, %extentY);
//}*/
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 )
@ -213,7 +188,7 @@ function ChooseLevelDlg::addMissionFile( %this, %file )
%LevelInfoObject.delete();
}
CL_levelList.addRow( CL_levelList.rowCount(), %levelName TAB %file TAB %levelDesc TAB %levelPreview );
LevelListEntries.add( %levelName TAB %file TAB %levelDesc TAB %levelPreview );
}
function ChooseLevelDlg::addLevelAsset( %this, %levelAsset )
@ -245,113 +220,57 @@ function ChooseLevelDlg::addLevelAsset( %this, %levelAsset )
%levelDesc = %levelAsset.description;
%levelPreview = %levelAsset.levelPreviewImage;
CL_levelList.addRow( CL_levelList.rowCount(), %levelName TAB %file TAB %levelDesc TAB %levelPreview );
LevelListEntries.add( %levelName TAB %file TAB %levelDesc TAB %levelPreview );
}
function ChooseLevelDlg::onSleep( %this )
function LevelList::onChange(%this)
{
// This is set from the outside, only stays true for a single wake/sleep
// cycle.
%this.launchInEditor = false;
}
function ChooseLevelWindow::previewSelected(%this, %preview)
{
// Set the selected level
if (isObject(%preview) && %preview.levelIndex !$= "")
CL_levelList.setSelectedRow(%preview.levelIndex);
%index = %this.getSelectedRow();
%levelEntry = LevelListEntries.getKey(%index);
// Get the name
ChooseLevelWindow->LevelName.text = getField(%levelEntry, 0);
// Get the level file
$selectedLevelFile = getField(%levelEntry, 1);
// Find the preview image
%levelPreview = getField(%levelEntry, 3);
// Test against all of the different image formats
// This should probably be moved into an engine function
if (isFile(%levelPreview @ ".png") ||
isFile(%levelPreview @ ".jpg") ||
isFile(%levelPreview @ ".bmp") ||
isFile(%levelPreview @ ".gif") ||
isFile(%levelPreview @ ".jng") ||
isFile(%levelPreview @ ".mng") ||
isFile(%levelPreview @ ".tga"))
ChooseLevelWindow->CurrentPreview.setBitmap(%previewFile);
else
CL_levelList.setSelectedRow(-1);
ChooseLevelWindow->CurrentPreview.setBitmap("data/ui/images/no-preview");
// Set the large preview image
if (isObject(%preview) && %preview.bitmap !$= "")
// Get the description
%levelDesc = getField(%levelEntry, 2);
if(%levelDesc !$= "")
{
%this->CurrentPreview.visible = true;
%this->CurrentPreview.setBitmap(%preview.bitmap);
ChooseLevelWindow->LevelDescriptionLabel.setVisible(true);
ChooseLevelWindow->LevelDescription.setVisible(true);
ChooseLevelWindow->LevelDescription.setText(%levelDesc);
}
else
{
%this->CurrentPreview.visible = false;
}
// Set the current level name
if (isObject(%preview) && %preview.levelName !$= "")
{
%this->LevelName.visible = true;
%this->LevelName.setText(%preview.levelName);
}
else
{
%this->LevelName.visible = false;
}
// Set the current level description
if (isObject(%preview) && %preview.levelDesc !$= "")
{
%this->LevelDescription.visible = true;
%this->LevelDescriptionLabel.visible = true;
%this->LevelDescription.setText(%preview.levelDesc);
}
else
{
%this->LevelDescription.visible = false;
%this->LevelDescriptionLabel.visible = false;
}
}
function ChooseLevelWindow::previousPreviews(%this)
{
%prevHiddenIdx = %this->SmallPreviews.firstVisible - 1;
if (%prevHiddenIdx < 0)
return;
%lastVisibleIdx = %this->SmallPreviews.lastVisible;
if (%lastVisibleIdx >= %this->SmallPreviews.getCount())
return;
%prevHiddenObj = %this->SmallPreviews.getObject(%prevHiddenIdx);
%lastVisibleObj = %this->SmallPreviews.getObject(%lastVisibleIdx);
if (isObject(%prevHiddenObj) && isObject(%lastVisibleObj))
{
%this->SmallPreviews.firstVisible--;
%this->SmallPreviews.lastVisible--;
%prevHiddenObj.setVisible(true);
%lastVisibleObj.setVisible(false);
}
}
function ChooseLevelWindow::nextPreviews(%this)
{
%firstVisibleIdx = %this->SmallPreviews.firstVisible;
if (%firstVisibleIdx < 0)
return;
%firstHiddenIdx = %this->SmallPreviews.lastVisible + 1;
if (%firstHiddenIdx >= %this->SmallPreviews.getCount())
return;
%firstVisibleObj = %this->SmallPreviews.getObject(%firstVisibleIdx);
%firstHiddenObj = %this->SmallPreviews.getObject(%firstHiddenIdx);
if (isObject(%firstVisibleObj) && isObject(%firstHiddenObj))
{
%this->SmallPreviews.firstVisible++;
%this->SmallPreviews.lastVisible++;
%firstVisibleObj.setVisible(false);
%firstHiddenObj.setVisible(true);
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 ChooseLevelDlgGoBtn::onMouseUp( %this )
function ChooseLevelDlg::beginLevel(%this)
{
// So we can't fire the button when loading is in progress.
if ( isObject( ServerGroup ) )
@ -370,3 +289,9 @@ function ChooseLevelDlgGoBtn::onMouseUp( %this )
}
}
function ChooseLevelDlg::backOut(%this)
{
Canvas.popDialog(ChooseLevelDlg);
if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod("onReturnTo"))
ChooseLevelDlg.returnGui.onReturnTo();
}

View file

@ -1,7 +1,7 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(ChooseLevelDlg) {
position = "0 0";
extent = "1280 1024";
extent = "1024 768";
minExtent = "8 8";
horizSizing = "width";
vertSizing = "height";
@ -13,16 +13,16 @@
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";
Enabled = "1";
launchInEditor = "0";
returnGui = "MainMenuGui";
new GuiControl(ChooseLevelWindow) {
position = "80 36";
extent = "770 616";
position = "48 56";
extent = "928 655";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
@ -32,29 +32,51 @@
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl(LevelSelectTitle) {
text = "CHOOSE LEVEL";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "22 10";
extent = "307 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 GuiBitmapCtrl() {
bitmap = "data/ui/images/no-preview";
color = "255 255 255 255";
wrap = "0";
position = "369 31";
position = "513 71";
extent = "400 300";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "0";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "CurrentPreview";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";
Enabled = "1";
};
new GuiTextCtrl() {
text = "Empty Room";
text = "EmptyLevel";
maxLength = "255";
margin = "0 0 0 0";
padding = "0 0 0 0";
@ -62,19 +84,18 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "370 335";
extent = "90 18";
position = "514 375";
extent = "398 27";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
profile = "MenuHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "levelName";
hidden = "1";
internalName = "LevelName";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -87,19 +108,18 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "370 354";
position = "522 410";
extent = "91 18";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
profile = "MenuSubHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "LevelDescriptionLabel";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -107,9 +127,10 @@
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
text = "This is placeholder text";
useURLMouseCursor = "0";
position = "370 380";
extent = "165 14";
position = "522 436";
extent = "391 14";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
@ -123,150 +144,69 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiBitmapButtonCtrl() {
bitmap = "data/ui/images/previous-button";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
masked = "0";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "2 -1";
extent = "368 33";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "0";
active = "1";
command = "ChooseLevelWindow.previousPreviews();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "PreviousSmallPreviews";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";
wrap = "0";
};
new GuiBitmapButtonCtrl() {
bitmap = "data/ui/images/next-button";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
masked = "0";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "-3 549";
extent = "374 33";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "0";
active = "1";
command = "ChooseLevelWindow.nextPreviews();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "NextSmallPreviews";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";
wrap = "0";
};
new GuiTextListCtrl(CL_levelList) {
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
position = "-7 1";
extent = "80 30";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextArrayProfile";
visible = "0";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiDynamicCtrlArrayControl() {
colCount = "1";
colSize = "368";
rowCount = "14";
rowSize = "35";
rowSpacing = "0";
colSpacing = "10";
frozen = "0";
autoCellSize = "1";
fillRowFirst = "0";
dynamicSize = "0";
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "dynamic";
lockHorizScroll = "0";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
margin = "0 0 0 0";
padding = "0 0 0 0";
position = "2 33";
extent = "368 516";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "0 40";
extent = "450 580";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
profile = "GuiMenuScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "SmallPreviews";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(ChooseLevelDlgGoBtn) {
text = "Start Level";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "371 583";
extent = "399 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(ChooseLevelDlgBackBtn) {
text = "Return to Menu";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "0 583";
extent = "371 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "Canvas.popDialog(ChooseLevelDlg);\n\nif(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();";
accelerator = "escape";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
new GuiGameListMenuCtrl(LevelList) {
debugRender = "0";
callbackOnInputs = "1";
position = "1 1";
extent = "450 580";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "DefaultListMenuProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "UIMenuButtonList";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
new GuiControl(ChooseLevelButtonHolder) {
position = "189 652";
extent = "646 130";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,319 @@
//------------------------------------------------------------------------------
// global vars
//------------------------------------------------------------------------------
$BUTTON_A = 0;
$BUTTON_B = 1;
$BUTTON_X = 2;
$BUTTON_Y = 3;
$BUTTON_BACK = 4;
$BUTTON_START = 5;
$BUTTON_LTRIGGER = 6;
$BUTTON_RTRIGGER = 7;
$BUTTON_LSHOULDER = 8;
$BUTTON_RSHOULDER = 9;
$BUTTON_LSTICK = 10;
$BUTTON_RSTICK = 11;
//------------------------------------------------------------------------------
// GamepadButtonsGui methods
//------------------------------------------------------------------------------
/// Callback when this control wakes up. All buttons are set to invisible and
/// disabled.
function GamepadButtonsGui::onWake(%this)
{
GamepadButtonsGui.controllerName = "K&M";
}
function GamepadButtonsGui::initMenuButtons(%this)
{
%buttonExt = %this.extent.x / 4 SPC %this.extent.y / 2;
for(%i=0; %i < 9; %i++)
{
%btn = new GuiIconButtonCtrl()
{
iconLocation = "Left";
sizeIconToButton = true;
makeIconSquare = true;
textLocation = "Right";
extent = %buttonExt;
profile="GuiMenuButtonProfile";
gamepadButton = "";
keyboardButton = "";
};
GamepadButtonsGui.addGuiControl(%btn);
}
GamepadButtonsGui.refresh();
}
/// Sets the command and text for the specified button. If %text and %command
/// are left empty, the button will be disabled and hidden.
/// Note: This command is not executed when the A button is pressed. That
/// command is executed directly from the GuiGameList___Ctrl. This command is
/// for the graphical hint and to allow a mouse equivalent.
///
/// \param %button (constant) The button to set. See: $BUTTON_A, _B, _X, _Y
/// \param %text (string) The text to display next to the A button graphic.
/// \param %command (string) The command executed when the A button is pressed.
function GamepadButtonsGui::setButton(%this, %buttonIdx, %gamepadButton, %keyboardButton, %text, %command, %gamepadOnly)
{
if(%buttonIdx >= GamepadButtonsGui.getCount())
return;
%btn = GamepadButtonsGui.getObject(%buttonIdx);
%set = (! ((%text $= "") && (%command $= "")));
%btn.setText(%text);
%btn.setActive(%set);
%btn.setVisible(%set);
%btn.gamepadButton = %gamepadButton;
%btn.keyboardButton = %keyboardButton;
if(%gamepadOnly $= "")
%gamepadOnly = false;
%btn.gamepadOnly = %gamepadOnly;
%btn.Command = %command;
}
function GamepadButtonsGui::checkGamepad(%this)
{
%controllerName = SDLInputManager::JoystickNameForIndex(0);
GamepadButtonsGui.controllerName = %controllerName;
}
function GamepadButtonsGui::clearButtons(%this)
{
for(%i=0; %i < GamepadButtonsGui.getCount(); %i++)
{
%btn = GamepadButtonsGui.getObject(%i);
%btn.setBitmap("");
%btn.text = "";
%btn.command = "";
}
}
function GamepadButtonsGui::refreshButtons(%this)
{
//Set up our basic buttons
for(%i=0; %i < GamepadButtonsGui.getCount(); %i++)
{
%btn = GamepadButtonsGui.getObject(%i);
%set = (! ((%btn.text $= "") && (%btn.command $= "")));
//Special-case of where we're in keyboard+mouse mode, but the menubutton is gamepad only mode, so we early out
if(%btn.gamepadOnly && GamepadButtonsGui.controllerName $= "K&M")
%set = false;
%btn.setActive(%set);
%btn.setVisible(%set);
if(!%btn.isActive())
continue;
if(GamepadButtonsGui.controllerName !$= "K&M")
{
if(%btn.gamepadButton !$= "")
{
%path = "";
if(GamepadButtonsGui.controllerName $= "PS4 Controller")
{
%path = "data/ui/images/inputs/PS4/PS4_";
if(%btn.gamepadButton $= "A")
%path = %path @ "Cross";
else if(%btn.gamepadButton $= "B")
%path = %path @ "Circle";
else if(%btn.gamepadButton $= "X")
%path = %path @ "Square";
else if(%btn.gamepadButton $= "Y")
%path = %path @ "Triangle";
else if(%btn.gamepadButton $= "LB")
%path = %path @ "L1";
else if(%btn.gamepadButton $= "LT")
%path = %path @ "L2";
else if(%btn.gamepadButton $= "RB")
%path = %path @ "R1";
else if(%btn.gamepadButton $= "RT")
%path = %path @ "R2";
else
continue;
}
else if(GamepadButtonsGui.controllerName $= "Nintendo Switch Pro Controller")
{
%path = "data/ui/images/inputs/Switch/Switch_";
if(%btn.gamepadButton $= "A")
%path = %path @ "B";
else if(%btn.gamepadButton $= "B")
%path = %path @ "A";
else if(%btn.gamepadButton $= "X")
%path = %path @ "Y";
else if(%btn.gamepadButton $= "Y")
%path = %path @ "X";
else if(%btn.gamepadButton $= "LB")
%path = %path @ "LB";
else if(%btn.gamepadButton $= "LT")
%path = %path @ "LT";
else if(%btn.gamepadButton $= "RB")
%path = %path @ "RB";
else if(%btn.gamepadButton $= "RT")
%path = %path @ "RT";
else
continue;
}
else if(GamepadButtonsGui.controllerName !$= "")
{
%path = "data/ui/images/inputs/Xbox/Xbox_";
%path = %path @ %btn.gamepadButton;
}
}
}
else
{
if(%btn.keyboardButton !$= "")
{
%path = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_" @ %btn.keyboardButton;
}
}
%btn.setBitmap(%path);
}
return true;
}
function GamepadButtonsGui::processInputs(%this, %device, %action)
{
//check to see if our status has changed
%changed = false;
%oldDevice = GamepadButtonsGui.controllerName;
if(startsWith(%device, "Keyboard"))
{
if(GamepadButtonsGui.controllerName !$= %device)
%changed = true;
GamepadButtonsGui.controllerName = "K&M";
Canvas.showCursor();
}
else if(startsWith(%device, "Mouse"))
{
if(startsWith(%action, "button"))
{
if(GamepadButtonsGui.controllerName !$= %device)
%changed = true;
GamepadButtonsGui.controllerName = "K&M";
Canvas.showCursor();
}
}
else
{
if(GamepadButtonsGui.checkGamepad())
{
Canvas.hideCursor();
}
if(GamepadButtonsGui.controllerName !$= %device)
%changed = true;
}
if(%changed)
GamepadButtonsGui.refreshButtons();
//Now process the input for the button accelerator, if applicable
//Set up our basic buttons
for(%i=0; %i < GamepadButtonsGui.getCount(); %i++)
{
%btn = GamepadButtonsGui.getObject(%i);
if(!%btn.isActive())
continue;
if(GamepadButtonsGui.controllerName !$= "K&M")
{
if(%action $= "btn_r")
%action = "RB";
else if(%action $= "btn_l")
%action = "LB";
if(%btn.gamepadButton $= %action)
{
eval(%btn.command);
}
}
else
{
if(%action $= "return")
%action = "enter";
else if(%action $= "escape")
%action = "esc";
if(%btn.keyboardButton $= %action)
{
eval(%btn.command);
}
}
}
}
function GamepadButtonsGui::processAxisEvent(%this, %device, %action, %axisVal)
{
%changed = false;
%oldDevice = GamepadButtonsGui.controllerName;
if(startsWith(%device, "Mouse"))
{
if(startsWith(%action, "button"))
{
if(GamepadButtonsGui.controllerName !$= %device)
%changed = true;
GamepadButtonsGui.controllerName = "K&M";
Canvas.showCursor();
}
}
else
{
if(GamepadButtonsGui.checkGamepad())
{
Canvas.hideCursor();
}
if(GamepadButtonsGui.controllerName !$= %device)
%changed = true;
}
if(%changed)
GamepadButtonsGui.refreshButtons();
}
//
//
function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType)
{
/*if(GamepadButtonsGui.checkGamepad())
{
GamepadButtonsGui.hidden = false;
}*/
}
function onSDLDeviceDisconnected(%sdlIndex)
{
/*if(!GamepadButtonsGui.checkGamepad())
{
GamepadButtonsGui.hidden = true;
}*/
}

View file

@ -0,0 +1,239 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(GamepadButtonsGuiCtrl) {
position = "0 0";
extent = "646 130";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GamepadDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
new GuiDynamicCtrlArrayControl(GamepadButtonsGui) {
position = "0 0";
extent = "640 100";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GamepadDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
colSize = "155";
rowSize = "45";
rowSpacing = 5;
colSpacing = 5;
frozen = true;
/*new GuiBitmapCtrl(ButtonBImg) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "left";
VertSizing = "relative";
position = "416 16";
Extent = "32 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "data/ui/images/Inputs/Xbox/Xbox_B";
wrap = "0";
};
new GuiTextCtrl(ButtonBLabel) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadButtonTextRight";
HorizSizing = "relative";
VertSizing = "relative";
position = "248 16";
Extent = "160 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button B Label";
maxLength = "1024";
};
new GuiButtonBaseCtrl(ButtonBButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "248 16";
Extent = "200 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapCtrl(ButtonAImg) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "left";
VertSizing = "relative";
position = "400 64";
Extent = "32 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "data/ui/images/Inputs/Xbox/Xbox_A";
wrap = "0";
};
new GuiTextCtrl(ButtonALabel) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadButtonTextRight";
HorizSizing = "relative";
VertSizing = "relative";
position = "232 64";
Extent = "160 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button B Label";
maxLength = "1024";
};
new GuiButtonBaseCtrl(ButtonAButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "232 64";
Extent = "200 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapCtrl(ButtonXImg) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "right";
VertSizing = "relative";
position = "32 64";
Extent = "32 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "data/ui/images/Inputs/Xbox/Xbox_X";
wrap = "0";
};
new GuiTextCtrl(ButtonXLabel) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadButtonTextLeft";
HorizSizing = "relative";
VertSizing = "relative";
position = "72 64";
Extent = "160 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button X Label";
maxLength = "1024";
};
new GuiButtonBaseCtrl(ButtonXButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "32 64";
Extent = "200 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapCtrl(ButtonYImg) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "right";
VertSizing = "relative";
position = "16 16";
Extent = "32 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "data/ui/images/Inputs/Xbox/Xbox_Y";
wrap = "0";
};
new GuiTextCtrl(ButtonYLabel) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadButtonTextLeft";
HorizSizing = "relative";
VertSizing = "relative";
position = "55 16";
Extent = "164 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button Y Label";
maxLength = "1024";
};
new GuiButtonBaseCtrl(ButtonYButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GamepadDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "16 16";
Extent = "208 32";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};*/
};
};
//--- OBJECT WRITE END ---

View file

@ -6,6 +6,26 @@ function JoinServerMenu::onWake()
JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0);
}
function JoinServerButtonHolder::onWake(%this)
{
%this.refresh();
}
function JoinServerButtonHolder::refresh(%this)
{
JoinServerButtonHolder.add(GamepadButtonsGui);
GamepadButtonsGui.clearButtons();
GamepadButtonsGui.setButton(1, "A", "", "Query LAN", "JoinServerMenu.queryLan();");
GamepadButtonsGui.setButton(2, "X", "", "Query Internet", "JoinServerMenu.query();");
GamepadButtonsGui.setButton(3, "B", "", "Refresh", "JoinServerMenu.refresh();");
GamepadButtonsGui.setButton(6, "Start", "Enter", "Join", "JoinServerMenu.join();");
GamepadButtonsGui.setButton(7, "B", "Esc", "Back", "JoinServerMenu.backOut();");
GamepadButtonsGui.refreshButtons();
}
//----------------------------------------
function JoinServerMenu::query(%this)
{
@ -77,11 +97,13 @@ function JoinServerMenu::refreshSelectedServer( %this )
}
//----------------------------------------
function JoinServerMenu::exit(%this)
function JoinServerMenu::backOut(%this)
{
cancelServerQuery();
Canvas.popDialog(JoinServerMenu);
if(isObject(JoinServerMenu.returnGui) && JoinServerMenu.returnGui.isMethod("onReturnTo"))
JoinServerMenu.returnGui.onReturnTo();
}
//----------------------------------------

View file

@ -15,11 +15,11 @@
canSaveDynamicFields = "1";
new GuiControl(JoinServerWindow) {
position = "80 36";
extent = "800 616";
position = "45 56";
extent = "928 655";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
@ -29,21 +29,39 @@
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl(JS_status) {
text = "No servers found.";
maxLength = "255";
new GuiBitmapCtrl() {
bitmap = "data/ui/images/hudfill.png";
color = "255 255 255 255";
wrap = "0";
position = "0 0";
extent = "928 655";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "JOIN SERVER";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "277 31";
extent = "148 18";
minExtent = "8 8";
position = "22 10";
extent = "207 28";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
profile = "MenuHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -52,54 +70,28 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
lockHorizScroll = "0";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
new GuiTextCtrl() {
text = "Player Name:";
maxLength = "255";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "10 80";
extent = "780 461";
position = "12 47";
extent = "109 18";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuScrollProfile";
profile = "MenuSubHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextListCtrl(JS_serverList) {
columns = "0 200 270 335 400";
fitParentWidth = "1";
clipColumnText = "0";
position = "1 1";
extent = "762 8";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextArrayProfile";
visible = "1";
active = "1";
altCommand = "JoinServerDlg.join();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiTextEditCtrl() {
historySize = "0";
@ -114,7 +106,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "116 31";
position = "124 47";
extent = "144 18";
minExtent = "8 8";
horizSizing = "right";
@ -129,8 +121,8 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Player Name:";
new GuiTextCtrl(JS_status) {
text = "No servers found.";
maxLength = "255";
margin = "0 0 0 0";
padding = "0 0 0 0";
@ -138,17 +130,17 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "12 31";
extent = "98 18";
position = "277 47";
extent = "148 18";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
profile = "MenuSubHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -161,7 +153,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "269 59";
position = "269 67";
extent = "36 18";
minExtent = "8 8";
horizSizing = "right";
@ -184,7 +176,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "335 59";
position = "335 67";
extent = "38 18";
minExtent = "8 8";
horizSizing = "right";
@ -207,7 +199,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "412 59";
position = "412 67";
extent = "28 18";
minExtent = "8 8";
horizSizing = "right";
@ -230,7 +222,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "212 59";
position = "212 67";
extent = "20 18";
minExtent = "8 8";
horizSizing = "right";
@ -253,7 +245,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "12 59";
position = "12 67";
extent = "63 18";
minExtent = "8 8";
horizSizing = "right";
@ -267,9 +259,59 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "dynamic";
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 = "19 98";
extent = "890 501";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextListCtrl(JS_serverList) {
columns = "0 200 270 335 400";
fitParentWidth = "1";
clipColumnText = "0";
rowHeightPadding = "2";
position = "1 1";
extent = "765 8";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextArrayProfile";
visible = "1";
active = "1";
altCommand = "JoinServerDlg.join();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl(JS_queryStatus) {
position = "10 541";
extent = "778 35";
position = "16 615";
extent = "900 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
@ -360,13 +402,14 @@
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
visible = "0";
active = "1";
command = "Canvas.popDialog(JoinServerMenu);\n\nif(isObject(JoinServerMenu.returnGui) && JoinServerMenu.returnGui.isMethod(\"onReturnTo\")) JoinServerMenu.returnGui.onReturnTo();";
accelerator = "escape";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -381,12 +424,13 @@
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
visible = "0";
active = "1";
command = "JoinServerMenu.queryLan();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -401,12 +445,13 @@
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
visible = "0";
active = "1";
command = "JoinServerMenu.query();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -421,12 +466,13 @@
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
visible = "0";
active = "1";
command = "JoinServerMenu.refresh();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -441,15 +487,31 @@
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
visible = "0";
active = "0";
command = "JoinServerMenu.join();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl(JoinServerButtonHolder) {
position = "189 652";
extent = "646 130";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
//--- OBJECT WRITE END ---

View file

@ -1,41 +1,102 @@
function MainMenuGui::onWake(%this)
function MainMenuGui::onAdd(%this)
{
if (isFunction("getWebDeployment") &&
getWebDeployment() &&
isObject(%this-->ExitButton))
%this-->ExitButton.setVisible(false);
MainMenuButtonContainer.hidden = false;
GamepadButtonsGui.initMenuButtons();
}
function MainMenuGui::openSinglePlayerMenu(%this)
function MainMenuGui::onWake(%this)
{
MainMenuButtonList.hidden = false;
}
function MainMenuGui::onSleep(%this)
{
menuMoveMap.pop();
}
function MainMenuButtonHolder::onWake(%this)
{
%this.refresh();
}
function MainMenuButtonHolder::refresh(%this)
{
%this.add(GamepadButtonsGui);
GamepadButtonsGui.clearButtons();
//GamepadButtonsGui.setButton(2, "A", "Select", "Go", "echo(\"FART\");");
//GamepadButtonsGui.setButton(3, "B", "Esc", "Back", "");
GamepadButtonsGui.refreshButtons();
}
function MainMenuButtonList::onAdd(%this)
{
MainMenuButtonList.addRow("Single Player", "openSinglePlayerMenu", 0);
MainMenuButtonList.addRow("Create Server", "openMultiPlayerMenu", 4, -15);
MainMenuButtonList.addRow("Join Server", "openJoinServerMenu", 4, -15);
MainMenuButtonList.addRow("Options", "openOptionsMenu", 6, -15);
MainMenuButtonList.addRow("Open World Editor", "openWorldEditorBtn", 6, -15);
MainMenuButtonList.addRow("Open GUI Editor", "openGUIEditorBtn", 6, -15);
MainMenuButtonList.addRow("Exit Game", "quit", 8, -15);
}
function UIMenuButtonList::onInputEvent(%this, %device, %action, %state)
{
if(%state)
GamepadButtonsGui.processInputs(%device, %action);
}
function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal)
{
GamepadButtonsGui.processAxisEvent(%device, %action);
}
function openSinglePlayerMenu()
{
$pref::HostMultiPlayer=false;
Canvas.pushDialog(ChooseLevelDlg);
ChooseLevelDlg.returnGui = %this;
MainMenuButtonContainer.hidden = true;
ChooseLevelDlg.returnGui = MainMenuGui;
MainMenuButtonList.hidden = true;
MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo");
}
function MainMenuGui::openMultiPlayerMenu(%this)
function openMultiPlayerMenu()
{
$pref::HostMultiPlayer=true;
Canvas.pushDialog(ChooseLevelDlg);
ChooseLevelDlg.returnGui = %this;
MainMenuButtonContainer.hidden = true;
ChooseLevelDlg.returnGui = MainMenuGui;
MainMenuButtonList.hidden = true;
MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo");
}
function MainMenuGui::openOptionsMenu(%this)
function openJoinServerMenu()
{
Canvas.pushDialog(JoinServerMenu);
JoinServerMenu.returnGui = MainMenuGui;
MainMenuButtonList.hidden = true;
}
function openOptionsMenu()
{
Canvas.pushDialog(OptionsMenu);
OptionsMenu.returnGui = %this;
MainMenuButtonContainer.hidden = true;
OptionsMenu.returnGui = MainMenuGui;
MainMenuButtonList.hidden = true;
MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo");
}
function openWorldEditorBtn()
{
fastLoadWorldEdit(1);
}
function openGUIEditorBtn()
{
fastLoadGUIEdit(1);
}
function MainMenuGui::onReturnTo(%this)
{
MainMenuButtonContainer.hidden = false;
MainMenuButtonList.hidden = false;
MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo-shortcut");
}

View file

@ -2,7 +2,7 @@ exec( "tools/gui/profiles.ed.cs" );
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
bitmap = "data/ui/images/BackgroundImage.png";
bitmap = "data/ui/images/background-dark.png";
useVariable = "0";
tile = "0";
position = "0 0";
@ -20,9 +20,10 @@ exec( "tools/gui/profiles.ed.cs" );
canSaveDynamicFields = "1";
Enabled = "1";
isDecoy = "0";
navigationIndex = "-1";
new GuiBitmapButtonCtrl(MainMenuAppLogo) {
bitmap = "data/ui/images/Torque-3D-logo-shortcut";
bitmap = "data/ui/images/Torque-3D-logo";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
@ -45,13 +46,33 @@ exec( "tools/gui/profiles.ed.cs" );
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "1";
navigationIndex = "-1";
};
new GuiControl(MainMenuButtonContainer) {
position = "20 193";
extent = "442 381";
new GuiGameListMenuCtrl(MainMenuButtonList) {
class = "UIMenuButtonList";
debugRender = "0";
callbackOnA = "MainMenuButtonList.activateRow();";
callbackOnInputs = "1";
position = "292 103";
extent = "439 561";
minExtent = "8 2";
horizSizing = "right";
horizSizing = "center";
vertSizing = "center";
profile = "DefaultListMenuProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiControl(MainMenuButtonHolder) {
position = "190 652";
extent = "646 130";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
@ -60,175 +81,6 @@ exec( "tools/gui/profiles.ed.cs" );
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiDynamicCtrlArrayControl() {
colCount = "1";
colSize = "442";
rowCount = "9";
rowSize = "40";
rowSpacing = "0";
colSpacing = "0";
frozen = "0";
autoCellSize = "1";
fillRowFirst = "0";
dynamicSize = "0";
padding = "0 0 0 0";
position = "0 0";
extent = "442 381";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiButtonCtrl() {
text = "Singleplayer";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "0 0";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuGui.openSinglePlayerMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Create Server";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 40";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuGui.openMultiPlayerMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Join Server";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 80";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "Canvas.pushDialog(JoinServerMenu);";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Options";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 120";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "MainMenuGui.openOptionsMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Launch World Editor";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 160";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "fastLoadWorldEdit(1);";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Launch GUI Editor";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 200";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "fastLoadGUIEdit(1);";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Exit";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 240";
extent = "442 40";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "quit();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "ExitButton";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,110 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(MessageBoxDlg) {
position = "0 0";
extent = "1024 768";
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";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiBitmapCtrl() {
bitmap = "data/ui/images/hudfill.png";
color = "255 255 255 255";
wrap = "0";
position = "0 0";
extent = "1156 704";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
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 10";
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 GuiMLTextCtrl(MessageBoxText) {
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
useURLMouseCursor = "0";
position = "81 83";
extent = "481 14";
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(MessageBoxButtonHolder) {
position = "0 237";
extent = "641 130";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -1413,5 +1413,20 @@
canSaveDynamicFields = "0";
};
};
new GuiControl(OptionsButtonHolder) {
position = "190 652";
extent = "646 130";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
//--- OBJECT WRITE END ---

View file

@ -46,112 +46,260 @@
//headbob
//FOV
function OptionsMenuSettingsList::onAdd(%this)
{
%yesNoList = "No\tYes";
%onOffList = "Off\tOn";
%highMedLow = "Low\tMedium\tHigh";
%anisoFilter = "Off\t4\t8\t16";
OptionsMenuSettingsList.addOptionRow("Shadow Quality", "High\tMedium\tLow\tNone", false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Mesh Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Texture Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Terrain Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Decal Lifetime", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Ground Cover Density", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Shader Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", %anisoFilter, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "4\t2\t1\tOff", false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Refresh Rate", "75\t60\t30", false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Parallax", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Water Reflections", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("SSAO", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Depth of Field", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Vignette", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Light Rays", %onOffList, false, "", -1, -30);
}
function OptionsMenu::onWake(%this)
{
OptionsMain.hidden = false;
ControlsMenu.hidden = true;
GraphicsMenu.hidden = true;
AudioMenu.hidden = true;
CameraMenu.hidden = true;
ScreenBrightnessMenu.hidden = true;
OptionsOKButton.hidden = false;
OptionsCancelButton.hidden = false;
OptionsDefaultsButton.hidden = false;
OptionsMenu.tamlReader = new Taml();
OptionsSettingStack.clear();
MainMenuButtonList.hidden = true;
%array = OptionsSettingStack;
%array.clear();
%this.pageTabIndex = 0;
%tab = %this.getTab();
%tab.performClick();
}
function OptionsButtonHolder::onWake(%this)
{
%this.refresh();
}
function OptionsButtonHolder::refresh(%this)
{
OptionsButtonHolder.add(GamepadButtonsGui);
%keyboardMenuBtn = new GuiButtonCtrl(){
text = "Keyboard and Mouse";
profile = GuiMenuButtonProfile;
extent = %array.extent.x SPC "35";
command="ControlsMenu::loadSettings();";
};
GamepadButtonsGui.clearButtons();
%controllerMenuBtn = new GuiButtonCtrl(){
text = "Controller";
profile = GuiMenuButtonProfile;
extent = %array.extent.x SPC "35";
command="DisplayMenu::loadSettings();";
};
GamepadButtonsGui.setButton(0, "LB", "", "Prev Tab", "OptionsMenu.prevTab();", true);
GamepadButtonsGui.setButton(1, "RB", "", "Next Tab", "OptionsMenu.nextTab();", true);
GamepadButtonsGui.setButton(2, "Start", "Enter", "Apply", "OptionsMenu.apply();");
GamepadButtonsGui.setButton(3, "B", "Esc", "Back", "OptionsMenu.backOut();");
GamepadButtonsGui.setButton(7, "Back", "R", "Reset", "OptionsMenu.backOut();");
%displayMenuBtn = new GuiButtonCtrl(){
text = "Display";
profile = GuiMenuButtonProfile;
extent = %array.extent.x SPC "35";
command="DisplayMenu::loadSettings();";
};
GamepadButtonsGui.refreshButtons();
}
function OptionsMenuSettingsList::onChange(%this)
{
return;
%graphicsMenuBtn = new GuiButtonCtrl(){
text = "Graphics";
profile = GuiMenuButtonProfile;
extent = %array.extent.x SPC "35";
command="GraphicsMenu::loadSettings();";
};
OptionsMenuSettingsList.clearOptions();
%currentRowText = %this.getRowLabel(%this.getSelectedRow());
%audioMenuBtn = new GuiButtonCtrl(){
text = "Audio";
profile = GuiMenuButtonProfile;
extent = %array.extent.x SPC "35";
command="AudioMenu::loadSettings();";
};
%gameplayMenuBtn = new GuiButtonCtrl(){
text = "Gameplay";
profile = GuiMenuButtonProfile;
extent = %array.extent.x SPC "35";
command="GameplayMenu::loadSettings();";
};
%array.add(%keyboardMenuBtn);
//%array.add(%controllerMenuBtn);
%array.add(%displayMenuBtn);
%array.add(%graphicsMenuBtn);
%array.add(%audioMenuBtn);
//%array.add(%gameplayMenuBtn);
//We programmatically set up our settings here so we can do some prepwork on the fields/controls
//Presets
/*OptionsMenu.addSettingOption(%array, "Preset", "High", ShadowQualityList, $pref::Video::Resolution);
//AA
OptionsMenu.addSettingOption(%array, "AntiAliasing", "FXAA 4x", ShadowQualityList, $pref::Video::Resolution);
//Lighting
OptionsMenu.addSettingOption(%array, "Shadow Quality", "High", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Shadow Caching", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Soft Shadows", "High", ShadowQualityList, $pref::Video::Resolution);
//Models and Textures
OptionsMenu.addSettingOption(%array, "Level of Detail", "High", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Texture Quality", "High", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Material Quality", "High", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Terrain Detail", "High", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Decal Lifetime", "High", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Ground Clutter Density", "High", ShadowQualityList, $pref::Video::Resolution);
//Effects
OptionsMenu.addSettingOption(%array, "HDR", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Parallax", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Ambient Occlusion", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Light Rays", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Depth of Field", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Vignetting", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Water Reflections", "On", ShadowQualityList, $pref::Video::Resolution);
OptionsMenu.addSettingOption(%array, "Anisotropic Filtering", "16x", ShadowQualityList, $pref::Video::Resolution);*/
if(!isObject(GraphicsSettingsCache))
if(%currentRowText $= "Display")
{
new ArrayObject(GraphicsSettingsCache){};
OptionsMenuList.populateDisplaySettingsList();
}
else if(%currentRowText $= "Graphics")
{
OptionsMenuList.populateGraphicsSettingsList();
}
else if(%currentRowText $= "Audio")
{
OptionsMenuList.populateAudioSettingsList();
}
else if(%currentRowText $= "Keyboard + Mouse")
{
OptionsMenuList.populateKeyboardMouseSettingsList();
}
else if(%currentRowText $= "Gamepad")
{
OptionsMenuList.populateGamepadSettingsList();
}
}
function OptionsMenu::prevTab(%this)
{
%this.pageTabIndex--;
if(%this.pageTabIndex < 0)
%this.pageTabIndex = 4;
%tabBtn = %this.getTab();
%tabBtn.performClick();
}
function OptionsMenu::nextTab(%this)
{
%this.pageTabIndex++;
if(%this.pageTabIndex > 4)
%this.pageTabIndex = 0;
%tabBtn = %this.getTab();
%tabBtn.performClick();
}
function OptionsMenu::getTab(%this)
{
if(%this.pageTabIndex == 0)
return %this-->DisplayButton;
else if(%this.pageTabIndex == 1)
return %this-->GraphicsButton;
else if(%this.pageTabIndex == 2)
return %this-->AudioButton;
else if(%this.pageTabIndex == 3)
return %this-->KBMButton;
else if(%this.pageTabIndex == 4)
return %this-->GamepadButton;
else
return %this-->DisplayButton;
}
function OptionsMenu::populateDisplaySettingsList(%this)
{
%this.pageTabIndex = 0;
OptionsMenuSettingsList.clearRows();
%resolutionList = getScreenResolutionList();
//OptionsMenuSettingsList.addOptionsRow("Resolution", %yesNoList, false, "", 0, -15);
OptionsMenuSettingsList.addOptionRow("Resolution", %resolutionList, false, "screenResolutionOptionChanged", -1, -30);
}
function _makePrettyResString( %resString, %giveAspectRation )
{
%width = getWord( %resString, $WORD::RES_X );
%height = getWord( %resString, $WORD::RES_Y );
%aspect = %width / %height;
%aspect = mRound( %aspect * 100 ) * 0.01;
switch$( %aspect )
{
case "1.33":
%aspect = "4:3";
case "1.78":
%aspect = "16:9";
default:
%aspect = "";
}
GraphicsSettingsCache.empty();
%outRes = %width @ " x " @ %height;
if ( %giveAspectRation && %aspect !$= "" )
%outRes = %outRes @ " (" @ %aspect @ ")";
return %outRes;
}
function getScreenResolutionList()
{
%returnsList = "";
%resCount = Canvas.getModeCount();
for (%i = 0; %i < %resCount; %i++)
{
%testResString = Canvas.getMode( %i );
%testRes = _makePrettyResString( %testResString );
//sanitize
%found = false;
%retCount = getTokenCount(%returnsList, "\t");
for (%x = 0; %x < %retCount; %x++)
{
%existingEntry = getToken(%returnsList, "\t", %x);
if(%existingEntry $= %testRes)
{
%found = true;
break;
}
}
if(%found)
continue;
if(%i != 0)
%returnsList = %returnsList @ "\t" @ %testRes;
else
%returnsList = %testRes;
}
return %returnsList;
}
function screenResolutionOptionChanged()
{
echo("Resolution Changed to: " @ OptionsMenuSettingsList.getCurrentOption(0));
}
function OptionsMenu::populateGraphicsSettingsList(%this)
{
%this.pageTabIndex = 1;
OptionsMenuSettingsList.clearRows();
%yesNoList = "No\tYes";
%onOffList = "Off\tOn";
%highMedLow = "Low\tMedium\tHigh";
%anisoFilter = "Off\t4\t8\t16";
OptionsMenuSettingsList.addOptionRow("Shadow Quality", "High\tMedium\tLow\tNone", false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Mesh Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Texture Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Terrain Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Decal Lifetime", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Ground Cover Density", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Shader Quality", %highMedLow, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", %anisoFilter, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "4\t2\t1\tOff", false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Refresh Rate", "75\t60\t30", false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Parallax", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Water Reflections", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("SSAO", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Depth of Field", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Vignette", %onOffList, false, "", -1, -30);
OptionsMenuSettingsList.addOptionRow("Light Rays", %onOffList, false, "", -1, -30);
}
function OptionsMenu::populateAudioSettingsList(%this)
{
%this.pageTabIndex = 2;
OptionsMenuSettingsList.clearRows();
%yesNoList = "Yes\tNo";
OptionsMenuSettingsList.addOptionRow("Audio Device", %yesNoList, false, "", -1, -15);
}
function OptionsMenu::populateKeyboardMouseSettingsList(%this)
{
%this.pageTabIndex = 3;
OptionsMenuSettingsList.clearRows();
OptionsMenuSettingsList.addOptionRow("Forward", "W", false, "", -1, -15);
}
function OptionsMenu::populateGamepadSettingsList(%this)
{
%this.pageTabIndex = 4;
OptionsMenuSettingsList.clearRows();
}
function OptionsMenuList::activateRow(%this)
{
OptionsMenuSettingsList.setFirstResponder();
}
function OptionsMenuList::backOut(%this)
{
OptionsMenuList.setFirstResponder();
}
function OptionsMenuOKButton::onClick(%this)
@ -161,6 +309,15 @@ function OptionsMenuOKButton::onClick(%this)
OptionsMenu.backOut();
}
//
//
function OptionsMenuSettingsList::backOut(%this)
{
OptionsMenuList.setFirstResponder();
}
//
//
function OptionsMenuCancelButton::onClick(%this)
{
//we don't save, so just back out of the menu

View file

@ -13,23 +13,23 @@
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
returnGui = "MainMenuGui";
tamlReader = "20077";
tamlReader = "20088";
tile = "0";
useVariable = "0";
new GuiControl() {
position = "86 70";
position = "89 75";
extent = "846 618";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
visible = "0";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
@ -128,7 +128,7 @@
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiScrollProfile";
profile = "GuiMenuScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -148,7 +148,7 @@
changeChildSizeToFit = "1";
changeChildPosition = "1";
position = "1 1";
extent = "846 210";
extent = "846 140";
minExtent = "16 16";
horizSizing = "width";
vertSizing = "bottom";
@ -160,6 +160,87 @@
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiButtonCtrl() {
text = "Keyboard and Mouse";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 0";
extent = "846 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "ControlsMenu::loadSettings();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Display";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 35";
extent = "846 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "DisplayMenu::loadSettings();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Graphics";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 70";
extent = "846 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "GraphicsMenu::loadSettings();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Audio";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 105";
extent = "846 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "AudioMenu::loadSettings();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
new GuiMLTextCtrl() {
@ -183,7 +264,6 @@
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
class="OptionsMenuOKButton";
text = "OK";
groupNum = "-1";
buttonType = "PushButton";
@ -199,11 +279,11 @@
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "OptionsMenuOKButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
class="OptionsMenuDefaultsButton";
text = "Defaults";
groupNum = "-1";
buttonType = "PushButton";
@ -219,11 +299,11 @@
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "OptionsMenuDefaultsButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
class="OptionsMenuCancelButton";
text = "Cancel";
groupNum = "-1";
buttonType = "PushButton";
@ -239,9 +319,283 @@
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "OptionsMenuCancelButton";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl() {
position = "48 56";
extent = "928 655";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl() {
text = "OPTIONS";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "22 10";
extent = "120 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";
bitmap = "data/ui/images/hudfill.png";
color = "255 255 255 255";
position = "0 40";
extent = "846 618";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "0";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "Display";
groupNum = "1";
buttonType = "RadioButton";
useMouseEvents = "0";
position = "114 49";
extent = "140 32";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
internalName = "DisplayButton";
command="OptionsMenu.populateDisplaySettingsList();";
};
new GuiButtonCtrl() {
text = "Graphics";
groupNum = "1";
buttonType = "RadioButton";
useMouseEvents = "0";
position = "258 49";
extent = "140 32";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
internalName = "GraphicsButton";
command="OptionsMenu.populateGraphicsSettingsList();";
};
new GuiButtonCtrl() {
text = "Audio";
groupNum = "1";
buttonType = "RadioButton";
useMouseEvents = "0";
position = "402 49";
extent = "140 32";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
internalName = "AudioButton";
command="OptionsMenu.populateAudioSettingsList();";
};
new GuiButtonCtrl() {
text = "Keyboard + Mouse";
groupNum = "1";
buttonType = "RadioButton";
useMouseEvents = "0";
position = "547 49";
extent = "140 32";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
internalName = "KBMButton";
command="OptionsMenu.populateKeyboardMouseSettingsList();";
};
new GuiButtonCtrl() {
text = "Gamepad";
groupNum = "1";
buttonType = "RadioButton";
useMouseEvents = "0";
position = "691 49";
extent = "140 32";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
internalName = "GamepadButton";
command="OptionsMenu.populateGamepadSettingsList();";
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
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 = "1 83";
extent = "622 573";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiGameListMenuCtrl(OptionsMenuSettingsList) {
class = "UIMenuButtonList";
debugRender = "0";
callbackOnA = "OptionsMenuSettingsList.activateRow();";
callbackOnB = "OptionsMenuSettingsList.backOut();";
callbackOnInputs = "1";
position = "1 1";
extent = "621 141";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "DefaultListMenuProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiTextCtrl(OptionName) {
text = "Option";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "635 94";
extent = "293 17";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "MenuSubHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiMLTextCtrl(OptionDescription) {
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
text = "This is a placeholder text for an option.";
useURLMouseCursor = "0";
position = "635 126";
extent = "293 14";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMLWhiteTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl(OptionsButtonHolder) {
position = "189 652";
extent = "646 130";
minExtent = "8 2";
horizSizing = "center";
vertSizing = "top";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show more