From f14c96c2bc1ab63f572bc8d001b6acb811bcb13a Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 17 Dec 2023 03:27:30 -0600 Subject: [PATCH] Standardized titlebar formatting Cleaned up some unneeded fields in the gui files Fixed up querying presentation for joinServerMenu Removed usages of background image in favor of guiProfiles for various menus Implemented optionsMenu traversing options categories along with required keybinds Adjusted some guiProfiles' font sizes to improve legibility on smaller displays --- .../game/data/UI/guis/ChooseLevelMenu.gui | 7 +- .../BaseGame/game/data/UI/guis/GameMenu.gui | 4 - .../BaseGame/game/data/UI/guis/SystemMenu.gui | 1 - .../game/data/UI/guis/joinServerMenu.gui | 29 +- .../game/data/UI/guis/joinServerMenu.tscript | 76 ++-- .../BaseGame/game/data/UI/guis/mainMenu.gui | 6 +- .../game/data/UI/guis/optionsMenu.gui | 336 +++--------------- .../game/data/UI/guis/optionsMenu.tscript | 213 +++++++---- .../game/data/UI/scripts/profiles.tscript | 14 +- 9 files changed, 267 insertions(+), 419 deletions(-) diff --git a/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui index 5fe626a07..7fb06379a 100644 --- a/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui @@ -1,11 +1,10 @@ //--- OBJECT WRITE BEGIN --- -$guiContent = new GuiChunkedBitmapCtrl(ChooseLevelMenu) { - BitmapAsset = "UI:backgrounddark_image"; +$guiContent = new GuiControl(ChooseLevelMenu) { extent = "1280 720"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiNonModalDefaultProfile"; + profile = "GuiMenuBackgroundProfile"; category = "BaseUI"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; @@ -24,7 +23,7 @@ $guiContent = new GuiChunkedBitmapCtrl(ChooseLevelMenu) { }; new GuiPanel(ChooseLevelTitlePanel) { - extent = "1281 80"; + extent = "1281 60"; horizSizing = "width"; profile = "GuiMenuPanelProfile"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/data/UI/guis/GameMenu.gui b/Templates/BaseGame/game/data/UI/guis/GameMenu.gui index 559f8c59c..09cdf31e1 100644 --- a/Templates/BaseGame/game/data/UI/guis/GameMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/GameMenu.gui @@ -4,11 +4,7 @@ $guiContent = new GuiControl(GameMenu) { profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; - superClass = "UINavigation"; canSaveDynamicFields = "1"; - currentMenu = "SystemMenu"; - gameMenusArray = "17288"; - resizePages = "1"; new GuiInputCtrl(GameMenuInputHandler) { ignoreMouseEvents = "1"; diff --git a/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui b/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui index d2a12bed3..381762506 100644 --- a/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui @@ -15,7 +15,6 @@ $guiContent = new GuiControl(SystemMenu) { vertSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; new GuiButtonCtrl() { text = "Return to Game"; diff --git a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui index d7d787c89..fe2575ca2 100644 --- a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui @@ -20,7 +20,7 @@ $guiContent = new GuiControl(JoinServerMenu) { }; new GuiPanel(JoinServerTitlePanel) { - extent = "1281 80"; + extent = "1281 60"; horizSizing = "width"; profile = "GuiMenuPanelProfile"; tooltipProfile = "GuiToolTipProfile"; @@ -34,7 +34,7 @@ $guiContent = new GuiControl(JoinServerMenu) { }; }; new GuiContainer() { - position = "203 81"; + position = "203 61"; extent = "900 30"; profile = GuiMenuPanelProfile; tooltipProfile = "GuiToolTipProfile"; @@ -44,7 +44,7 @@ $guiContent = new GuiControl(JoinServerMenu) { new GuiTextCtrl() { text = "Server Details"; position = "0 0"; - extent = "730 30"; + extent = "700 30"; horizSizing = "right"; vertSizing = "center"; profile = "MenuSubHeaderText"; @@ -53,29 +53,29 @@ $guiContent = new GuiControl(JoinServerMenu) { new GuiTextCtrl() { text = "Ping"; - position = "730 0"; - extent = "50 30"; + position = "700 0"; + extent = "70 30"; horizSizing = "left"; vertSizing = "center"; - profile = "MenuSubHeaderText"; + profile = "MenuSubHeaderCenteredText"; tooltipProfile = "GuiToolTipProfile"; }; new GuiTextCtrl() { text = "Player Count"; - position = "780 0"; - extent = "120 30"; + position = "770 0"; + extent = "130 30"; horizSizing = "left"; vertSizing = "center"; - profile = "MenuSubHeaderText"; + profile = "MenuSubHeaderCenteredText"; tooltipProfile = "GuiToolTipProfile"; }; }; new GuiScrollCtrl() { hScrollBar = "alwaysOff"; vScrollBar = "dynamic"; - position = "203 111"; - extent = "900 601"; + position = "203 91"; + extent = "900 621"; minExtent = "8 8"; horizSizing = "center"; vertSizing = "height"; @@ -91,7 +91,6 @@ $guiContent = new GuiControl(JoinServerMenu) { vertSizing = "center"; profile = "GuiMenuDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; }; }; new GuiPanel(JoinServerButtonPanel) { @@ -113,7 +112,7 @@ $guiContent = new GuiControl(JoinServerMenu) { horizSizing = "left"; vertSizing = "center"; profile = "GuiMenuButtonProfile"; - command = "JoinServerMenu.query();"; + command = "JoinServerMenu.join();"; tooltipProfile = "GuiToolTipProfile"; }; new GuiIconButtonCtrl(JoinServerQLanBtn) { @@ -136,8 +135,8 @@ $guiContent = new GuiControl(JoinServerMenu) { makeIconSquare = "1"; textLocation = "Center"; text = "Query Server"; - position = "817 0"; - extent = "140 40"; + position = "800 0"; + extent = "160 40"; horizSizing = "left"; vertSizing = "center"; profile = "GuiMenuButtonProfile"; diff --git a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript index d829be8ce..f612a3117 100644 --- a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript @@ -3,6 +3,8 @@ function JoinServerMenu::onWake(%this) { $MenuList = JoinServerList; JoinServerList.listPosition = 0; + + JoinServerList.syncGui(); } if(!isObject( JoinServerActionMap ) ) @@ -14,11 +16,17 @@ if(!isObject( JoinServerActionMap ) ) JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" ); JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" ); + + JoinServerActionMap.bindCmd( keyboard, Enter, "JoinServerMenu::join();" ); + JoinServerActionMap.bindCmd( gamepad, btn_a, "JoinServerMenu::join();" ); } //---------------------------------------- function JoinServerMenu::query(%this) { + //Nuke the current list and indicate we're working on a query... + JoinServerList.clear(); + queryMasterServer( 0, // Query flags $Client::GameTypeQuery, // gameTypes @@ -36,6 +44,9 @@ function JoinServerMenu::query(%this) //---------------------------------------- function JoinServerMenu::queryLan(%this) { + //Nuke the current list and indicate we're working on a query... + JoinServerList.clear(); + queryLANServers( $pref::Net::Port, // lanPort for local queries 0, // Query flags @@ -63,16 +74,14 @@ function JoinServerMenu::cancel(%this) function JoinServerMenu::join(%this) { cancelServerQuery(); - %index = JS_serverList.getSelectedId(); - - JoinGame(%index); + JoinGame(JoinServerList.listPosition); } //---------------------------------------- function JoinServerMenu::refresh(%this) { cancelServerQuery(); - %index= JoinServerList.getActiveRow(); + %index = JoinServerList.listPosition; // The server info index is stored in the row along with the // rest of displayed info. @@ -98,7 +107,7 @@ function JoinServerMenu::update(%this) %serverEntry = %this.addServerEntry(); %serverEntry-->serverNameTxt.text = $ServerInfo::Name; - %serverEntry-->serverDetailsTxt.text = $ServerInfo::Version @ " | " @ $ServerInfo::MissionName @ " | " @ $ServerInfo::MissionType; + %serverEntry-->serverDetailsTxt.text = $ServerInfo::MissionName @ " | v" @ $ServerInfo::Version @ " | " @ $ServerInfo::MissionType; %serverEntry-->pingTxt.text = $ServerInfo::Ping @ " ms"; %serverEntry-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers; @@ -106,6 +115,8 @@ function JoinServerMenu::update(%this) JoinServerList.add(%serverEntry); } + + JoinServerList.syncGui(); } //---------------------------------------- @@ -115,26 +126,22 @@ function onServerQueryStatus(%status, %msg, %value) // Update query status // States: start, update, ping, query, done // value = % (0-1) done for ping and query states - if (!JS_queryStatus.isVisible()) - JS_queryStatus.setVisible(true); + //if (!JS_queryStatus.isVisible()) + // JS_queryStatus.setVisible(true); switch$ (%status) { case "start": - JS_statusText.setText(%msg); - JS_statusBar.setValue(0); + MessagePopup("", %msg, 5000); JoinServerList.clear(); case "ping": - JS_statusText.setText("Ping Servers"); - JS_statusBar.setValue(%value); + MessagePopup("", "Pinging Servers", 5000); case "query": - JS_statusText.setText("Query Servers"); - JS_statusBar.setValue(%value); + MessagePopup("", "Querying Servers", 5000); case "done": - JS_queryStatus.setVisible(false); - JS_status.setText(%msg); + MessagePopup("", %msg, 1000); JoinServerMenu.update(); } } @@ -157,39 +164,40 @@ function JoinServerMenu::addServerEntry(%this) horizSizing = "width"; vertSizing = "height"; internalName = "button"; + class = "JoinServerEntryButton"; }; new GuiTextCtrl() { position = "0 0"; - extent = "730 20"; + extent = "700 20"; profile = "MenuSubHeaderText"; tooltipProfile = "GuiToolTipProfile"; internalName = "serverNameTxt"; }; new GuiTextCtrl() { position = $optionsEntryPad SPC 17; - extent = "730 18"; + extent = "700 18"; profile = "GuiMLTextProfile"; tooltipProfile = "GuiToolTipProfile"; internalName = "serverDetailsTxt"; }; new GuiTextCtrl() { - position = "730 0"; - extent = "50 40"; + position = "700 0"; + extent = "70 40"; horizSizing = "left"; vertSizing = "center"; - profile = "MenuSubHeaderText"; + profile = "MenuSubHeaderCenteredText"; tooltipProfile = "GuiToolTipProfile"; internalName = "pingTxt"; }; new GuiTextCtrl() { - position = "780 0"; - extent = "120 40"; + position = "770 0"; + extent = "130 40"; horizSizing = "left"; vertSizing = "center"; - profile = "MenuSubHeaderText"; + profile = "MenuSubHeaderCenteredText"; tooltipProfile = "GuiToolTipProfile"; internalName = "playerCountTxt"; }; @@ -198,6 +206,16 @@ function JoinServerMenu::addServerEntry(%this) return %entry; } +function JoinServerEntryButton::onHighlighted(%this, %highlighted) +{ + %container = %this.getParent(); + + %container-->serverNameTxt.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText; + %container-->serverDetailsTxt.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile; + %container-->pingTxt.profile = %highlighted ? MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText; + %container-->playerCountTxt.profile = %highlighted ? MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText; +} + function JoinServerMenu::addStatusEntry(%this) { %entry = new GuiContainer() { @@ -221,6 +239,13 @@ function JoinServerMenu::addStatusEntry(%this) return %entry; } +function JoinServerStatusEntry::updateProgress(%this) +{ + %this-->statusText.text = %this-->statusText.text @ "."; //ellipses....... + + %this.schedule(500, "updateProgress"); +} + function JoinServerList::syncGui(%this) { %this.callOnChildren("setHighlighted", false); @@ -238,9 +263,10 @@ function JoinServerList::syncGui(%this) %device = "keyboard"; JoinServerBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut")); - JoinServerJoinBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIActivateSelected")); + JoinServerJoinBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu::join();")); JoinServerQLanBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.queryLan();")); JoinServerQServerBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.query();")); - //JoinServerJoinBtn.setActive($selectedLevelAsset !$= ""); + + JoinServerJoinBtn.setActive(JoinServerList.getCount() > 0); } \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/mainMenu.gui b/Templates/BaseGame/game/data/UI/guis/mainMenu.gui index 6ccf77732..3fc39662b 100644 --- a/Templates/BaseGame/game/data/UI/guis/mainMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/mainMenu.gui @@ -1,11 +1,10 @@ //--- OBJECT WRITE BEGIN --- -$guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) { - BitmapAsset = "UI:backgrounddark_image"; +$guiContent = new GuiControl(MainMenuGui) { extent = "1280 720"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiDefaultProfile"; + profile = "GuiMenuBackgroundProfile"; category = "BaseUI"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; @@ -77,7 +76,6 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) { vertSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; new GuiButtonCtrl(MainMenuSinglePlayerBtn) { text = "Single Player"; diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui b/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui index 522e7044a..f7a6daa70 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui @@ -1,17 +1,14 @@ //--- OBJECT WRITE BEGIN --- -$guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) { - BitmapAsset = "UI:backgrounddark_image"; +$guiContent = new GuiControl(OptionsMenu) { extent = "1280 720"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiDefaultProfile"; + profile = "GuiMenuBackgroundProfile"; category = "BaseUI"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; - canSaveDynamicFields = "1"; - optionsCategories = "17237"; - unappliedChanges = "17238"; + canSaveDynamicFields = "0"; new GuiInputCtrl(OptionsMenuInputHandler) { ignoreMouseEvents = "1"; @@ -24,83 +21,77 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) { tooltipProfile = "GuiToolTipProfile"; }; new GuiControl(OptionsMenuCategoryContainer) { - position = "332 80"; - extent = "617 49"; + position = "0 60"; + extent = "1280 49"; horizSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; - new GuiIconButtonCtrl(OptionsMenuCatPrevBtn) { - BitmapAsset = "UI:Keyboard_Black_Q_image"; - iconLocation = "Center"; - makeIconSquare = "1"; - textLocation = "Center"; - bitmapMargin = "30"; - position = "1 4"; - extent = "50 40"; - vertSizing = "center"; - profile = "GuiMenuButtonProfile"; - command = "OptionsMenuCategoryPrev();"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuInputButton"; - }; - new GuiIconButtonCtrl(OptionsMenuCatNextBtn) { - BitmapAsset = "UI:Keyboard_Black_E_image"; - iconLocation = "Center"; - makeIconSquare = "1"; - bitmapMargin = "30"; - position = "568 4"; - extent = "50 40"; - horizSizing = "left"; - vertSizing = "center"; - profile = "GuiMenuButtonProfile"; - command = "OptionsMenuCategoryNext();"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuInputButton"; - }; new GuiStackControl(OptionsMenuCategoryList) { stackingType = "Horizontal"; padding = "10"; dynamicSize = "0"; - position = "137 3"; - extent = "358 40"; + position = "430 0"; + extent = "420 40"; horizSizing = "center"; vertSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; new GuiButtonCtrl() { text = "Video"; - extent = "100 40"; + extent = "120 40"; profile = "GuiMenuButtonProfile"; - command = "populateDisplaySettingsList();"; + command = "OptionsMenu.openOptionsCategory(\"Video\");"; tooltipProfile = "GuiToolTipProfile"; }; new GuiButtonCtrl() { text = "Audio"; - position = "110 0"; - extent = "100 40"; + position = "130 0"; + extent = "120 40"; profile = "GuiMenuButtonProfile"; - command = "populateAudioSettingsList();"; + command = "OptionsMenu.openOptionsCategory(\"Audio\");"; tooltipProfile = "GuiToolTipProfile"; }; new GuiButtonCtrl() { text = "Controls"; - position = "220 0"; - extent = "140 40"; + position = "260 0"; + extent = "160 40"; profile = "GuiMenuButtonProfile"; - command = "populateKeyboardMouseSettingsList();"; + command = "OptionsMenu.openOptionsCategory(\"Controls\");"; tooltipProfile = "GuiToolTipProfile"; }; }; + + new GuiControl(OptionsMenuNavButtonOverlay) { + extent = "1281 40"; + horizSizing = "width"; + vertSizing = "height"; + profile = GuiNonModalDefaultProfile; + + new GuiBitmapCtrl(OptionsMenuPrevNavIcon) { + BitmapAsset = "UI:Keyboard_Black_Q_image"; + position = "0 10"; + extent = "40 40"; + profile = GuiNonModalDefaultProfile; + vertSizing = "top"; + }; + + new GuiBitmapCtrl(OptionsMenuNextNavIcon) { + BitmapAsset = "UI:Keyboard_Black_E_image"; + position = "0 10"; + extent = "40 40"; + profile = GuiNonModalDefaultProfile; + vertSizing = "top"; + }; + }; }; new GuiScrollCtrl(OptionsMenuSettingsScroll) { hScrollBar = "alwaysOff"; vScrollBar = "dynamic"; - position = "331 128"; - extent = "618 555"; + position = "240 110"; + extent = "800 573"; horizSizing = "center"; vertSizing = "height"; profile = "GuiMenuScrollProfile"; @@ -109,258 +100,40 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) { new GuiStackControl(VideoSettingsList) { padding = "5"; changeChildSizeToFit = "0"; - position = "1 1"; - extent = "603 200"; + position = "0 1"; + extent = "800 200"; horizSizing = "width"; vertSizing = "height"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; - - new GuiTextCtrl() { - text = "Basic"; - extent = "500 30"; - profile = "MenuHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiContainer() { - position = "0 35"; - extent = "603 40"; - horizSizing = "width"; - profile = "GuiMenuDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "OptionsListEntry"; - - new GuiButtonCtrl() { - extent = "603 40"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "Button"; - class = "optionsMenuButton"; - }; - new GuiTextCtrl() { - text = "Graphical Quality"; - position = "10 -1"; - extent = "250 20"; - profile = "MenuSubHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "OptionName"; - }; - new GuiTextCtrl() { - text = "Controls the general graphical quality"; - position = "10 17"; - extent = "178 18"; - profile = "GuiMLTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "OptionDescription"; - }; - new GuiContainer() { - position = "353 0"; - extent = "250 40"; - horizSizing = "left"; - vertSizing = "height"; - profile = "GuiModelessDialogProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "valuesContainer"; - - new GuiButtonCtrl() { - text = "<"; - position = "160 0"; - extent = "20 40"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiTextCtrl() { - text = "High"; - position = "180 0"; - extent = "50 40"; - vertSizing = "center"; - profile = "GuiMenuTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "optionValue"; - }; - new GuiButtonCtrl() { - text = ">"; - position = "230 0"; - extent = "20 40"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - }; - }; - new GuiContainer() { - position = "0 80"; - extent = "603 40"; - horizSizing = "width"; - profile = "GuiMenuDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "OptionsListEntry"; - - new GuiButtonCtrl() { - extent = "603 40"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "Button"; - class = "optionsMenuButton"; - }; - new GuiTextCtrl() { - text = "Lighting Quality"; - position = "10 -1"; - extent = "250 20"; - profile = "MenuSubHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "OptionName"; - }; - new GuiTextCtrl() { - text = "Controls the lighting and shadows quality"; - position = "10 17"; - extent = "198 18"; - profile = "GuiMLTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "OptionDescription"; - }; - new GuiContainer() { - position = "353 0"; - extent = "250 40"; - horizSizing = "left"; - vertSizing = "height"; - profile = "GuiModelessDialogProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "valuesContainer"; - - new GuiButtonCtrl() { - text = "<"; - position = "160 0"; - extent = "20 40"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiTextCtrl() { - text = "High"; - position = "180 0"; - extent = "50 40"; - vertSizing = "center"; - profile = "GuiMenuTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "optionValue"; - }; - new GuiButtonCtrl() { - text = ">"; - position = "230 0"; - extent = "20 40"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - }; - }; - new GuiTextCtrl() { - text = "Advanced"; - position = "0 125"; - extent = "500 30"; - profile = "MenuHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiContainer() { - position = "0 160"; - extent = "603 40"; - horizSizing = "width"; - profile = "GuiMenuDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "OptionsListEntry"; - - new GuiButtonCtrl() { - extent = "603 40"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "Button"; - class = "optionsMenuButton"; - }; - new GuiTextCtrl() { - text = "Mesh Detail"; - position = "10 -1"; - extent = "250 20"; - profile = "MenuSubHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "OptionName"; - }; - new GuiTextCtrl() { - text = "Controls the max quality of mesh objects"; - position = "10 17"; - extent = "195 18"; - profile = "GuiMLTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "OptionDescription"; - }; - new GuiContainer() { - position = "353 0"; - extent = "250 40"; - horizSizing = "left"; - vertSizing = "height"; - profile = "GuiModelessDialogProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "valuesContainer"; - - new GuiButtonCtrl() { - text = "<"; - position = "160 0"; - extent = "20 40"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiTextCtrl() { - text = "High"; - position = "180 0"; - extent = "50 40"; - vertSizing = "center"; - profile = "GuiMenuTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "optionValue"; - }; - new GuiButtonCtrl() { - text = ">"; - position = "230 0"; - extent = "20 40"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - }; - }; }; new GuiStackControl(AudioSettingsList) { padding = "5"; changeChildSizeToFit = "0"; - position = "1 1"; - extent = "603 245"; + position = "0 1"; + extent = "800 200"; horizSizing = "width"; vertSizing = "height"; profile = "GuiDefaultProfile"; visible = "0"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; hidden = "1"; }; new GuiStackControl(ControlSettingsList) { padding = "5"; changeChildSizeToFit = "0"; - position = "1 1"; - extent = "603 245"; + position = "0 1"; + extent = "800 200"; horizSizing = "width"; vertSizing = "height"; profile = "GuiDefaultProfile"; visible = "0"; tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; hidden = "1"; }; }; new GuiPanel(OptionMenuTitlePanel) { - extent = "1281 80"; + extent = "1281 60"; horizSizing = "width"; profile = "GuiMenuPanelProfile"; tooltipProfile = "GuiToolTipProfile"; @@ -381,21 +154,6 @@ $guiContent = new GuiChunkedBitmapCtrl(OptionsMenu) { profile = "GuiMenuPanelProfile"; tooltipProfile = "GuiToolTipProfile"; - new GuiIconButtonCtrl(OptionsMenuApplyBtn) { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Center"; - text = "Apply"; - position = "1115 0"; - extent = "140 40"; - horizSizing = "left"; - vertSizing = "center"; - profile = "GuiMenuButtonProfile"; - command = "OptionsMenu.applySettings();"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuInputButton"; - }; new GuiIconButtonCtrl(OptionsMenuBackBtn) { BitmapAsset = "UI:Keyboard_Black_Escape_image"; sizeIconToButton = "1"; diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript index 9e52e4154..d2c3fbb8c 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript @@ -50,6 +50,10 @@ $yesNoList = "No\tYes"; $onOffList = "Off\tOn"; $optionsEntryPad = 10; +$OptionsMenuCategories[0] = "Video"; +$OptionsMenuCategories[1] = "Audio"; +$OptionsMenuCategories[2] = "Controls"; + function OptionsMenu::onAdd(%this) { if(!isObject(%this.optionsCategories)) @@ -69,6 +73,8 @@ function OptionsMenu::onAdd(%this) function OptionsMenu::onWake(%this) { + %this.unappliedChanges.empty(); + VideoSettingsList.clear(); for(%i=0; %i < VideoSettingsGroup.getCount(); %i++) @@ -111,13 +117,9 @@ function OptionsMenu::onWake(%this) } } - $MenuList = VideoSettingsList; + //establish the cached prefs values here - //Find our first non-group entry - while($MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry && $MenuList.listPosition < $MenuList.getCount()) - { - $MenuList.listPosition += 1; - } + %this.openOptionsCategory("Video"); } if(!isObject( OptionsMenuActionMap ) ) @@ -136,8 +138,14 @@ if(!isObject( OptionsMenuActionMap ) ) OptionsMenuActionMap.bind( gamepad, lpov, OptionMenuPrevSetting ); OptionsMenuActionMap.bind( gamepad, lpov, OptionMenuNextSetting ); - //OptionsMenuActionMap.bind( keyboard, Enter, BaseUIActivateSelected ); - //OptionsMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected ); + OptionsMenuActionMap.bind( keyboard, q, OptionsMenuPrevCategory ); + OptionsMenuActionMap.bind( gamepad, btn_l, OptionsMenuPrevCategory ); + + OptionsMenuActionMap.bind( keyboard, e, OptionsMenuNextCategory ); + OptionsMenuActionMap.bind( gamepad, btn_r, OptionsMenuNextCategory ); + + OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset ); + OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset ); } function VideoSettingsList::syncGui(%this) @@ -149,6 +157,108 @@ function VideoSettingsList::syncGui(%this) %btn-->button.setHighlighted(true); } +function AudioSettingsList::syncGui(%this) +{ + +} + +function ControlSettingsList::syncGui(%this) +{ + +} + +function OptionsMenu::openOptionsCategory(%this, %categoryName) +{ + VideoSettingsList.setVisible(%categoryName $= "Video"); + AudioSettingsList.setVisible(%categoryName $= "Audio"); + ControlSettingsList.setVisible(%categoryName $= "Controls"); + + if(%categoryName $= "Video") + { + $MenuList = VideoSettingsList; + //Find our first non-group entry + while($MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry && $MenuList.listPosition < $MenuList.getCount()) + { + $MenuList.listPosition += 1; + } + + %this.currentCatgeoryIdx = 0; + } + else if(%categoryName $= "Audio") + { + $MenuList = AudioSettingsList; + + %this.currentCatgeoryIdx = 1; + } + else if(%categoryName $= "Controls") + { + $MenuList = ControlSettingsList; + + %this.currentCatgeoryIdx = 2; + } + + $MenuList.syncGui(); + %this.syncGui(); +} + +function OptionsMenu::syncGui(%this) +{ + OptionsMenuCategoryList.callOnChildren("setHighlighted", false); + + %btn = OptionsMenuCategoryList.getObject(%this.currentCatgeoryIdx); + %btn.setHighlighted(true); + + %buttonPosX = %btn.position.x + OptionsMenuCategoryList.position.x; + + OptionsMenuPrevNavIcon.position.x = %buttonPosX - 5; + OptionsMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 35; + + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + OptionsMenuBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut")); + OptionsMenuResetBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuReset")); + + OptionsMenuPrevNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuPrevCategory")); + OptionsMenuNextNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuNextCategory")); +} + +function OptionsMenuPrevCategory(%val) +{ + if(%val) + { + %currentIdx = OptionsMenu.currentMenuIdx; + OptionsMenu.currentMenuIdx -= 1; + + OptionsMenu.currentMenuIdx = mClamp(OptionsMenu.currentMenuIdx, 0, 3); + + if(%currentIdx == OptionsMenu.currentMenuIdx) + return; + + %newCategory = $OptionsMenuCategories[OptionsMenu.currentMenuIdx]; + OptionsMenu.openOptionsCategory(%newCategory); + } +} + +function OptionsMenuNextCategory(%val) +{ + if(%val) + { + %currentIdx = OptionsMenu.currentMenuIdx; + OptionsMenu.currentMenuIdx += 1; + + OptionsMenu.currentMenuIdx = mClamp(OptionsMenu.currentMenuIdx, 0, 3); + + if(%currentIdx == OptionsMenu.currentMenuIdx) + return; + + %newCategory = $OptionsMenuCategories[OptionsMenu.currentMenuIdx]; + OptionsMenu.openOptionsCategory(%newCategory); + } +} + // function OptionMenuNavigatePrev(%val) { @@ -199,11 +309,11 @@ function OptionMenuPrevSetting(%val) %optionObject = %option.optionsObject; %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex); - echo("Changed option: " @ %optionObject.optionName @ " to level: " @ %currentOptionLevel.displayName); - /*$MenuList.listPosition -= 1; - - if($MenuList.listPosition < 0) - $MenuList.listPosition = 0;*/ + %option.currentOptionIndex = mClamp(%option.currentOptionIndex-1, 0, %optionObject.getCount()-1); + + %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + + echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName); $MenuList.syncGUI(); } @@ -211,15 +321,15 @@ function OptionMenuPrevSetting(%val) function OptionMenuNextSetting(%val) { %option = $MenuList.getObject($MenuList.listPosition); + echo("Option: " @ %option.className); %optionObject = %option.optionsObject; %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex); - echo("Changed option: " @ %optionObject.optionName @ " to level: " @ %currentOptionLevel.displayName); + %option.currentOptionIndex = mClamp(%option.currentOptionIndex+1, 0, %optionObject.getCount()-1); - /*$MenuList.listPosition += 1; - - if($MenuList.listPosition >= $MenuList.getCount()) - $MenuList.listPosition = $MenuList.getCount()-1;*/ + %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + + echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName); $MenuList.syncGUI(); } @@ -228,52 +338,7 @@ function OptionMenuStickChangeSetting(%val) { } -// -function OptionsMenu::onOpen(%this) -{ - OptionsMenuCategoryList.clear(); - - for(%i=0; %i < %this.optionsCategories.count(); %i++) - { - %catName = %this.optionsCategories.getKey(%i); - %callback = %this.optionsCategories.getValue(%i); - - %newCatButton = new GuiButtonCtrl() { - text = %catName; - 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 = %callback; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - - OptionsMenuCategoryList.add(%newCatButton); - } - - %this.unappliedChanges.empty(); - $pref::Video::displayDeviceId = ""; - - OptionsMenuCategoryList.setAsActiveMenuList(); - - $activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();"); - $activeMenuButtonContainer-->button2.disable(); - $activeMenuButtonContainer-->button3.set("", "Space", "Apply", "OptionsMenu.apply();"); - $activeMenuButtonContainer-->button4.set("btn_a", "", "Select", "OptionsMenu.select();"); - $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();"); -} - + //We capitalize on the canClose test here, because we want to prompt for unapplied options changes before //backing out. So when the UINavigation test canClose, we can see if we have unapplied settings and prompt //that via the message box and return false. @@ -1382,7 +1447,7 @@ function addOptionEntry(%optionObj) %entry = new GuiContainer() { position = "0 0"; - extent = "500 40"; + extent = "800 40"; profile = GuiMenuDefaultProfile; tooltipProfile = "GuiToolTipProfile"; horizSizing = "width"; @@ -1394,7 +1459,7 @@ function addOptionEntry(%optionObj) new GuiButtonCtrl() { profile = GuiMenuButtonProfile; position = "0 0"; - extent = "500 40"; + extent = "800 40"; horizSizing = "width"; vertSizing = "height"; internalName = "button"; @@ -1404,7 +1469,7 @@ function addOptionEntry(%optionObj) new GuiTextCtrl() { text = %optionObj.OptionName; position = $optionsEntryPad SPC -1; - extent = "250 20"; + extent = "400 20"; profile = "MenuSubHeaderText"; tooltipProfile = "GuiToolTipProfile"; internalName = "optionName"; @@ -1412,15 +1477,15 @@ function addOptionEntry(%optionObj) new GuiTextCtrl() { text = %optionObj.Description; position = $optionsEntryPad SPC 17; - extent = "250 18"; + extent = "400 18"; profile = "GuiMLTextProfile"; tooltipProfile = "GuiToolTipProfile"; internalName = "optionDescription"; }; new GuiContainer() { - position = "250 0"; - extent = "250 40"; + position = "400 0"; + extent = "400 40"; profile = GuiModelessDialogProfile; tooltipProfile = "GuiToolTipProfile"; horizSizing = "left"; @@ -1428,15 +1493,16 @@ function addOptionEntry(%optionObj) internalName = "valuesContainer"; new GuiButtonCtrl() { - position = "160 0"; + position = "310 0"; extent = "20 40"; text = "<"; profile = GuiMenuButtonProfile; + internalName = "prevValButton"; }; new GuiTextCtrl() { text = %qualityLevel.displayName; - position = "180 0"; + position = "330 0"; extent = "50 40"; profile = "GuiMenuTextProfile"; tooltipProfile = "GuiToolTipProfile"; @@ -1446,10 +1512,11 @@ function addOptionEntry(%optionObj) }; new GuiButtonCtrl() { - position = "230 0"; + position = "380 0"; extent = "20 40"; text = ">"; profile = GuiMenuButtonProfile; + internalName = "nextValButton"; }; }; }; diff --git a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript index d8d2304d3..93e65e7dd 100644 --- a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript @@ -49,7 +49,7 @@ singleton GuiControlProfile(GamepadButtonTextRight : GamepadButtonTextLeft) singleton GuiControlProfile(MenuHeaderText) { fontType = "Arial Bold"; - fontSize = 30; + fontSize = 36; fontColor = $TextHighEmphasisColor; justify = "left"; modal = false; @@ -63,7 +63,7 @@ singleton GuiControlProfile(MenuHeaderTextHighlighted : MenuHeaderText) singleton GuiControlProfile(MenuHeaderTextCenter) { fontType = "Arial Bold"; - fontSize = 30; + fontSize = 32; fontColor = $TextHighEmphasisColor; justify = "center"; }; @@ -71,7 +71,7 @@ singleton GuiControlProfile(MenuHeaderTextCenter) singleton GuiControlProfile(MenuSubHeaderText) { fontType = "Arial Bold"; - fontSize = 20; + fontSize = 24; fontColor = $TextMediumEmphasisColor; justify = "left"; modal = false; @@ -87,6 +87,11 @@ singleton GuiControlProfile(MenuSubHeaderCenteredText : MenuSubHeaderText) justify = "center"; }; +singleton GuiControlProfile(MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText) +{ + fontColor = $TextMediumEmphasisColorHL; +}; + singleton GuiControlProfile(MenuMLSubHeaderText) { fontType = "Arial Bold"; @@ -113,7 +118,7 @@ singleton GuiControlProfile( GuiMenuButtonProfile ) { opaque = true; border = false; - fontSize = 18; + fontSize = 24; fontType = "Arial Bold"; fontColor = "200 200 200 255"; fontColorHL = "0 0 0 255"; @@ -304,6 +309,7 @@ singleton GuiControlProfile( GuiMLTextProfile ) fontColorSEL = $TextMediumEmphasisColor; fontColorNA = $TextDisabledColor; + fontSize = 20; fontColorLink = "100 100 100"; fontColorLinkHL = $TextMediumEmphasisColor; autoSizeWidth = true;