فهرست منبع

- 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 سال پیش
والد
کامیت
833d17ccfc

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

@@ -120,7 +120,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
          };
       };
       new GuiBitmapCtrl(LevelPreviewBitmap) {
-         BitmapAsset = "testMaps:EmptyLevel_preview_image";
+         BitmapAsset = "";
          position = "448 0";
          extent = "440 440";
          horizSizing = "left";
@@ -128,7 +128,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
          tooltipProfile = "GuiToolTipProfile";
       };
       new GuiTextCtrl(LevelNameText) {
-         text = "EmptyLevel";
+         text = "";
          position = "448 445";
          extent = "440 20";
          horizSizing = "left";
@@ -324,7 +324,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
          horizSizing = "left";
          vertSizing = "center";
          profile = "GuiMenuButtonProfile";
-         command = "OptionsMenu.applySettings();";
+         command = "ChooseLevelBegin(1);";
          tooltipProfile = "GuiToolTipProfile";
       };
       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.listPosition = 0;
+   
    // Also add the new level mission as defined in the world editor settings
    // if we are choosing a level to launch in the editor.
    if ( %this.launchInEditor )
@@ -115,7 +117,10 @@ function ChooseLevelMenu::onWake(%this)
    else
       ChooseLevelTitleText.setText("CREATE SERVER");
       
-   %this.openMenu(0);
+   ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer;
+   ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer;
+      
+   %this.schedule(32, openMenu, 0);
 }
 
 if(!isObject( ChooseLevelActionMap ) )
@@ -144,7 +149,7 @@ function ChooseLevelMenu::syncGUI(%this)
    %btn.setHighlighted(true);
    
    %buttonPosX = %btn.position.x + ChooseLevelMenuTabList.position.x;
-
+   
    ChooseLevelMenuPrevNavIcon.position.x = %buttonPosX;
    ChooseLevelMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
      
@@ -154,9 +159,6 @@ function ChooseLevelMenu::syncGUI(%this)
    
    ChooseLevelMenuPrevNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuPrevMenu"));
    ChooseLevelMenuNextNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuNextMenu"));
-   
-   ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer;
-   ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer;
 }
 
 function LevelPreviewArray::syncGUI(%this)
@@ -169,7 +171,7 @@ function LevelPreviewArray::syncGUI(%this)
 
 function ChooseLevelMenuPrevMenu(%val)
 {
-   if(%val)
+   if(%val && $pref::HostMultiPlayer)
    {
       %currentIdx = ChooseLevelMenu.currentMenuIdx;
       ChooseLevelMenu.currentMenuIdx -= 1;
@@ -185,7 +187,7 @@ function ChooseLevelMenuPrevMenu(%val)
 
 function ChooseLevelMenuNextMenu(%val)
 {
-   if(%val)
+   if(%val && $pref::HostMultiPlayer)
    {
       %currentIdx = ChooseLevelMenu.currentMenuIdx;
       ChooseLevelMenu.currentMenuIdx += 1;

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

@@ -33,6 +33,7 @@ function GameMenu::onWake(%this)
          text = %buttonText;
          class = "GameMenuButton";
          command = "GameMenu.openGameMenu(\"" @ %buttonText @ "\");";
+         canSave = false;
       };
       
       %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-->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-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers;
       
@@ -165,6 +165,7 @@ function JoinServerMenu::addServerEntry(%this)
       horizSizing = "width";
       vertSizing = "bottom";
       class = "JoinServerServerEntry";
+      canSave = false;
       
       new GuiButtonCtrl() {
          profile = GuiMenuButtonProfile;

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

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