Browse Source

- Cleaned up elements in ChooseLevelMenu and ensured onscreen button had correct command
- Ensured there's always a level selected by default on the chooseLevelMenu
- Added a small delay to try and ensure the level/server config tab key hints align properly
- Added logic so you can't swap to server config page on chooseLevelMenu if in single player mode
- Added server description to server details line on JoinServerMenu
- Ensured programmatically added elements aren't saved out if GUIs are edited
- Fixed back-out prompt in OptionsMenu properly backs out so it doesn't break menu nav

Areloch 1 year ago
parent
commit
833d17ccfc

+ 3 - 3
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui

@@ -120,7 +120,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
          };
          };
       };
       };
       new GuiBitmapCtrl(LevelPreviewBitmap) {
       new GuiBitmapCtrl(LevelPreviewBitmap) {
-         BitmapAsset = "testMaps:EmptyLevel_preview_image";
+         BitmapAsset = "";
          position = "448 0";
          position = "448 0";
          extent = "440 440";
          extent = "440 440";
          horizSizing = "left";
          horizSizing = "left";
@@ -128,7 +128,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
       };
       };
       new GuiTextCtrl(LevelNameText) {
       new GuiTextCtrl(LevelNameText) {
-         text = "EmptyLevel";
+         text = "";
          position = "448 445";
          position = "448 445";
          extent = "440 20";
          extent = "440 20";
          horizSizing = "left";
          horizSizing = "left";
@@ -324,7 +324,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
          horizSizing = "left";
          horizSizing = "left";
          vertSizing = "center";
          vertSizing = "center";
          profile = "GuiMenuButtonProfile";
          profile = "GuiMenuButtonProfile";
-         command = "OptionsMenu.applySettings();";
+         command = "ChooseLevelBegin(1);";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
       };
       };
       new GuiIconButtonCtrl(ChooseLevelBackBtn) {
       new GuiIconButtonCtrl(ChooseLevelBackBtn) {

+ 9 - 7
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript

@@ -103,6 +103,8 @@ function ChooseLevelMenu::onWake(%this)
       LevelPreviewArray.add(%preview);
       LevelPreviewArray.add(%preview);
    }
    }
    
    
+   LevelPreviewArray.listPosition = 0;
+   
    // Also add the new level mission as defined in the world editor settings
    // Also add the new level mission as defined in the world editor settings
    // if we are choosing a level to launch in the editor.
    // if we are choosing a level to launch in the editor.
    if ( %this.launchInEditor )
    if ( %this.launchInEditor )
@@ -115,7 +117,10 @@ function ChooseLevelMenu::onWake(%this)
    else
    else
       ChooseLevelTitleText.setText("CREATE SERVER");
       ChooseLevelTitleText.setText("CREATE SERVER");
       
       
-   %this.openMenu(0);
+   ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer;
+   ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer;
+      
+   %this.schedule(32, openMenu, 0);
 }
 }
 
 
 if(!isObject( ChooseLevelActionMap ) )
 if(!isObject( ChooseLevelActionMap ) )
@@ -144,7 +149,7 @@ function ChooseLevelMenu::syncGUI(%this)
    %btn.setHighlighted(true);
    %btn.setHighlighted(true);
    
    
    %buttonPosX = %btn.position.x + ChooseLevelMenuTabList.position.x;
    %buttonPosX = %btn.position.x + ChooseLevelMenuTabList.position.x;
-
+   
    ChooseLevelMenuPrevNavIcon.position.x = %buttonPosX;
    ChooseLevelMenuPrevNavIcon.position.x = %buttonPosX;
    ChooseLevelMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
    ChooseLevelMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
      
      
@@ -154,9 +159,6 @@ function ChooseLevelMenu::syncGUI(%this)
    
    
    ChooseLevelMenuPrevNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuPrevMenu"));
    ChooseLevelMenuPrevNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuPrevMenu"));
    ChooseLevelMenuNextNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuNextMenu"));
    ChooseLevelMenuNextNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuNextMenu"));
-   
-   ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer;
-   ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer;
 }
 }
 
 
 function LevelPreviewArray::syncGUI(%this)
 function LevelPreviewArray::syncGUI(%this)
@@ -169,7 +171,7 @@ function LevelPreviewArray::syncGUI(%this)
 
 
 function ChooseLevelMenuPrevMenu(%val)
 function ChooseLevelMenuPrevMenu(%val)
 {
 {
-   if(%val)
+   if(%val && $pref::HostMultiPlayer)
    {
    {
       %currentIdx = ChooseLevelMenu.currentMenuIdx;
       %currentIdx = ChooseLevelMenu.currentMenuIdx;
       ChooseLevelMenu.currentMenuIdx -= 1;
       ChooseLevelMenu.currentMenuIdx -= 1;
@@ -185,7 +187,7 @@ function ChooseLevelMenuPrevMenu(%val)
 
 
 function ChooseLevelMenuNextMenu(%val)
 function ChooseLevelMenuNextMenu(%val)
 {
 {
-   if(%val)
+   if(%val && $pref::HostMultiPlayer)
    {
    {
       %currentIdx = ChooseLevelMenu.currentMenuIdx;
       %currentIdx = ChooseLevelMenu.currentMenuIdx;
       ChooseLevelMenu.currentMenuIdx += 1;
       ChooseLevelMenu.currentMenuIdx += 1;

+ 1 - 0
Templates/BaseGame/game/data/UI/guis/GameMenu.tscript

@@ -33,6 +33,7 @@ function GameMenu::onWake(%this)
          text = %buttonText;
          text = %buttonText;
          class = "GameMenuButton";
          class = "GameMenuButton";
          command = "GameMenu.openGameMenu(\"" @ %buttonText @ "\");";
          command = "GameMenu.openGameMenu(\"" @ %buttonText @ "\");";
+         canSave = false;
       };
       };
       
       
       %stackWidth += %textWidth + 40;
       %stackWidth += %textWidth + 40;

+ 2 - 1
Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript

@@ -116,7 +116,7 @@ function JoinServerMenu::update(%this)
       
       
       %serverEntry = %this.addServerEntry();
       %serverEntry = %this.addServerEntry();
       %serverEntry-->serverNameTxt.text = $ServerInfo::Name;
       %serverEntry-->serverNameTxt.text = $ServerInfo::Name;
-      %serverEntry-->serverDetailsTxt.text = $ServerInfo::MissionName @ " | v" @ $ServerInfo::Version @ " | " @ $ServerInfo::MissionType;
+      %serverEntry-->serverDetailsTxt.text = $ServerInfo::MissionName @ " | v" @ $ServerInfo::Version @ " | " @ $ServerInfo::MissionType @ " | " @ $ServerInfo::Info;
       %serverEntry-->pingTxt.text = $ServerInfo::Ping @ " ms";
       %serverEntry-->pingTxt.text = $ServerInfo::Ping @ " ms";
       %serverEntry-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers;
       %serverEntry-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers;
       
       
@@ -165,6 +165,7 @@ function JoinServerMenu::addServerEntry(%this)
       horizSizing = "width";
       horizSizing = "width";
       vertSizing = "bottom";
       vertSizing = "bottom";
       class = "JoinServerServerEntry";
       class = "JoinServerServerEntry";
+      canSave = false;
       
       
       new GuiButtonCtrl() {
       new GuiButtonCtrl() {
          profile = GuiMenuButtonProfile;
          profile = GuiMenuButtonProfile;

+ 6 - 7
Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript

@@ -688,7 +688,7 @@ function tryCloseOptionsMenu(%val)
    if(%unappliedVideoChanges || %unappliedAudioChanges)
    if(%unappliedVideoChanges || %unappliedAudioChanges)
    {
    {
       MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", 
       MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", 
-                        "OptionsMenu.applyChangedOptions();", "Canvas.popDialog(OptionsMenu);", 
+                        "OptionsMenu.applyChangedOptions(); BaseUIBackOut(1);", "BaseUIBackOut(1);", 
                         "Apply", "Discard");
                         "Apply", "Discard");
    }
    }
    else
    else
@@ -732,9 +732,7 @@ function OptionsMenu::applyChangedOptions(%this)
    //Finally, write our prefs to file
    //Finally, write our prefs to file
    %prefPath = getPrefpath();
    %prefPath = getPrefpath();
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
-   
-   BaseUIBackOut(1);
-   
+
    if($optionsChangeRequiresRestart)
    if($optionsChangeRequiresRestart)
       MessageBoxOK("Restart Required", "Some of your changes require the game to be restarted.");
       MessageBoxOK("Restart Required", "Some of your changes require the game to be restarted.");
 }
 }
@@ -767,6 +765,7 @@ function addOptionGroup(%displayName)
       extent = "500 45";
       extent = "500 45";
       profile = "MenuHeaderText";
       profile = "MenuHeaderText";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
+      canSave = false;
    };   
    };   
    
    
    return %group;
    return %group;
@@ -822,7 +821,7 @@ function addOptionEntry(%optionObj)
       optionsObject = %optionObj;
       optionsObject = %optionObj;
       currentOptionIndex = %qualityLevelIndex;
       currentOptionIndex = %qualityLevelIndex;
       selectionID = OptionsMenu.optsListCount;
       selectionID = OptionsMenu.optsListCount;
-      canSave = "0";
+      canSave = false;
       
       
       new GuiButtonCtrl() {
       new GuiButtonCtrl() {
          profile = GuiMenuButtonProfile;
          profile = GuiMenuButtonProfile;
@@ -918,7 +917,7 @@ function addOptionSlider(%optionName, %optionDesc, %prefName, %sliderMin, %slide
       horizSizing = "width";
       horizSizing = "width";
       vertSizing = "bottom";
       vertSizing = "bottom";
       class = "OptionsListSliderEntry";
       class = "OptionsListSliderEntry";
-      canSave = "0";
+      canSave = false;
       
       
       new GuiButtonCtrl() {
       new GuiButtonCtrl() {
          profile = GuiMenuButtonProfile;
          profile = GuiMenuButtonProfile;
@@ -1012,11 +1011,11 @@ function addActionMapEntry(%actionMap, %device, %keyMap, %index, %description)
       horizSizing = "width";
       horizSizing = "width";
       vertSizing = "bottom";
       vertSizing = "bottom";
       class = "OptionsKeybindEntry";
       class = "OptionsKeybindEntry";
-      canSave = "0";
       actionMap = %actionMap;
       actionMap = %actionMap;
       device = %device;
       device = %device;
       keymap = %keyMap;
       keymap = %keyMap;
       remapIndex = %index;
       remapIndex = %index;
+      canSave = false;
       
       
       new GuiButtonCtrl() {
       new GuiButtonCtrl() {
          profile = GuiMenuButtonProfile;
          profile = GuiMenuButtonProfile;