Template changes

This commit is contained in:
JeffR 2022-02-17 18:21:13 -06:00
parent ed36cf2c5c
commit 40acf75238
14 changed files with 762 additions and 2330 deletions

View file

@ -26,6 +26,10 @@ if($Gui::fontCacheDirectory $= "")
$Gui::fontCacheDirectory = expandFilename("data/cache/fonts");
}
$TextMediumEmphasisColor = "200 200 200";
$TextHighEmphasisColor = "224 224 224";
$TextDisabledColor = "108 108 108";
// ----------------------------------------------------------------------------
// GuiDefaultProfile is a special profile that all other profiles inherit
// defaults from. It must exist.
@ -137,13 +141,20 @@ new GuiControlProfile(GuiTextEditProfile)
category = "Core";
};
if(!isObject(GuiScrollProfile))
new GuiControlProfile(GuiScrollProfile)
if(!isObject(GuiMenuScrollProfile))
new GuiControlProfile(GuiMenuScrollProfile)
{
opaque = true;
fillcolor = "255 255 255";
fontColor = "0 0 0";
fontColorHL = "150 150 150";
fontColor = $TextMediumEmphasisColor;
fontColorHL = $TextMediumEmphasisColor;
fontColorNA = $TextDisabledColor;
fontColorSEL = $TextMediumEmphasisColor;
fillColor = "40 40 40";
fillColorHL = "56 56 56";
fillColorNA = "40 40 40";
borderColor = "87 87 87";
borderColorNA = "0 0 0";
borderColorHL = "255 255 255";
border = true;
bitmapAsset = "Core_GUI:scrollBar_image";
hasBitmapArray = true;

View file

@ -36,7 +36,7 @@ function UI::initClient(%this)
%this.queueExec("./scripts/profiles");
//Now gui files
%this.queueExec("./scripts/menuInputButtons");
%this.queueExec("./scripts/menuInputHandling");
%this.queueExec("./guis/mainMenu");
%this.queueExec("./guis/mainMenu.gui");

View file

@ -1,7 +0,0 @@
<GUIAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="OptionsDlg"
scriptFile="@assetFile=optionsDlg.gui"
GUIFile="@assetFile=optionsDlg.gui"
VersionId="1" />

View file

@ -14,19 +14,27 @@ $guiContent = new GuiControl(JoinServerMenu) {
canSave = "1";
canSaveDynamicFields = "1";
returnGui = "MainMenuGui";
new GuiInputCtrl(JoinServerMenuInputHandler){
profile = "GuiInputCtrlProfile";
visible = "1";
active = "1";
position = "0 0";
extent = "1024 768";
new GuiInputCtrl(JoinServerMenuInputHandler) {
sendAxisEvents = "1";
sendBreakEvents = "1";
sendModifierEvents = "0";
ignoreMouseEvents = "1";
lockMouse = "0";
position = "-10 0";
extent = "10 10";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
sendBreakEvents="1";
profile = "GuiInputCtrlProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiControl(JoinServerWindow) {
position = "48 56";
extent = "928 655";
@ -46,7 +54,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
percent = "100";
vertical = "0";
flipClip = "0";
bitmap = "data/ui/images/panel.png";
BitmapAsset = "UI:panel_image";
color = "255 255 255 255";
position = "0 0";
extent = "927 40";
@ -89,7 +97,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
percent = "100";
vertical = "0";
flipClip = "0";
bitmap = "data/ui/images/panel_low.png";
BitmapAsset = "UI:panel_low_image";
color = "255 255 255 255";
position = "0 40";
extent = "927 618";
@ -105,58 +113,6 @@ $guiContent = new GuiControl(JoinServerMenu) {
canSave = "1";
canSaveDynamicFields = "0";
};
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 = "12 47";
extent = "109 18";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "MenuSubHeaderText";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
text = "Visitor";
maxLength = "255";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "124 47";
extent = "144 18";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuTextEditProfile";
visible = "1";
active = "1";
variable = "$pref::Player::Name";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl(JS_status) {
text = "No servers found.";
maxLength = "255";
@ -166,7 +122,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "277 47";
position = "392 47";
extent = "148 18";
minExtent = "8 8";
horizSizing = "right";
@ -324,25 +280,30 @@ $guiContent = new GuiControl(JoinServerMenu) {
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextListCtrl(JS_serverList) {
columns = "0 200 270 335 400";
fitParentWidth = "1";
clipColumnText = "0";
rowHeightPadding = "2";
new GuiStackControl(JoinServerList) {
stackingType = "Vertical";
horizStacking = "Left to Right";
vertStacking = "Top to Bottom";
padding = "10";
dynamicSize = "1";
dynamicNonStackExtent = "0";
dynamicPos = "0";
changeChildSizeToFit = "0";
changeChildPosition = "1";
position = "1 1";
extent = "888 8";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextArrayProfile";
extent = "888 16";
minExtent = "16 16";
horizSizing = "center";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
altCommand = "JoinServerDlg.join();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
class = "MenuList";
};
};
new GuiControl(JS_queryStatus) {
@ -427,130 +388,9 @@ $guiContent = new GuiControl(JoinServerMenu) {
canSaveDynamicFields = "0";
};
};
new GuiButtonCtrl(JoinServerBackBtn) {
text = "Return to Menu";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "0 583";
extent = "160 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
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";
};
new GuiButtonCtrl(JoinServerQryLanBtn) {
text = "Query Lan";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "160 583";
extent = "160 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "1";
command = "JoinServerMenu.queryLan();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(JoinServerQryInternetBtn) {
text = "Query Internet";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "320 583";
extent = "160 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "1";
command = "JoinServerMenu.query();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(JoinServerRefreshBtn) {
text = "Refresh Server";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "480 583";
extent = "160 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "1";
command = "JoinServerMenu.refresh();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(JoinServerJoinBtn) {
text = "Join Server";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "640 583";
extent = "160 33";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
command = "JoinServerMenu.join();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl() {
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";
};
new GuiControl(JoinServerButtonHolder) {
position = "109 711";
position = "116 711";
extent = "791 40";
minExtent = "8 2";
horizSizing = "center";
@ -567,7 +407,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
BitmapAsset = "UI:Keyboard_Black_Return_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -586,7 +426,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "OptionsMenu.apply();";
command = "JoinServerMenu.join();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -597,7 +437,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc";
BitmapAsset = "UI:Keyboard_Black_Escape_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -616,7 +456,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "OptionsMenu.backOut();";
command = "JoinServerMenu.backOut();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -627,14 +467,14 @@ $guiContent = new GuiControl(JoinServerMenu) {
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
BitmapAsset = "UI:Keyboard_Black_Q_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Prev Tab";
text = "Query LAN";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
@ -644,28 +484,27 @@ $guiContent = new GuiControl(JoinServerMenu) {
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
command = "OptionsMenu.prevTab();";
visible = "1";
active = "1";
command = "JoinServerMenu.queryLan();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "queryLANButton";
class = "MenuInputButton";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc";
BitmapAsset = "UI:Keyboard_Black_E_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Next Tab";
text = "Query Online";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
@ -675,28 +514,27 @@ $guiContent = new GuiControl(JoinServerMenu) {
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "0";
active = "0";
command = "OptionsMenu.nextTab();";
visible = "1";
active = "1";
command = "JoinServerMenu.query();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "queryInternetButton";
class = "MenuInputButton";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
bitmapAsset = "UI:Keyboard_Black_R_image";
BitmapAsset = "UI:Keyboard_Black_R_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
textLocation = "Right";
textMargin = "4";
autoSize = "0";
text = "Reset";
text = "Refresh";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
@ -708,7 +546,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "OptionsMenu.resetToDefaults();";
command = "JoinServerMenu.refresh();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";

View file

@ -3,10 +3,12 @@ function JoinServerMenu::onWake()
{
// Double check the status. Tried setting this the control
// inactive to start with, but that didn't seem to work.
JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0);
JoinServerJoinBtn.setActive(JoinServerList.getCount() > 0);
JoinServerButtonHolder.setActive();
JoinServerList.setAsActiveMenuList();
JoinServerMenuInputHandler.setFirstResponder();
}
@ -16,7 +18,7 @@ function JoinServerButtonHolder::onWake(%this)
%this-->backButton.set("btn_b", "Escape", "Back", "JoinServerMenu.backOut();");
%this-->refreshButton.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
%this-->queryLANButton.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
%this-->queryInternetButton.set("btn_x", "E", "Query Internet", "JoinServerMenu.query();");
%this-->queryInternetButton.set("btn_x", "E", "Query Online", "JoinServerMenu.query();");
}
function JoinServerMenuInputHandler::onInputEvent(%this, %device, %action, %state)
@ -110,23 +112,23 @@ function JoinServerMenu::update(%this)
{
// Copy the servers into the server list.
JS_queryStatus.setVisible(false);
JS_serverList.clear();
JoinServerList.clear();
%sc = getServerCount();
for( %i = 0; %i < %sc; %i ++ ) {
setServerInfo(%i);
JS_serverList.addRow( %i,
$ServerInfo::Name TAB
$ServerInfo::Ping TAB
$ServerInfo::PlayerCount @ "/" @ $ServerInfo::MaxPlayers TAB
$ServerInfo::Version TAB
$ServerInfo::MissionName
);
%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);
}
JS_serverList.sort(0);
JS_serverList.setSelectedRow(0);
JS_serverList.scrollVisible(0);
JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0);
JoinServerJoinBtn.setActive(JoinServerList.getCount() > 0);
}
//----------------------------------------
@ -141,11 +143,9 @@ function onServerQueryStatus(%status, %msg, %value)
switch$ (%status) {
case "start":
JoinServerJoinBtn.setActive(false);
JoinServerQryInternetBtn.setActive(false);
JS_statusText.setText(%msg);
JS_statusBar.setValue(0);
JS_serverList.clear();
JoinServerList.clear();
case "ping":
JS_statusText.setText("Ping Servers");
@ -156,7 +156,6 @@ function onServerQueryStatus(%status, %msg, %value)
JS_statusBar.setValue(%value);
case "done":
JoinServerQryInternetBtn.setActive(true);
JS_queryStatus.setVisible(false);
JS_status.setText(%msg);
JoinServerMenu.update();

View file

@ -1,6 +1,6 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
bitmapAsset = "UI:background_dark_image";
BitmapAsset = "UI:background_dark_image";
useVariable = "0";
tile = "0";
position = "0 0";
@ -19,15 +19,11 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
Enabled = "1";
isDecoy = "0";
navigationIndex = "-1";
new GuiBitmapCtrl(MainMenuAppLogo) {
bitmapAsset = "UI:Torque_3D_logo_alt_image";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
masked = "0";
groupNum = "-1";
BitmapAsset = "UI:Torque_3D_logo_alt_image";
color = "255 255 255 255";
wrap = "0";
position = "550 30";
extent = "443 139";
minExtent = "8 2";
@ -41,26 +37,179 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "1";
autoFitExtents = "0";
bitmapMode = "Stretched";
groupNum = "-1";
masked = "0";
navigationIndex = "-1";
useModifiers = "0";
useStates = "1";
};
new GuiGameListMenuCtrl(MainMenuButtonList) {
debugRender = "0";
callbackOnInputs = "1";
position = "292 103";
extent = "439 561";
minExtent = "8 2";
new GuiStackControl(MainMenuButtonList) {
stackingType = "Vertical";
horizStacking = "Left to Right";
vertStacking = "Top to Bottom";
padding = "15";
dynamicSize = "0";
dynamicNonStackExtent = "0";
dynamicPos = "0";
changeChildSizeToFit = "1";
changeChildPosition = "1";
position = "312 111";
extent = "400 477";
minExtent = "16 16";
horizSizing = "center";
vertSizing = "center";
profile = "DefaultListMenuProfile";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "UIMenuButtonList";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
class = "MenuList";
new GuiButtonCtrl(MainMenuSinglePlayerBtn) {
text = "Single Player";
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 = "openSinglePlayerMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
text = "Create Server";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 70";
extent = "400 55";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "openMultiPlayerMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
text = "Join Server";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 140";
extent = "400 55";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "openJoinServerMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(MainMenuOptionBtn) {
text = "Options";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 210";
extent = "400 55";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "openOptionsMenu();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(MainMenuWorldEditBtn) {
text = "Open World Editor";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 280";
extent = "400 55";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "openWorldEditorBtn();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(MainMenuGuiEditBtn) {
text = "Open GUI Editor";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 350";
extent = "400 55";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "openGUIEditorBtn();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(MainMenuExitBtn) {
text = "Exit";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 420";
extent = "400 55";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "exit();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl(MainMenuButtonHolder) {
position = "189 711";
@ -80,7 +229,7 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
BitmapAsset = "UI:Keyboard_Black_Return_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -109,5 +258,26 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
canSaveDynamicFields = "0";
};
};
new GuiInputCtrl(MainMenuInputHandler) {
class = "MenuInputHandler";
sendAxisEvents = "1";
sendBreakEvents = "1";
sendModifierEvents = "0";
ignoreMouseEvents = "1";
lockMouse = "0";
position = "-50 0";
extent = "10 10";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiInputCtrlProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
//--- OBJECT WRITE END ---

View file

@ -5,8 +5,9 @@ function MainMenuGui::onAdd(%this)
function MainMenuGui::onWake(%this)
{
MainMenuButtonList.hidden = false;
MainMenuButtonList.setAsActiveMenuList();
MainMenuButtonHolder.setActive();
MainMenuInputHandler.setFirstResponder();
}
function MainMenuGui::onSleep(%this)
@ -16,18 +17,7 @@ function MainMenuGui::onSleep(%this)
function MainMenuButtonHolder::onWake(%this)
{
%this-->goButton.set("btn_a", "Return", "Go", "MainMenuButtonList.activateRow();");
}
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);
%this-->goButton.set("btn_a", "Return", "Go", "MainMenuButtonList.activate();");
}
function openSinglePlayerMenu()

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ $guiContent = new GuiControl(OptionsMenu) {
position = "48 56";
extent = "928 655";
minExtent = "8 2";
horizSizing = "center";
horizSizing = "aspectCenter";
vertSizing = "center";
profile = "GuiDefaultProfile";
visible = "1";
@ -38,7 +38,27 @@ $guiContent = new GuiControl(OptionsMenu) {
percent = "100";
vertical = "0";
flipClip = "0";
bitmap = "data/ui/images/panel.png";
BitmapAsset = "UI:panel_low_image";
color = "255 255 255 255";
position = "0 40";
extent = "927 618";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
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 = "927 40";
@ -77,179 +97,6 @@ $guiContent = new GuiControl(OptionsMenu) {
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiBitmapBarCtrl() {
percent = "100";
vertical = "0";
flipClip = "0";
bitmap = "data/ui/images/panel_low.png";
color = "255 255 255 255";
position = "0 40";
extent = "927 618";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
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";
command = "OptionsMenu.populateDisplaySettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "DisplayButton";
canSave = "1";
canSaveDynamicFields = "0";
};
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";
command = "OptionsMenu.populateGraphicsSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "GraphicsButton";
canSave = "1";
canSaveDynamicFields = "0";
};
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";
command = "OptionsMenu.populateAudioSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "AudioButton";
canSave = "1";
canSaveDynamicFields = "0";
};
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";
command = "OptionsMenu.populateKeyboardMouseSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "KBMButton";
canSave = "1";
canSaveDynamicFields = "0";
};
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";
command = "OptionsMenu.populateGamepadSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "gamepadButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = "1";
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) {
debugRender = "0";
callbackOnInputs = "1";
position = "1 1";
extent = "621 510";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "DefaultListMenuProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "UIMenuButtonList";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiTextCtrl(OptionName) {
maxLength = "1024";
margin = "0 0 0 0";
@ -258,10 +105,10 @@ $guiContent = new GuiControl(OptionsMenu) {
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "635 94";
position = "3 606";
extent = "293 17";
minExtent = "8 2";
horizSizing = "right";
horizSizing = "width";
vertSizing = "bottom";
profile = "MenuSubHeaderText";
visible = "1";
@ -278,10 +125,10 @@ $guiContent = new GuiControl(OptionsMenu) {
maxChars = "-1";
text = "This is a placeholder text for an option.";
useURLMouseCursor = "0";
position = "635 126";
position = "3 625";
extent = "293 14";
minExtent = "8 2";
horizSizing = "right";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiMLTextProfile";
visible = "1";
@ -292,24 +139,286 @@ $guiContent = new GuiControl(OptionsMenu) {
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiControl() {
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";
new GuiSplitContainer() {
orientation = "Vertical";
splitterSize = "2";
splitPoint = "250 100";
fixedPanel = "FirstPanel";
fixedSize = "250";
docking = "None";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "0 48";
extent = "928 555";
minExtent = "64 64";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiMenuScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiPanel() {
docking = "Client";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "0 0";
extent = "248 555";
minExtent = "16 16";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiOverlayProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "Panel1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiStackControl(OptionsMenuCategoryList) {
stackingType = "Vertical";
horizStacking = "Left to Right";
vertStacking = "Top to Bottom";
padding = "10";
dynamicSize = "0";
dynamicNonStackExtent = "0";
dynamicPos = "0";
changeChildSizeToFit = "1";
changeChildPosition = "1";
position = "0 0";
extent = "248 555";
minExtent = "16 16";
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
class = "MenuList";
canSave = "1";
canSaveDynamicFields = "0";
new GuiButtonCtrl(OptionsMenuDisplayBtn) {
text = "Display";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 0";
extent = "248 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "populateDisplaySettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(OptionsMenuGraphicsBtn) {
text = "Graphics";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 45";
extent = "248 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "populateGraphicsSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(OptionsMenuAudioBtn) {
text = "Audio";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 90";
extent = "248 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "populateAudioSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(OptionsMenuKBMBtn) {
text = "Keyboard & Mouse";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 135";
extent = "248 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "populateKeyboardMouseSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(OptionsMenuGamepadBtn) {
text = "Gamepad";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 180";
extent = "248 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "populateGamepadSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl(OptionsMenuProfileBtn) {
text = "Profile";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "0 225";
extent = "248 35";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "populateProfileSettingsList();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
new GuiPanel() {
docking = "Client";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "252 0";
extent = "676 555";
minExtent = "16 16";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiOverlayProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "panel2";
canSave = "1";
canSaveDynamicFields = "0";
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 = "0 0";
extent = "676 554";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiMenuScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiStackControl(OptionsMenuSettingsList) {
stackingType = "Vertical";
horizStacking = "Left to Right";
vertStacking = "Top to Bottom";
padding = "5";
dynamicSize = "1";
dynamicNonStackExtent = "0";
dynamicPos = "0";
changeChildSizeToFit = "0";
changeChildPosition = "1";
position = "1 1";
extent = "661 30";
minExtent = "16 16";
horizSizing = "width";
vertSizing = "height";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
class = "MenuList";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
};
};
new GuiControl(OptionsButtonHolder) {
position = "109 711";
position = "116 711";
extent = "791 40";
minExtent = "8 2";
horizSizing = "center";
@ -326,7 +435,7 @@ $guiContent = new GuiControl(OptionsMenu) {
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
BitmapAsset = "UI:Keyboard_Black_Return_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -345,7 +454,7 @@ $guiContent = new GuiControl(OptionsMenu) {
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "ChooseLevelDlg.beginLevel();";
command = "OptionsMenu.apply();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -356,7 +465,7 @@ $guiContent = new GuiControl(OptionsMenu) {
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc";
BitmapAsset = "UI:Keyboard_Black_Escape_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -375,7 +484,7 @@ $guiContent = new GuiControl(OptionsMenu) {
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "ChooseLevelDlg.backOut();";
command = "OptionsMenu.backOut();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -386,7 +495,7 @@ $guiContent = new GuiControl(OptionsMenu) {
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
BitmapAsset = "UI:Switch_LB_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -403,19 +512,21 @@ $guiContent = new GuiControl(OptionsMenu) {
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
visible = "0";
active = "0";
command = "OptionsMenu.prevTab();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "prevTabButton";
class = "MenuInputButton";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc";
BitmapAsset = "UI:Switch_RB_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -432,19 +543,21 @@ $guiContent = new GuiControl(OptionsMenu) {
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
visible = "0";
active = "0";
command = "OptionsMenu.nextTab();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "nextTabButton";
class = "MenuInputButton";
hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiIconButtonCtrl() {
buttonMargin = "4 4";
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc";
BitmapAsset = "UI:Keyboard_Black_R_image";
iconLocation = "Left";
sizeIconToButton = "1";
makeIconSquare = "1";
@ -463,6 +576,7 @@ $guiContent = new GuiControl(OptionsMenu) {
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "OptionsMenu.resetToDefaults();";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -472,5 +586,26 @@ $guiContent = new GuiControl(OptionsMenu) {
canSaveDynamicFields = "0";
};
};
new GuiInputCtrl(OptionsMenuInputHandler) {
sendAxisEvents = "1";
sendBreakEvents = "1";
sendModifierEvents = "0";
ignoreMouseEvents = "1";
lockMouse = "0";
position = "-50 0";
extent = "10 10";
minExtent = "8 2";
horizSizing = "left";
vertSizing = "top";
profile = "GuiInputCtrlProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
class = "MenuInputHandler";
canSave = "1";
canSaveDynamicFields = "0";
};
};
//--- OBJECT WRITE END ---

View file

@ -54,20 +54,22 @@ function OptionsMenu::onWake(%this)
{
MainMenuButtonList.hidden = true;
%this.pageTabIndex = 0;
%tab = %this.getTab();
%tab.performClick();
OptionsMenuCategoryList.setAsActiveMenuList();
OptionsButtonHolder.setActive();
OptionsMenuInputHandler.setFirstResponder();
}
function OptionsButtonHolder::onWake(%this)
{
%this-->prevTabButton.set("btn_l", "", "Prev Tab", "OptionsMenu.prevTab();", true);
%this-->nextTabButton.set("btn_r", "", "Next Tab", "OptionsMenu.nextTab();", true);
//%this-->prevTabButton.set("btn_l", "", "Prev Tab", "OptionsMenu.prevTab();", true);
%this-->nextTabButton.set("btn_a", "", "Select", "OptionsMenuList.activate();", true);
%this-->resetButton.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
%this-->applyButton.set("btn_start", "Return", "Apply", "OptionsMenu.apply();");
%this-->backButton.set("btn_b", "Escape", "Back", "OptionsMenu.backOut();");
//OptionsMenuCategoryList.getObject(0).performClick();
}
function OptionsMenu::apply(%this)
@ -78,7 +80,7 @@ function OptionsMenu::apply(%this)
}
else if(%this.pageTabIndex == 1)
{
%this.applyGraphicsSettings();
%this.applyGraphicsSettings();
}
else if(%this.pageTabIndex == 2)
{
@ -130,26 +132,24 @@ function OptionsMenuSettingsList::onChange(%this)
if(%currentRowText $= "Display")
{
OptionsMenuList.populateDisplaySettingsList();
populateDisplaySettingsList();
}
else if(%currentRowText $= "Graphics")
{
OptionsMenuList.populateGraphicsSettingsList();
populateGraphicsSettingsList();
}
else if(%currentRowText $= "Audio")
{
OptionsMenuList.populateAudioSettingsList();
populateAudioSettingsList();
}
else if(%currentRowText $= "Keyboard + Mouse")
{
OptionsMenuList.populateKeyboardMouseSettingsList();
populateKeyboardMouseSettingsList();
}
else if(%currentRowText $= "Gamepad")
{
OptionsMenuList.populateGamepadSettingsList();
populateGamepadSettingsList();
}
}
function OptionsMenu::prevTab(%this)
@ -188,10 +188,9 @@ function OptionsMenu::getTab(%this)
return %this-->DisplayButton;
}
function OptionsMenu::populateDisplaySettingsList(%this)
function populateDisplaySettingsList()
{
%this.pageTabIndex = 0;
OptionsMenuSettingsList.clearRows();
OptionsMenuSettingsList.clear();
OptionName.setText("");
OptionDescription.setText("");
@ -221,7 +220,7 @@ function OptionsMenu::populateDisplaySettingsList(%this)
trim(%apiList);
OptionsMenuSettingsList.addOptionRow("Display API", %apiList, false, "", -1, -30, true, "The display API used for rendering.", %displayDevice);
OptionsMenuSettingsList.addOptionRow("Display API", %apiList, false, "", true, "The display API used for rendering.", %displayDevice);
%numDevices = Canvas.getMonitorCount();
%devicesList = "";
@ -235,7 +234,7 @@ function OptionsMenu::populateDisplaySettingsList(%this)
}
%selectedDevice = getField(%devicesList, $pref::Video::deviceId);
OptionsMenuSettingsList.addOptionRow("Display Device", %devicesList, false, "onDisplayModeChange", -1, -30, true, "The display devices the window should be on.", %selectedDevice);
OptionsMenuSettingsList.addOptionRow("Display Device", %devicesList, false, "onDisplayModeChange", true, "The display devices the window should be on.", %selectedDevice);
if (%numDevices > 1)
OptionsMenuSettingsList.setRowEnabled(1, true);
@ -243,10 +242,10 @@ function OptionsMenu::populateDisplaySettingsList(%this)
OptionsMenuSettingsList.setRowEnabled(1, false);
%mode = getField($Video::ModeTags, $pref::Video::deviceMode);
OptionsMenuSettingsList.addOptionRow("Window Mode", $Video::ModeTags, false, "onDisplayModeChange", -1, -30, true, "", %mode);
OptionsMenuSettingsList.addOptionRow("Window Mode", $Video::ModeTags, false, "onDisplayModeChange", true, "", %mode);
%resolutionList = getScreenResolutionList($pref::Video::deviceId, $pref::Video::deviceMode);
OptionsMenuSettingsList.addOptionRow("Resolution", %resolutionList, false, "onDisplayResChange", -1, -30, true, "Resolution of the game window", _makePrettyResString( $pref::Video::mode ));
OptionsMenuSettingsList.addOptionRow("Resolution", %resolutionList, false, "onDisplayResChange", true, "Resolution of the game window", _makePrettyResString( $pref::Video::mode ));
//If they're doing borderless, the window resolution must match the display resolution
if(%mode !$= "Borderless")
@ -254,19 +253,17 @@ function OptionsMenu::populateDisplaySettingsList(%this)
else
OptionsMenuSettingsList.setRowEnabled(3, false);
OptionsMenuSettingsList.addOptionRow("VSync", "No\tYes", false, "", -1, -30, true, "", convertBoolToYesNo(!$pref::Video::disableVerticalSync));
OptionsMenuSettingsList.addOptionRow("VSync", "No\tYes", false, "", true, "", convertBoolToYesNo(!$pref::Video::disableVerticalSync));
%refreshList = getScreenRefreshList($pref::Video::mode);
OptionsMenuSettingsList.addOptionRow("Refresh Rate", %refreshList, false, "", -1, -30, true, "", $pref::Video::RefreshRate);
OptionsMenuSettingsList.addOptionRow("Refresh Rate", %refreshList, false, "", true, "", $pref::Video::RefreshRate);
//move to gameplay tab
OptionsMenuSettingsList.addSliderRow("Field of View", 75, 5, "65 100", "", -1, -30);
OptionsMenuSettingsList.addSliderRow("Field of View", 75, 5, "65 100", "");
OptionsMenuSettingsList.addSliderRow("Brightness", 0.5, 0.1, "0 1", "", -1, -30);
OptionsMenuSettingsList.addSliderRow("Contrast", 0.5, 0.1, "0 1", "", -1, -30);
OptionsMenuSettingsList.refresh();
OptionsMenuSettingsList.addSliderRow("Brightness", 0.5, 0.1, "0 1", "");
OptionsMenuSettingsList.addSliderRow("Contrast", 0.5, 0.1, "0 1", "");
}
function OptionsMenu::applyDisplaySettings(%this)
@ -290,10 +287,9 @@ function OptionsMenu::applyDisplaySettings(%this)
export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
}
function OptionsMenu::populateGraphicsSettingsList(%this)
function populateGraphicsSettingsList(%this)
{
%this.pageTabIndex = 1;
OptionsMenuSettingsList.clearRows();
OptionsMenuSettingsList.clear();
OptionName.setText("");
OptionDescription.setText("");
@ -303,26 +299,24 @@ function OptionsMenu::populateGraphicsSettingsList(%this)
%highMedLow = "Low\tMedium\tHigh";
%anisoFilter = "Off\t4\t8\t16";
%aaFilter = "Off\t1\t2\t4";
OptionsMenuSettingsList.addOptionRow("Lighting Quality", getQualityLevels(LightingQualityList), false, "", -1, -30, true, "Amount and drawdistance of local lights", getCurrentQualityLevel(LightingQualityList));
OptionsMenuSettingsList.addOptionRow("Shadow Quality", getQualityLevels(ShadowQualityList), false, "", -1, -30, true, "Shadow revolution quality", getCurrentQualityLevel(ShadowQualityList));
OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", getQualityLevels(SoftShadowList), false, "", -1, -30, true, "Amount of softening applied to shadowmaps", getCurrentQualityLevel(SoftShadowList));
OptionsMenuSettingsList.addOptionRow("Mesh Quality", getQualityLevels(MeshQualityGroup), false, "", -1, -30, true, "Fidelity of rendering of mesh objects", getCurrentQualityLevel(MeshQualityGroup));
OptionsMenuSettingsList.addOptionRow("Object Draw Distance", getQualityLevels(MeshDrawDistQualityGroup), false, "", -1, -30, true, "Dictates if and when static objects fade out in the distance", getCurrentQualityLevel(MeshDrawDistQualityGroup));
OptionsMenuSettingsList.addOptionRow("Texture Quality", getQualityLevels(TextureQualityGroup), false, "", -1, -30, true, "Fidelity of textures", getCurrentQualityLevel(TextureQualityGroup));
OptionsMenuSettingsList.addOptionRow("Terrain Quality", getQualityLevels(TerrainQualityGroup), false, "", -1, -30, true, "Quality level of terrain objects", getCurrentQualityLevel(TerrainQualityGroup));
OptionsMenuSettingsList.addOptionRow("Decal Lifetime", getQualityLevels(DecalLifetimeGroup), false, "", -1, -30, true, "How long decals are rendered", getCurrentQualityLevel(DecalLifetimeGroup));
OptionsMenuSettingsList.addOptionRow("Ground Cover Density", getQualityLevels(GroundCoverDensityGroup), false, "", -1, -30, true, "Density of ground cover items, such as grass", getCurrentQualityLevel(GroundCoverDensityGroup));
OptionsMenuSettingsList.addOptionRow("Shader Quality", getQualityLevels(ShaderQualityGroup), false, "", -1, -30, true, "Dictates the overall shader quality level, adjusting what features are enabled.", getCurrentQualityLevel(ShaderQualityGroup));
OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", %anisoFilter, false, "", -1, -30, true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance", $pref::Video::defaultAnisotropy);
OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", %aaFilter, false, "", -1, -30, true, "Amount of Post-Processing Anti-Aliasing applied to rendering", $pref::Video::AA);
OptionsMenuSettingsList.addOptionRow("Parallax", %onOffList, false, "", -1, -30, true, "Whether the surface parallax shader effect is enabled", convertBoolToOnOff(!$pref::Video::disableParallaxMapping));
OptionsMenuSettingsList.addOptionRow("Water Reflections", %onOffList, false, "", -1, -30, true, "Whether water reflections are enabled", convertBoolToOnOff(!$pref::Water::disableTrueReflections));
OptionsMenuSettingsList.addOptionRow("SSAO", %onOffList, false, "", -1, -30, true, "Whether Screen-Space Ambient Occlusion is enabled", convertBoolToOnOff($pref::PostFX::EnableSSAO));
OptionsMenuSettingsList.addOptionRow("Depth of Field", %onOffList, false, "", -1, -30, true, "Whether the Depth of Field effect is enabled", convertBoolToOnOff($pref::PostFX::EnableDOF));
OptionsMenuSettingsList.addOptionRow("Vignette", %onOffList, false, "", -1, -30, true, "Whether the vignette effect is enabled", convertBoolToOnOff($pref::PostFX::EnableVignette));
OptionsMenuSettingsList.addOptionRow("Light Rays", %onOffList, false, "", -1, -30, true, "Whether the light rays effect is enabled", convertBoolToOnOff($pref::PostFX::EnableLightRays));
OptionsMenuSettingsList.refresh();
OptionsMenuSettingsList.addOptionRow("Lighting Quality", getQualityLevels(LightingQualityList), false, "", true, "Amount and drawdistance of local lights", getCurrentQualityLevel(LightingQualityList));
OptionsMenuSettingsList.addOptionRow("Shadow Quality", getQualityLevels(ShadowQualityList), false, "", true, "Shadow revolution quality", getCurrentQualityLevel(ShadowQualityList));
OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", getQualityLevels(SoftShadowList), false, "", true, "Amount of softening applied to shadowmaps", getCurrentQualityLevel(SoftShadowList));
OptionsMenuSettingsList.addOptionRow("Mesh Quality", getQualityLevels(MeshQualityGroup), false, "", true, "Fidelity of rendering of mesh objects", getCurrentQualityLevel(MeshQualityGroup));
OptionsMenuSettingsList.addOptionRow("Object Draw Distance", getQualityLevels(MeshDrawDistQualityGroup), false, "", true, "Dictates if and when static objects fade out in the distance", getCurrentQualityLevel(MeshDrawDistQualityGroup));
OptionsMenuSettingsList.addOptionRow("Texture Quality", getQualityLevels(TextureQualityGroup), false, "", true, "Fidelity of textures", getCurrentQualityLevel(TextureQualityGroup));
OptionsMenuSettingsList.addOptionRow("Terrain Quality", getQualityLevels(TerrainQualityGroup), false, "", true, "Quality level of terrain objects", getCurrentQualityLevel(TerrainQualityGroup));
OptionsMenuSettingsList.addOptionRow("Decal Lifetime", getQualityLevels(DecalLifetimeGroup), false, "", true, "How long decals are rendered", getCurrentQualityLevel(DecalLifetimeGroup));
OptionsMenuSettingsList.addOptionRow("Ground Cover Density", getQualityLevels(GroundCoverDensityGroup), false, "", true, "Density of ground cover items, such as grass", getCurrentQualityLevel(GroundCoverDensityGroup));
OptionsMenuSettingsList.addOptionRow("Shader Quality", getQualityLevels(ShaderQualityGroup), false, "", true, "Dictates the overall shader quality level, adjusting what features are enabled.", getCurrentQualityLevel(ShaderQualityGroup));
OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", %anisoFilter, false, "", true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance", $pref::Video::defaultAnisotropy);
OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", %aaFilter, false, "", true, "Amount of Post-Processing Anti-Aliasing applied to rendering", $pref::Video::AA);
OptionsMenuSettingsList.addOptionRow("Parallax", %onOffList, false, "", true, "Whether the surface parallax shader effect is enabled", convertBoolToOnOff(!$pref::Video::disableParallaxMapping));
OptionsMenuSettingsList.addOptionRow("Water Reflections", %onOffList, false, "", true, "Whether water reflections are enabled", convertBoolToOnOff(!$pref::Water::disableTrueReflections));
OptionsMenuSettingsList.addOptionRow("SSAO", %onOffList, false, "", true, "Whether Screen-Space Ambient Occlusion is enabled", convertBoolToOnOff($pref::PostFX::EnableSSAO));
OptionsMenuSettingsList.addOptionRow("Depth of Field", %onOffList, false, "", true, "Whether the Depth of Field effect is enabled", convertBoolToOnOff($pref::PostFX::EnableDOF));
OptionsMenuSettingsList.addOptionRow("Vignette", %onOffList, false, "", true, "Whether the vignette effect is enabled", convertBoolToOnOff($pref::PostFX::EnableVignette));
OptionsMenuSettingsList.addOptionRow("Light Rays", %onOffList, false, "", true, "Whether the light rays effect is enabled", convertBoolToOnOff($pref::PostFX::EnableLightRays));
}
function OptionsMenu::applyGraphicsSettings(%this)
@ -439,10 +433,9 @@ function updateDisplaySettings()
}
}
function OptionsMenu::populateAudioSettingsList(%this)
function populateAudioSettingsList(%this)
{
%this.pageTabIndex = 2;
OptionsMenuSettingsList.clearRows();
OptionsMenuSettingsList.clear();
OptionName.setText("");
OptionDescription.setText("");
@ -477,18 +470,15 @@ function OptionsMenu::populateAudioSettingsList(%this)
else
%audioDeviceList = %audioDeviceList @ "\t" @ %device;
}
}
OptionsMenuSettingsList.addOptionRow("Audio Provider", %audioProviderList, false, "audioProviderChanged", -1, -15, true, "", $currentAudioProvider);
OptionsMenuSettingsList.addOptionRow("Audio Device", %audioDeviceList, false, "", -1, -15, true, $pref::SFX::device);
OptionsMenuSettingsList.addOptionRow("Audio Provider", %audioProviderList, false, "audioProviderChanged", true, "", $currentAudioProvider);
OptionsMenuSettingsList.addOptionRow("Audio Device", %audioDeviceList, false, "", true, $pref::SFX::device);
OptionsMenuSettingsList.addSliderRow("Master Volume", $pref::SFX::masterVolume, 0.1, "0 1", "", -1, -30);
OptionsMenuSettingsList.addSliderRow("GUI Volume", $pref::SFX::channelVolume[ $GuiAudioType], 0.1, "0 1", "", -1, -30);
OptionsMenuSettingsList.addSliderRow("Effects Volume", $pref::SFX::channelVolume[ $SimAudioType ], 0.1, "0 1", "", -1, -30);
OptionsMenuSettingsList.addSliderRow("Music Volume", $pref::SFX::channelVolume[ $MusicAudioType ], 0.1, "0 1", "", -1, -30);
OptionsMenuSettingsList.refresh();
OptionsMenuSettingsList.addSliderRow("Master Volume", $pref::SFX::masterVolume, 0.1, "0 1", "");
OptionsMenuSettingsList.addSliderRow("GUI Volume", $pref::SFX::channelVolume[ $GuiAudioType], 0.1, "0 1", "");
OptionsMenuSettingsList.addSliderRow("Effects Volume", $pref::SFX::channelVolume[ $SimAudioType ], 0.1, "0 1", "");
OptionsMenuSettingsList.addSliderRow("Music Volume", $pref::SFX::channelVolume[ $MusicAudioType ], 0.1, "0 1", "");
}
function audioProviderChanged()
@ -498,7 +488,7 @@ function audioProviderChanged()
$currentAudioProvider = %provider;
//And now refresh the list to get the correct devices
OptionsMenu.populateAudioSettingsList();
populateAudioSettingsList();
}
function OptionsMenu::applyAudioSettings(%this)
@ -531,10 +521,9 @@ function OptionsMenu::applyAudioSettings(%this)
}
}
function OptionsMenu::populateKeyboardMouseSettingsList(%this)
function populateKeyboardMouseSettingsList(%this)
{
%this.pageTabIndex = 3;
OptionsMenuSettingsList.clearRows();
OptionsMenuSettingsList.clear();
OptionName.setText("");
OptionDescription.setText("");
@ -542,13 +531,12 @@ function OptionsMenu::populateKeyboardMouseSettingsList(%this)
$remapListDevice = "keyboard";
fillRemapList();
OptionsMenuSettingsList.refresh();
//OptionsMenuSettingsList.refresh();
}
function OptionsMenu::populateGamepadSettingsList(%this)
function populateGamepadSettingsList(%this)
{
%this.pageTabIndex = 4;
OptionsMenuSettingsList.clearRows();
OptionsMenuSettingsList.clear();
OptionName.setText("");
OptionDescription.setText("");
@ -586,6 +574,69 @@ function OptionsMenu::backOut(%this)
}
}
function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
{
%option = %this.getObject(%row);
if(isObject(%option))
{
%option.setEnabled(%status);
}
}
function OptionsMenuSettingsList::addOptionRow(%this, %label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue)
{
if(%enabled $= "")
%enabled = true;
%optionsRowSize = 30;
%optionColumnWidth = %this.extent.x - 450;//todo, calculate off longest option text?
%option = new GuiGameSettingsCtrl() {
class = "MenuOptionsButton";
profile = "GuiMenuButtonProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "0 0";
extent = %this.extent.x SPC %optionsRowSize;
columnSplit = %optionColumnWidth;
useMouseEvents = true;
};
%option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue);
%this.add(%option);
}
function OptionsMenuSettingsList::addSliderRow(%this, %label, %defaultValue, %increment, %range, %callback, %enabled, %description)
{
if(%enabled $= "")
%enabled = true;
%optionsRowSize = 30;
%optionColumnWidth = %this.extent.x - 450;//todo, calculate off longest option text?
%option = new GuiGameSettingsCtrl() {
class = "MenuOptionsButton";
profile = "GuiMenuButtonProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "0 0";
extent = %this.extent.x SPC %optionsRowSize;
columnSplit = %optionColumnWidth;
useMouseEvents = true;
};
%option.setSliderSetting(%label, %defaultValue, %increment, %range, %callback, %enabled, %description);
%this.add(%option);
}
//
function OptionsMenuCategoryList::onNavigate(%this, %index)
{
%this.getObject(%index).performClick();
}
function convertOptionToBool(%val)
{
if(%val $= "yes" || %val $= "on")
@ -685,4 +736,16 @@ function onDisplayResChange(%val)
OptionsMenuSettingsList.setOptions(5, %refreshList);
OptionsMenuSettingsList.selectOption(5, %newRate);
}
function MenuOptionsButton::onMouseEnter(%this)
{
OptionName.setText(%this.getLabel());
OptionDescription.setText(%this.getToolTip());
}
function MenuOptionsButton::onMouseLeave(%this)
{
OptionName.setText("");
OptionDescription.setText("");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Before After
Before After

View file

@ -176,7 +176,7 @@ function fillRemapList()
OptionsMenuSettingsList.addKeybindRow(getField(%keyMap, 0), getButtonBitmap(%device, getField(%keyMap, 1)), "doKeyRemap", -1, -15, true, %description);
}
OptionsMenuSettingsList.refresh();
//OptionsMenuSettingsList.refresh();
//OptionsMenu.addRow( %i, %this.buildFullMapString( %i ) );
}

View file

@ -1,341 +0,0 @@
//==============================================================================
// Menu Input Buttons
// This file manages the Menu Input Buttons stuff
// Any time you have a GUI button that should be clickable AND map to a key input
// such as a gamepad button, or enter, etc, this stuff can be used
//==============================================================================
/*
Gamepad input reference for 360 controller
btn_a = A
btn_b = B
btn_x = X
btn_y = Y
btn_r = Right Bumper
btn_l = Right Bumper
upov = Dpad Up
dpov = Dpad Down
lpov = Dpad Left
rpov = Dpad Right
xaxis = Left Stick | + values = up, - values = down
yaxis = Left Stick | + values = up, - values = down
rxaxis = Right Stick | + values = up, - values = down
ryaxis = Right Stick | + values = up, - values = down
zaxis = Left Trigger
rzaxis = Right Trigger
btn_start = Start
btn_back = Back/Select
*/
/// This is used with the main UI menu lists, when a non-axis input event is called
/// such as pressing a button
/// It is called from the engine
function UIMenuButtonList::onInputEvent(%this, %device, %action, %state)
{
if(%state)
$activeMenuButtonContainer.processInputs(%device, %action);
}
/// This is used with the main UI menu lists, when an axis input event is called
/// such as moving a joystick
/// It is called from the engine
function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal)
{
//Skip out of the value is too low as it could just be noise or miscalibrated defaults
if(%axisVal < 0.02)
return;
$activeMenuButtonContainer.processAxisEvent(%device, %action);
}
/// Sets the command and text for the specified button. If %text and %command
/// are left empty, the button will be disabled and hidden.
///
/// \param %gamepadButton (string) The button to set for when using gamepad input. See the input map reference comment at the top of the file
/// \param %keyboardButton (string) The button to set for when using keyboard/mouse input.
/// \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.
/// \param %gamepadOnly (bool) If true, will only show the button when working in the gamepad input mode
function MenuInputButton::set(%this, %gamepadButton, %keyboardButton, %text, %command, %gamepadOnly)
{
%set = (! ((%text $= "") && (%command $= "")));
%this.setText(%text);
%this.setActive(%set);
%this.setVisible(%set);
%this.gamepadButton = %gamepadButton;
%this.keyboardButton = %keyboardButton;
if(%gamepadOnly $= "")
%gamepadOnly = false;
%this.gamepadOnly = %gamepadOnly;
%this.Command = %command;
}
/// Refreshes the specific button, updating it's visbility status and the displayed input image
function MenuInputButton::refresh(%this)
{
%set = (! ((%this.text $= "") && (%this.command $= "")));
//Special-case of where we're in keyboard+mouse mode, but the menubutton is gamepad only mode, so we early out
if(%this.gamepadOnly && $activeControllerType !$= "gamepad")
%set = false;
%this.setActive(%set);
%this.setVisible(%set);
if(!%this.isActive())
return;
if($activeControllerType $= "gamepad")
{
if(%this.gamepadButton !$= "")
{
%assetId = "";
if($activeControllerName $= "PS4 Controller")
{
%assetId = "UI:PS4_";
if(%this.gamepadButton $= "btn_a")
%assetId = %assetId @ "Cross";
else if(%this.gamepadButton $= "btn_b")
%assetId = %assetId @ "Circle";
else if(%this.gamepadButton $= "btn_x")
%assetId = %assetId @ "Square";
else if(%this.gamepadButton $= "btn_y")
%assetId = %assetId @ "Triangle";
else if(%this.gamepadButton $= "btn_l")
%assetId = %assetId @ "L1";
else if(%this.gamepadButton $= "zaxis")
%assetId = %assetId @ "L2";
else if(%this.gamepadButton $= "btn_r")
%assetId = %assetId @ "R1";
else if(%this.gamepadButton $= "rzaxis")
%assetId = %assetId @ "R2";
else if(%this.gamepadButton $= "btn_start")
%assetId = %assetId @ "Options";
else if(%this.gamepadButton $= "btn_back")
%assetId = %assetId @ "Share";
}
else if($activeControllerName $= "Nintendo Switch Pro Controller")
{
%assetId = "UI:Switch_";
if(%this.gamepadButton $= "btn_a")
%assetId = %assetId @ "B";
else if(%this.gamepadButton $= "btn_b")
%assetId = %assetId @ "A";
else if(%this.gamepadButton $= "btn_x")
%assetId = %assetId @ "Y";
else if(%this.gamepadButton $= "btn_y")
%assetId = %assetId @ "X";
else if(%this.gamepadButton $= "btn_l")
%assetId = %assetId @ "LB";
else if(%this.gamepadButton $= "zaxis")
%assetId = %assetId @ "LT";
else if(%this.gamepadButton $= "btn_r")
%assetId = %assetId @ "RB";
else if(%this.gamepadButton $= "rzaxis")
%assetId = %assetId @ "RT";
else if(%this.gamepadButton $= "btn_start")
%assetId = %assetId @ "Plus";
else if(%this.gamepadButton $= "btn_back")
%assetId = %assetId @ "Minus";
}
else if($activeControllerName !$= "")
{
%assetId = "UI:Xbox_";
if(%this.gamepadButton $= "btn_a")
%assetId = %assetId @ "A";
else if(%this.gamepadButton $= "btn_b")
%assetId = %assetId @ "B";
else if(%this.gamepadButton $= "btn_x")
%assetId = %assetId @ "X";
else if(%this.gamepadButton $= "btn_y")
%assetId = %assetId @ "Y";
else if(%this.gamepadButton $= "btn_l")
%assetId = %assetId @ "LB";
else if(%this.gamepadButton $= "zaxis")
%assetId = %assetId @ "LT";
else if(%this.gamepadButton $= "btn_r")
%assetId = %assetId @ "RB";
else if(%this.gamepadButton $= "rzaxis")
%assetId = %assetId @ "RT";
else if(%this.gamepadButton $= "btn_start")
%assetId = %assetId @ "Menu";
else if(%this.gamepadButton $= "btn_back")
%assetId = %assetId @ "Windows";
}
}
}
else
{
if(%this.keyboardButton !$= "")
{
%assetId = "UI:Keyboard_Black_" @ %this.keyboardButton;
}
}
%this.setBitmap(%assetId @ "_image");
return true;
}
/// Refreshes a menu input container, updating the buttons inside it
function MenuInputButtonContainer::refresh(%this)
{
%count = %this.getCount();
for(%i=0; %i < %count; %i++)
{
%btn = %this.getObject(%i);
%btn.refresh();
}
}
/// Sets the given MenuInputButtonContainer as the active one. This directs input events
/// to it's buttons, ensures it's visible, and auto-hides the old active container if it was set
function MenuInputButtonContainer::setActive(%this)
{
if(isObject($activeMenuButtonContainer))
$activeMenuButtonContainer.hidden = true;
$activeMenuButtonContainer = %this;
$activeMenuButtonContainer.hidden = false;
$activeMenuButtonContainer.refresh();
}
/// Checks the input manager for if we have a gamepad active and gets it's name
/// If we have one, also sets the active input type to gamepad
function MenuInputButtonContainer::checkGamepad(%this)
{
%controllerName = SDLInputManager::JoystickNameForIndex(0);
$activeControllerName = %controllerName;
if($activeControllerName $= "")
$activeControllerType = "K&M";
else
$activeControllerType = "gamepad";
}
/// This is called by the earlier inputs callback that comes from the menu list
/// this allows us to first check what the input type is, and if the device is different
/// (such as going from keyboard and mouse to gamepad) we can refresh the buttons to update
/// the display
/// Then we process the input to see if it matches to any of the button maps for our
/// MenuInputButtons. If we have a match, we execute it's command.
function MenuInputButtonContainer::processInputs(%this, %device, %action)
{
//check to see if our status has changed
%changed = false;
%oldDevice = $activeControllerName;
%deviceName = stripTrailingNumber(%device);
if(%deviceName $= "keyboard" || %deviceName $= "mouse")
{
if($activeControllerName !$= "K&M")
%changed = true;
$activeControllerName = "K&M";
$activeControllerType = "K&M";
Canvas.showCursor();
}
else
{
if(%this.checkGamepad())
{
Canvas.hideCursor();
}
if($activeControllerType !$= %oldDevice)
%changed = true;
}
if(%changed)
%this.refresh();
//Now process the input for the button accelerator, if applicable
//Set up our basic buttons
for(%i=0; %i < %this.getCount(); %i++)
{
%btn = %this.getObject(%i);
if(!%btn.isActive())
continue;
if($activeControllerType !$= "K&M")
{
if(%btn.gamepadButton $= %action)
{
eval(%btn.command);
}
}
else
{
if(%btn.keyboardButton $= %action)
{
eval(%btn.command);
}
}
}
}
/// This is called by the earlier inputs callback that comes from the menu list
/// this allows us to first check what the input type is, and if the device is different
/// (such as going from keyboard and mouse to gamepad) we can refresh the buttons to update
/// the display
function MenuInputButtonContainer::processAxisEvent(%this, %device, %action, %axisVal)
{
//check to see if our status has changed
%changed = false;
%oldDevice = $activeControllerName;
%deviceName = stripTrailingNumber(%device);
if(%deviceName $= "mouse")
{
if($activeControllerName !$= "K&M")
%changed = true;
$activeControllerName = "K&M";
$activeControllerType = "K&M";
Canvas.showCursor();
}
else
{
if(%this.checkGamepad())
{
Canvas.hideCursor();
}
if($activeControllerType !$= %oldDevice)
%changed = true;
}
if(%changed)
%this.refresh();
}
//
//
function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType)
{
/*if(GamepadButtonsGui.checkGamepad())
{
GamepadButtonsGui.hidden = false;
}*/
}
function onSDLDeviceDisconnected(%sdlIndex)
{
/*if(!GamepadButtonsGui.checkGamepad())
{
GamepadButtonsGui.hidden = true;
}*/
}

View file

@ -145,6 +145,12 @@ new GuiControlProfile( GuiBlankMenuButtonProfile )
category = "Core";
};
if( !isObject( GuiJoinServerButtonProfile ) )
new GuiControlProfile( GuiJoinServerButtonProfile : GuiMenuButtonProfile )
{
justify = "left";
};
if( !isObject( GuiMenuTextProfile ) )
new GuiControlProfile( GuiMenuTextProfile )
{