浏览代码

Implements a more standardized way to format usual UI pages by having the ability to utilize the UINavigation namespace for page stack navigation
Also fixes behavior handling of menu input buttons not refreshing reliably
Adds ability to define a control on a MenuList to act as a highlighter over the currently selected control
Cleaned up BaseUI pages to use UINavigation which reduced a lot of duplication of elements and code

JeffR 3 年之前
父节点
当前提交
41add628ad
共有 20 个文件被更改,包括 801 次插入1207 次删除
  1. 6 0
      Templates/BaseGame/game/core/gui/scripts/profiles.tscript
  2. 6 0
      Templates/BaseGame/game/data/UI/UI.tscript
  3. 5 0
      Templates/BaseGame/game/data/UI/guis/MainMenuButtons.asset.taml
  4. 78 0
      Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui
  5. 67 0
      Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript
  6. 4 212
      Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.gui
  7. 16 17
      Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript
  8. 3 403
      Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui
  9. 9 28
      Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript
  10. 55 214
      Templates/BaseGame/game/data/UI/guis/mainMenu.gui
  11. 11 57
      Templates/BaseGame/game/data/UI/guis/mainMenu.tscript
  12. 74 69
      Templates/BaseGame/game/data/UI/guis/optionsMenu.gui
  13. 54 63
      Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript
  14. 87 102
      Templates/BaseGame/game/data/UI/guis/pauseMenu.gui
  15. 10 17
      Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript
  16. 二进制
      Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Left.png
  17. 二进制
      Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Middle.png
  18. 二进制
      Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Right.png
  19. 96 25
      Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript
  20. 220 0
      Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript

+ 6 - 0
Templates/BaseGame/game/core/gui/scripts/profiles.tscript

@@ -81,6 +81,12 @@ new GuiControlProfile (GuiDefaultProfile)
    cursorColor = "0 0 0 255";
 };
 
+if(!isObject(GuiNonModalDefaultProfile))
+new GuiControlProfile (GuiNonModalDefaultProfile : GuiDefaultProfile)
+{
+   modal = false;
+};
+
 if(!isObject(GuiToolTipProfile))
 new GuiControlProfile (GuiToolTipProfile)
 {

+ 6 - 0
Templates/BaseGame/game/data/UI/UI.tscript

@@ -35,12 +35,18 @@ function UI::initClient(%this)
    //Profiles
    %this.queueExec("./scripts/profiles");
    
+   //Navigation Utility Scripts
+   %this.queueExec("./scripts/menuNavigation");
+   
    //Now gui files
    %this.queueExec("./scripts/menuInputHandling");
    
    %this.queueExec("./guis/mainMenu");
    %this.queueExec("./guis/mainMenu.gui");
    
+   %this.queueExec("./guis/mainMenuButtons");
+   %this.queueExec("./guis/mainMenuButtons.gui");
+   
    %this.queueExec("./guis/chooseLevelDlg");
    %this.queueExec("./guis/chooseLevelDlg.gui");
    

+ 5 - 0
Templates/BaseGame/game/data/UI/guis/MainMenuButtons.asset.taml

@@ -0,0 +1,5 @@
+<GUIAsset
+    AssetName="MainMenuButtons"
+    scriptFile="@assetFile=MainMenuButtons.tscript"
+    GUIFile="@assetFile=MainMenuButtons.gui"
+    VersionId="1"/>

+ 78 - 0
Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui

@@ -0,0 +1,78 @@
+//--- OBJECT WRITE BEGIN ---
+$guiContent = new GuiControl(MainMenuButtons) {
+   extent = "1024 768";
+   profile = "GuiNonModalDefaultProfile";
+   tooltipProfile = "GuiToolTipProfile";
+   isContainer = "1";
+   canSaveDynamicFields = "1";
+      originalAssetName = "MainMenuButtons";
+
+   new GuiStackControl(MainMenuButtonList) {
+      padding = "15";
+      dynamicSize = "0";
+      position = "312 145";
+      extent = "400 477";
+      horizSizing = "center";
+      vertSizing = "center";
+      profile = "GuiDefaultProfile";
+      tooltipProfile = "GuiToolTipProfile";
+      superClass = "MenuList";
+
+      new GuiButtonCtrl(MainMenuSinglePlayerBtn) {
+         text = "Single Player";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "openSinglePlayerMenu();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+      new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
+         text = "Create Server";
+         position = "0 70";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "openMultiPlayerMenu();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+      new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
+         text = "Join Server";
+         position = "0 140";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "openJoinServerMenu();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+      new GuiButtonCtrl(MainMenuOptionBtn) {
+         text = "Options";
+         position = "0 210";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "openOptionsMenu();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+      new GuiButtonCtrl(MainMenuWorldEditBtn) {
+         text = "Open World Editor";
+         position = "0 280";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "openWorldEditorBtn();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+      new GuiButtonCtrl(MainMenuGuiEditBtn) {
+         text = "Open GUI Editor";
+         position = "0 350";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "openGUIEditorBtn();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+      new GuiButtonCtrl(MainMenuExitBtn) {
+         text = "Exit";
+         position = "0 420";
+         extent = "400 55";
+         profile = "GuiMenuButtonProfile";
+         command = "quit();";
+         tooltipProfile = "GuiToolTipProfile";
+      };
+   };
+};
+//--- OBJECT WRITE END ---

+ 67 - 0
Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript

@@ -0,0 +1,67 @@
+function MainMenuButtons::onWake(%this)
+{
+}
+
+function MainMenuButtons::onSleep(%this)
+{
+}
+
+//Optional, as the check defaults to true, but here as an example case
+function MainMenuButtonList::canOpen(%this)
+{
+   return true;
+}
+
+function MainMenuButtonList::onOpen(%this)
+{
+   MainMenuButtonList.setAsActiveMenuList();
+   
+   $activeMenuButtonContainer-->button1.disable();
+   $activeMenuButtonContainer-->button2.disable();
+   $activeMenuButtonContainer-->button3.disable();
+   $activeMenuButtonContainer-->button4.set("btn_a", "Return", "Go", "MainMenuButtonList.activate();");
+   $activeMenuButtonContainer-->button5.disable();
+}
+
+//Optional, as the check defaults to true, but here as an example case
+function MainMenuButtonList::canClose(%this)
+{
+   return true;
+}
+
+
+function MainMenuButtonList::onClose(%this)
+{
+}
+
+function openSinglePlayerMenu()
+{
+   $pref::HostMultiPlayer=false;
+   MainMenuGui.pushPage(ChooseLevelDlg);
+}
+
+function openMultiPlayerMenu()
+{
+   $pref::HostMultiPlayer=true;
+   MainMenuGui.pushPage(ChooseLevelDlg);
+}
+
+function openJoinServerMenu()
+{
+   MainMenuGui.pushPage(JoinServerMenu);
+}
+
+function openOptionsMenu()
+{
+   MainMenuGui.pushPage(OptionsMenu);
+}
+
+function openWorldEditorBtn()
+{
+   fastLoadWorldEdit(1);
+}
+
+function openGUIEditorBtn()
+{
+   fastLoadGUIEdit(1);
+}

+ 4 - 212
Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.gui

@@ -1,17 +1,12 @@
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(ChooseLevelDlg) {
-   position = "0 0";
    extent = "1024 768";
    minExtent = "8 8";
    horizSizing = "width";
    vertSizing = "height";
-   profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
+   profile = "GuiNonModalDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
-   canSave = "1";
    canSaveDynamicFields = "1";
       Enabled = "1";
       launchInEditor = "0";
@@ -20,294 +15,91 @@ $guiContent = new GuiControl(ChooseLevelDlg) {
    new GuiControl(ChooseLevelWindow) {
       position = "48 56";
       extent = "928 655";
-      minExtent = "8 2";
       horizSizing = "center";
       vertSizing = "center";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
-      canSave = "1";
-      canSaveDynamicFields = "0";
 
       new GuiBitmapBarCtrl() {
-         percent = "100";
-         vertical = "0";
-         flipClip = "0";
-         bitmapAsset = "UI:panel_image";
-         color = "255 255 255 255";
-         position = "0 0";
+         BitmapAsset = "UI:panel_image";
          extent = "927 40";
-         minExtent = "8 2";
          horizSizing = "width";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl(LevelSelectTitle) {
          text = "SINGLE PLAYER";
-         maxLength = "1024";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "22 10";
          extent = "307 28";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiBitmapBarCtrl() {
-         percent = "100";
-         vertical = "0";
-         flipClip = "0";
-         bitmapAsset = "UI:panel_low_image";
-         color = "255 255 255 255";
+         BitmapAsset = "UI:panel_low_image";
          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 GuiBitmapCtrl() {
-         bitmapAsset = "UI:no_preview_image";
-         color = "255 255 255 255";
-         wrap = "0";
+         BitmapAsset = "Core_Rendering:missingTexture_image";
          position = "513 71";
          extent = "400 300";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
          internalName = "CurrentPreview";
-         canSave = "1";
          canSaveDynamicFields = "1";
             Enabled = "1";
       };
       new GuiTextCtrl() {
          text = "Example Level";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "514 375";
          extent = "398 27";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          internalName = "LevelName";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "Description:";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "522 410";
          extent = "91 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuSubHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          internalName = "LevelDescriptionLabel";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiMLTextCtrl() {
-         lineSpacing = "2";
-         allowColorChars = "0";
-         maxChars = "-1";
          text = "This is placeholder text";
-         useURLMouseCursor = "0";
          position = "522 436";
          extent = "391 14";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
          internalName = "LevelDescription";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiScrollCtrl() {
-         willFirstRespond = "1";
          hScrollBar = "dynamic";
          vScrollBar = "dynamic";
-         lockHorizScroll = "0";
-         lockVertScroll = "0";
-         constantThumbHeight = "0";
-         childMargin = "0 0";
-         mouseWheelScrollSpeed = "-1";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "0 40";
          extent = "450 580";
-         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(LevelList) {
-            debugRender = "0";
             callbackOnInputs = "1";
             position = "1 1";
             extent = "450 90";
-            minExtent = "8 2";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "DefaultListMenuProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
-            isContainer = "0";
             class = "UIMenuButtonList";
-            canSave = "1";
-            canSaveDynamicFields = "0";
-         };
-      };
    };
-   new GuiControl(ChooseLevelButtonHolder) {
-      position = "189 711";
-      extent = "646 40";
-      minExtent = "8 2";
-      horizSizing = "center";
-      vertSizing = "top";
-      profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
-      tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "1";
-      class = "MenuInputButtonContainer";
-      canSave = "1";
-      canSaveDynamicFields = "0";
-
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         iconBitmap = "./";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Go";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "363 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "MainMenuButtonList.activateRow();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "goButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-      };
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         iconBitmap = "./";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Back";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "507 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "MainMenuButtonList.activateRow();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "backButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
    };
 };

+ 16 - 17
Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript

@@ -26,6 +26,12 @@ function ChooseLevelDlg::onWake( %this )
    if(!isObject(LevelListEntries))
       new ArrayObject(LevelListEntries){};
       
+   if(!isObject(ChooseLevelAssetQuery))
+      new AssetQuery(ChooseLevelAssetQuery);
+}
+
+function ChooseLevelDlg::onOpen(%this)
+{
    LevelList.clearRows();
    LevelListEntries.empty();
    
@@ -33,10 +39,10 @@ function ChooseLevelDlg::onWake( %this )
    ChooseLevelWindow->LevelDescriptionLabel.visible = false;
    ChooseLevelWindow->LevelDescription.visible = false;
    
-   %assetQuery = new AssetQuery();
-   AssetDatabase.findAssetType(%assetQuery, "LevelAsset");
+   ChooseLevelAssetQuery.clear();
+   AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset");
       
-   %count = %assetQuery.getCount();
+   %count = ChooseLevelAssetQuery.getCount();
    
    if(%count == 0 && !IsDirectory("tools"))
    {
@@ -44,13 +50,13 @@ function ChooseLevelDlg::onWake( %this )
       MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", 
          "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();");
          
-      %assetQuery.delete();
+      ChooseLevelAssetQuery.delete();
       return;
    }
    
    for(%i=0; %i < %count; %i++)
 	{
-	   %assetId = %assetQuery.getAsset(%i);
+	   %assetId = ChooseLevelAssetQuery.getAsset(%i);
 	   
 	   if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
 	      continue;
@@ -97,12 +103,12 @@ function ChooseLevelDlg::onWake( %this )
       LevelSelectTitle.setText("CREATE SERVER");
    
    ChooseLevelButtonHolder.setActive();
-}
 
-function ChooseLevelButtonHolder::onWake(%this)
-{
-   %this-->goButton.set("btn_a", "Return", "Start Level", "ChooseLevelDlg.beginLevel();");
-   %this-->backButton.set("btn_b", "Escape", "Back", "ChooseLevelDlg.backOut();");
+   $activeMenuButtonContainer-->button1.disable();
+   $activeMenuButtonContainer-->button2.disable();
+   $activeMenuButtonContainer-->button3.disable();
+   $activeMenuButtonContainer-->button4.set("btn_a", "Return", "Start Level", "ChooseLevelDlg.beginLevel();");
+   $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
 }
 
 function ChooseLevelDlg::onSleep( %this )
@@ -202,10 +208,3 @@ function ChooseLevelDlg::beginLevel(%this)
       StartGame(); 
    }
 }
-
-function ChooseLevelDlg::backOut(%this)
-{
-   Canvas.popDialog(ChooseLevelDlg);
-   if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod("onReturnTo"))    
-      ChooseLevelDlg.returnGui.onReturnTo();  
-}

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

@@ -1,559 +1,159 @@
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(JoinServerMenu) {
-   position = "0 0";
    extent = "1024 768";
-   minExtent = "8 2";
-   horizSizing = "right";
-   vertSizing = "bottom";
-   profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
+   profile = "GuiNonModalDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
-   canSave = "1";
-   canSaveDynamicFields = "1";
-      returnGui = "MainMenuGui";
-
-   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";
-      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";
-      minExtent = "8 2";
       horizSizing = "center";
       vertSizing = "center";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
-      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";
-         minExtent = "8 2";
          horizSizing = "width";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "JOIN SERVER";
-         maxLength = "1024";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "22 10";
          extent = "207 28";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiBitmapBarCtrl() {
-         percent = "100";
-         vertical = "0";
-         flipClip = "0";
          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 GuiTextCtrl(JS_status) {
          text = "No servers found.";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "392 47";
          extent = "148 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuSubHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "Players";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "269 67";
          extent = "36 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "Version";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "335 67";
          extent = "38 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "Game";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "412 67";
          extent = "28 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "Ping";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "212 67";
          extent = "20 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiTextCtrl() {
          text = "Server Name";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "12 67";
          extent = "63 18";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       new GuiScrollCtrl() {
-         willFirstRespond = "1";
          hScrollBar = "dynamic";
          vScrollBar = "dynamic";
-         lockHorizScroll = "0";
-         lockVertScroll = "0";
-         constantThumbHeight = "0";
-         childMargin = "0 0";
-         mouseWheelScrollSpeed = "-1";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "19 98";
          extent = "890 501";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuScrollProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
 
          new 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 16";
-            minExtent = "16 16";
             horizSizing = "center";
             vertSizing = "center";
             profile = "GuiDefaultProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
-            isContainer = "1";
-            canSave = "1";
-            canSaveDynamicFields = "0";
-            class = "MenuList";
+            superClass = "MenuList";
          };
       };
       new GuiControl(JS_queryStatus) {
          position = "16 615";
          extent = "900 35";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          visible = "0";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "1";
          hidden = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
 
          new GuiProgressCtrl(JS_statusBar) {
-            maxLength = "1024";
-            margin = "0 0 0 0";
-            padding = "0 0 0 0";
-            anchorTop = "1";
-            anchorBottom = "0";
-            anchorLeft = "1";
-            anchorRight = "0";
             position = "84 0";
             extent = "695 35";
             minExtent = "8 8";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "GuiProgressProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
             isContainer = "0";
-            canSave = "1";
-            canSaveDynamicFields = "0";
          };
          new GuiButtonCtrl(JS_cancelQuery) {
             text = "Cancel!";
-            groupNum = "-1";
-            buttonType = "PushButton";
-            useMouseEvents = "0";
-            position = "0 0";
             extent = "84 35";
             minExtent = "8 8";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "GuiMenuButtonProfile";
-            visible = "1";
-            active = "1";
             command = "JoinServerDlg.cancel();";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
-            isContainer = "0";
-            canSave = "1";
-            canSaveDynamicFields = "0";
          };
          new GuiTextCtrl(JS_statusText) {
             text = "Querying master server";
             maxLength = "255";
-            margin = "0 0 0 0";
-            padding = "0 0 0 0";
-            anchorTop = "1";
-            anchorBottom = "0";
-            anchorLeft = "1";
-            anchorRight = "0";
             position = "84 0";
             extent = "695 35";
             minExtent = "8 8";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "GuiMenuButtonProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
             isContainer = "0";
-            canSave = "1";
-            canSaveDynamicFields = "0";
-         };
-      };
    };
-   new GuiControl(JoinServerButtonHolder) {
-      position = "116 711";
-      extent = "791 40";
-      minExtent = "8 2";
-      horizSizing = "center";
-      vertSizing = "top";
-      profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
-      tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "1";
-      class = "MenuInputButtonContainer";
-      canSave = "1";
-      canSaveDynamicFields = "0";
-
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         BitmapAsset = "UI:Keyboard_Black_Return_image";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Join";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "507 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "0";
-         command = "JoinServerMenu.join();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "joinButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-      };
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         BitmapAsset = "UI:Keyboard_Black_Escape_image";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Back";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "651 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "JoinServerMenu.backOut();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "backButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-      };
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         BitmapAsset = "UI:Keyboard_Black_Q_image";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Query LAN";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "0 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "JoinServerMenu.queryLan();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "queryLANButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-      };
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         BitmapAsset = "UI:Keyboard_Black_E_image";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Query Online";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "144 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "JoinServerMenu.query();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "queryInternetButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-      };
-      new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         BitmapAsset = "UI:Keyboard_Black_R_image";
-         iconLocation = "Left";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Refresh";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "325 0";
-         extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
-         profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "JoinServerMenu.refresh();";
-         tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "refreshButton";
-         class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
    };
 };

+ 9 - 28
Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript

@@ -1,26 +1,17 @@
 
 function JoinServerMenu::onWake(%this)
 {
-   JoinServerButtonHolder.setActive();
-   
-   JoinServerList.setAsActiveMenuList();
-   
-   JoinServerMenuInputHandler.setFirstResponder();
 }   
 
-function JoinServerButtonHolder::onWake(%this)
+function JoinServerMenu::onOpen(%this)
 {
-   %this-->joinButton.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
-   %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 Online", "JoinServerMenu.query();");
-}
+   JoinServerList.setAsActiveMenuList();
 
-function JoinServerMenuInputHandler::onInputEvent(%this, %device, %action, %state)
-{
-   if(%state)
-      $activeMenuButtonContainer.processInputs(%device, %action);
+   $activeMenuButtonContainer-->button1.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
+   $activeMenuButtonContainer-->button2.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
+   $activeMenuButtonContainer-->button3.set("btn_x", "E", "Query Online", "JoinServerMenu.query();");
+   $activeMenuButtonContainer-->button4.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
+   $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "cancelServerQuery(); " @ %this @ ".navigation.popPage();");
 }
 
 //----------------------------------------
@@ -79,7 +70,7 @@ function JoinServerMenu::join(%this)
 function JoinServerMenu::refresh(%this)
 {
    cancelServerQuery();
-   %index= JS_serverList.getSelectedId();
+   %index= JoinServerList.getActiveRow();
 
    // The server info index is stored in the row along with the
    // rest of displayed info.
@@ -93,16 +84,6 @@ function JoinServerMenu::refreshSelectedServer( %this )
    querySingleServer( $JoinGameAddress, 0 );
 }
 
-//----------------------------------------
-function JoinServerMenu::backOut(%this)
-{
-   cancelServerQuery();
-   
-   Canvas.popDialog(JoinServerMenu);
-   if(isObject(JoinServerMenu.returnGui) && JoinServerMenu.returnGui.isMethod("onReturnTo"))    
-      JoinServerMenu.returnGui.onReturnTo();  
-}
-
 //----------------------------------------
 function JoinServerMenu::update(%this)
 {
@@ -124,7 +105,7 @@ function JoinServerMenu::update(%this)
       JoinServerList.add(%serverBtn);
    }
 
-   JoinServerButtonHolder-->joinButton.setActive(JoinServerList.getCount() > 0);
+   $activeMenuButtonContainer-->button4.setActive(JoinServerList.getCount() > 0);
 } 
 
 //----------------------------------------

+ 55 - 214
Templates/BaseGame/game/data/UI/guis/mainMenu.gui

@@ -1,41 +1,23 @@
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
    BitmapAsset = "UI:backgrounddark_image";
-   useVariable = "0";
-   tile = "0";
-   position = "0 0";
    extent = "1024 768";
    minExtent = "8 8";
    horizSizing = "width";
    vertSizing = "height";
    profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
-   canSave = "1";
-   canSaveDynamicFields = "1";
-      Enabled = "1";
-      isDecoy = "0";
-      navigationIndex = "-1";
+   superClass = "UINavigation";
+   canSaveDynamicFields = "0";
 
    new GuiBitmapCtrl(MainMenuAppLogo) {
       BitmapAsset = "UI:Torque_3D_logo_alt_image";
-      color = "255 255 255 255";
-      wrap = "0";
       position = "550 30";
       extent = "443 139";
-      minExtent = "8 2";
       horizSizing = "left";
-      vertSizing = "bottom";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "0";
-      canSave = "1";
       canSaveDynamicFields = "1";
          autoFitExtents = "0";
          bitmapMode = "Stretched";
@@ -45,239 +27,98 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
          useModifiers = "0";
          useStates = "1";
    };
-   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";
+   new GuiControl(MainMenuButtonHolder) {
+      position = "143 711";
+      extent = "736 40";
       horizSizing = "center";
-      vertSizing = "center";
+      vertSizing = "top";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
-      canSave = "1";
-      canSaveDynamicFields = "0";
-      class = "MenuList";
+      class = "MenuInputButtonContainer";
 
-      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";
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         text = "Go";
+         position = "11 0";
+         extent = "140 40";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "openOptionsMenu();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
+         internalName = "button1";
+         class = "MenuInputButton";
       };
-      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";
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         text = "Go";
+         position = "155 0";
+         extent = "140 40";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "openWorldEditorBtn();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
+         internalName = "button2";
+         class = "MenuInputButton";
       };
-      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";
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         text = "Go";
+         position = "299 0";
+         extent = "140 40";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "openGUIEditorBtn();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
+         internalName = "button3";
+         class = "MenuInputButton";
       };
-      new GuiButtonCtrl(MainMenuExitBtn) {
-         text = "Exit";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "0 420";
-         extent = "400 55";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         text = "Go";
+         position = "443 0";
+         extent = "140 40";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "quit();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-      };
+         internalName = "button4";
+         class = "MenuInputButton";
    };
-   new GuiControl(MainMenuButtonHolder) {
-      position = "189 711";
-      extent = "646 40";
-      minExtent = "8 2";
-      horizSizing = "center";
-      vertSizing = "top";
-      profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
-      tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "1";
-      class = "MenuInputButtonContainer";
-      canSave = "1";
-      canSaveDynamicFields = "0";
-
       new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
          BitmapAsset = "UI:Keyboard_Black_Return_image";
-         iconLocation = "Left";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
          text = "Go";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "507 0";
+         position = "587 0";
          extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "MainMenuButtonList.activateRow();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "goButton";
+         internalName = "button5";
          class = "MenuInputButton";
-         canSave = "1";
-         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";
+      class = "MenuInputHandler";
    };
 };
 //--- OBJECT WRITE END ---

+ 11 - 57
Templates/BaseGame/game/data/UI/guis/mainMenu.tscript

@@ -5,66 +5,20 @@ function MainMenuGui::onAdd(%this)
 
 function MainMenuGui::onWake(%this)
 {
-   MainMenuButtonList.setAsActiveMenuList();
    MainMenuButtonHolder.setActive();
    MainMenuInputHandler.setFirstResponder();
-}
-
-function MainMenuGui::onSleep(%this)
-{
-   MainMenuButtonHolder.hidden = true;
+   
+   %this.setRootPage(MainMenuButtonList);
+   
+   %this.resizePages = true;
 }
 
 function MainMenuButtonHolder::onWake(%this)
 {
-   %this-->goButton.set("btn_a", "Return", "Go", "MainMenuButtonList.activate();");
-}
-
-function openSinglePlayerMenu()
-{
-   $pref::HostMultiPlayer=false;
-   Canvas.pushDialog(ChooseLevelDlg);
-   ChooseLevelDlg.returnGui = MainMenuGui; 
-   MainMenuButtonList.hidden = true; 
-   MainMenuButtonHolder.hidden = true;
-}
-
-function openMultiPlayerMenu()
-{
-   $pref::HostMultiPlayer=true;
-   Canvas.pushDialog(ChooseLevelDlg);
-   ChooseLevelDlg.returnGui = MainMenuGui; 
-   MainMenuButtonList.hidden = true; 
-}
-
-function openJoinServerMenu()
-{
-   Canvas.pushDialog(JoinServerMenu);
-   JoinServerMenu.returnGui = MainMenuGui; 
-   MainMenuButtonList.hidden = true; 
-}
-
-function openOptionsMenu()
-{
-   Canvas.pushDialog(OptionsMenu);
-   OptionsMenu.returnGui = MainMenuGui; 
-   MainMenuButtonList.hidden = true; 
-}
-
-function openWorldEditorBtn()
-{
-   fastLoadWorldEdit(1);
-}
-
-function openGUIEditorBtn()
-{
-   fastLoadGUIEdit(1);
-}
-
-function MainMenuGui::onReturnTo(%this)
-{
-   MainMenuButtonList.hidden = false;
-   MainMenuButtonList.setFirstResponder();
-   MainMenuButtonHolder.setActive();
-   MainMenuButtonList.setAsActiveMenuList();
-}
+   //clean slate
+   %this-->button1.disable();
+   %this-->button2.disable();
+   %this-->button3.disable();
+   %this-->button4.disable();
+   %this-->button5.disable();
+}

+ 74 - 69
Templates/BaseGame/game/data/UI/guis/optionsMenu.gui

@@ -1,12 +1,14 @@
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(OptionsMenu) {
    extent = "1024 768";
-   profile = "GuiDefaultProfile";
+   profile = "GuiNonModalDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
    isContainer = "1";
+   horizSizing = "width";
+   vertSizing = "height";
    canSaveDynamicFields = "0";
 
-   new GuiControl() {
+   new GuiControl(OptionsMenuContainer) {
       position = "48 56";
       extent = "928 655";
       horizSizing = "aspectCenter";
@@ -33,7 +35,7 @@ $guiContent = new GuiControl(OptionsMenu) {
       new GuiTextCtrl() {
          text = "OPTIONS";
          position = "22 7";
-         extent = "120 28";
+         extent = "220 28";
          profile = "MenuHeaderText";
          tooltipProfile = "GuiToolTipProfile";
       };
@@ -77,7 +79,7 @@ $guiContent = new GuiControl(OptionsMenu) {
                vertSizing = "height";
                profile = "GuiDefaultProfile";
                tooltipProfile = "GuiToolTipProfile";
-               class = "MenuList";
+               superClass = "MenuList";
 
                new GuiButtonCtrl() {
                   text = "Display";
@@ -118,6 +120,14 @@ $guiContent = new GuiControl(OptionsMenu) {
                   command = "populateGamepadSettingsList();";
                   tooltipProfile = "GuiToolTipProfile";
                };
+               new GuiButtonCtrl() {
+                  text = "Example Options";
+                  position = "0 225";
+                  extent = "248 35";
+                  profile = "GuiMenuButtonProfile";
+                  command = "testExampleOptions();";
+                  tooltipProfile = "GuiToolTipProfile";
+               };
             };
          };
          new GuiPanel() {
@@ -141,81 +151,76 @@ $guiContent = new GuiControl(OptionsMenu) {
                   padding = "5";
                   changeChildSizeToFit = "0";
                   position = "1 1";
-                  extent = "661 30";
+                  extent = "661 170";
                   horizSizing = "width";
                   vertSizing = "height";
                   profile = "GuiDefaultProfile";
                   tooltipProfile = "GuiToolTipProfile";
-                  class = "MenuList";
+                  superClass = "MenuList";
+                  new GuiGameSettingsCtrl() {
+                     PreviousBitmapAsset = "UI:previousOption_n_image";
+                     NextBitmapAsset = "UI:nextOption_n_image";
+                     columnSplit = "198";
+                     useMouseEvents = "1";
+                     extent = "661 30";
+                     horizSizing = "width";
+                     profile = "GuiMenuButtonProfile";
+                     tooltipProfile = "GuiToolTipProfile";
+                     class = "MenuOptionsButton";
+                  };
+                  new GuiGameSettingsCtrl() {
+                     PreviousBitmapAsset = "UI:previousOption_n_image";
+                     NextBitmapAsset = "UI:nextOption_n_image";
+                     columnSplit = "198";
+                     useMouseEvents = "1";
+                     position = "0 35";
+                     extent = "661 30";
+                     horizSizing = "width";
+                     profile = "GuiMenuButtonProfile";
+                     tooltipProfile = "GuiToolTipProfile";
+                     class = "MenuOptionsButton";
+                  };
+                  new GuiGameSettingsCtrl() {
+                     PreviousBitmapAsset = "UI:previousOption_n_image";
+                     NextBitmapAsset = "UI:nextOption_n_image";
+                     columnSplit = "198";
+                     useMouseEvents = "1";
+                     position = "0 70";
+                     extent = "661 30";
+                     horizSizing = "width";
+                     profile = "GuiMenuButtonProfile";
+                     tooltipProfile = "GuiToolTipProfile";
+                     class = "MenuOptionsButton";
+                  };
+                  new GuiGameSettingsCtrl() {
+                     PreviousBitmapAsset = "UI:previousOption_n_image";
+                     NextBitmapAsset = "UI:nextOption_n_image";
+                     columnSplit = "198";
+                     useMouseEvents = "1";
+                     position = "0 105";
+                     extent = "661 30";
+                     horizSizing = "width";
+                     profile = "GuiMenuButtonProfile";
+                     tooltipProfile = "GuiToolTipProfile";
+                     class = "MenuOptionsButton";
+                  };
+                  new GuiGameSettingsCtrl() {
+                     PreviousBitmapAsset = "UI:previousOption_n_image";
+                     NextBitmapAsset = "UI:nextOption_n_image";
+                     columnSplit = "198";
+                     useMouseEvents = "1";
+                     position = "0 140";
+                     extent = "661 30";
+                     horizSizing = "width";
+                     profile = "GuiMenuButtonProfile";
+                     tooltipProfile = "GuiToolTipProfile";
+                     class = "MenuOptionsButton";
                };
             };
          };
       };
    };
-   new GuiControl(OptionsButtonHolder) {
-      position = "116 711";
-      extent = "791 40";
-      horizSizing = "center";
-      vertSizing = "top";
-      profile = "GuiDefaultProfile";
-      tooltipProfile = "GuiToolTipProfile";
-      isContainer = "1";
-      class = "MenuInputButtonContainer";
 
-      new GuiIconButtonCtrl() {
-         BitmapAsset = "UI:Keyboard_Black_R_image";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         text = "Reset";
-         position = "173 0";
-         extent = "140 40";
-         profile = "GuiMenuButtonProfile";
-         command = "OptionsMenu.resetToDefaults();";
-         tooltipProfile = "GuiToolTipProfile";
-         internalName = "resetButton";
-         class = "MenuInputButton";
-      };
-      new GuiIconButtonCtrl(OptionsMenuSelectButton) {
-         BitmapAsset = "UI:Keyboard_Black_Return_image";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         text = "Select";
-         position = "507 0";
-         extent = "140 40";
-         profile = "GuiMenuButtonProfile";
-         command = "";
-         tooltipProfile = "GuiToolTipProfile";
-         internalName = "SelectButton";
-         class = "MenuInputButton";
-      };
-      new GuiIconButtonCtrl() {
-         BitmapAsset = "UI:Keyboard_Black_Escape_image";
-         sizeIconToButton = "1";
-         makeIconSquare = "1";
-         textLocation = "Right";
-         text = "Back";
-         position = "651 0";
-         extent = "140 40";
-         profile = "GuiMenuButtonProfile";
-         command = "OptionsMenu.backOut();";
-         tooltipProfile = "GuiToolTipProfile";
-         internalName = "backButton";
-         class = "MenuInputButton";
-      };
-   };
-   new GuiInputCtrl(OptionsMenuInputHandler) {
-      sendAxisEvents = "1";
-      sendBreakEvents = "1";
-      ignoreMouseEvents = "1";
-      position = "-50 0";
-      extent = "10 10";
-      horizSizing = "left";
-      vertSizing = "top";
-      profile = "GuiInputCtrlProfile";
-      tooltipProfile = "GuiToolTipProfile";
-      class = "MenuInputHandler";
    };
 };
 //--- OBJECT WRITE END ---

+ 54 - 63
Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript

@@ -72,16 +72,7 @@ function OptionsMenu::onAdd(%this)
    callOnModules("populateOptionsMenuCategories", "Game");
 }
 
-function OptionsMenuSettingsList::onAdd(%this)
-{
-}
-
-function OptionsMenuSettingsList::getOptionsList(%this, %index)
-{
-     
-}
-
-function OptionsMenu::onWake(%this)
+function OptionsMenu::onOpen(%this)
 {
    OptionsMenuCategoryList.clear(); 
    
@@ -116,22 +107,48 @@ function OptionsMenu::onWake(%this)
    
    %this.unappliedChanges.empty();
    
-   MainMenuButtonList.hidden = true;
+   OptionsMenuCategoryList.setAsActiveMenuList();
+   
+   $activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
+   $activeMenuButtonContainer-->button1.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();");
+}
    
+function OptionsMenu::canClose(%this)
+{
+   if(OptionsMenuSettingsList.isActiveMenuList())
+   {
    OptionsMenuCategoryList.setAsActiveMenuList();
+      %this.updateSelectButton();
+      return false;
+   }
+   else
+   {
+      if(%this.unappliedChanges.count() != 0)
+      {
+         MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", 
+                        "OptionsMenu.apply(); MainMenuGUI.popPage();", "%this.unappliedChanges.empty(); " @ %this @ ".navigation.popPage();", 
+                        "Apply", "Discard");
+         return false;
+      }
+   }
    
-   OptionsButtonHolder.setActive();
+   return true;
+}
+
+function OptionsMenu::onClose(%this)
+{
    
-   OptionsMenuInputHandler.setFirstResponder();
 }
 
-function OptionsButtonHolder::onWake(%this)
+function OptionsMenuSettingsList::onAdd(%this)
 {
-   %this-->resetButton.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
-   %this-->selectButton.set("btn_a", "Return", "Select", "OptionsMenu.select();", true);
-   %this-->backButton.set("btn_b", "Escape", "Back", "OptionsMenu.backOut();");
+}
    
-   //OptionsMenuCategoryList.getObject(0).performClick();
+function OptionsMenuSettingsList::getOptionsList(%this, %index)
+{
 }
 
 function OptionsMenu::select(%this)
@@ -281,9 +298,6 @@ function OptionsMenu::apply(%this)
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    
    OptionsMenu.unappliedChanges.empty();
-   
-   //Now we can back out of the options menu
-   OptionsMenu.doOptionsMenuBackOut();
 }
 
 function OptionsMenu::resetToDefaults(%this)
@@ -346,7 +360,9 @@ function populateDisplaySettingsList()
    
    OptionsMenu.currentCategory = "Display";
    
+   if(isObject(OptionName))
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    
    %apiList = "";
@@ -433,7 +449,9 @@ function populateGraphicsSettingsList()
    
    OptionsMenu.currentCategory = "Graphics";
    
+   if(isObject(OptionName))
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    
    %yesNoList = "No\tYes";
@@ -598,7 +616,9 @@ function populateAudioSettingsList()
    
    OptionsMenu.currentCategory = "Audio";
    
+   if(isObject(OptionName))
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    
    %buffer = sfxGetAvailableDevices();
@@ -691,7 +711,9 @@ function populateKeyboardMouseSettingsList()
    
    OptionsMenu.currentCategory = "Keyboard & Mouse";
    
+   if(isObject(OptionName))
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    
    $remapListDevice = "keyboard";
@@ -706,7 +728,9 @@ function populateGamepadSettingsList()
    
    OptionsMenu.currentCategory = "Gamepad";
    
+   if(isObject(OptionName))
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    
    $remapListDevice = "gamepad";
@@ -723,48 +747,6 @@ function OptionsMenuList::activateRow(%this)
    OptionsMenuSettingsList.setFirstResponder();
 }
 
-function OptionsMenu::backOut(%this)
-{
-   if(OptionsMenuSettingsList.isActiveMenuList())
-   {
-      OptionsMenuCategoryList.setAsActiveMenuList();
-      %this.updateSelectButton();
-   }
-   else
-   {
-      if(%this.unappliedChanges.count() != 0)
-      {
-         MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", "OptionsMenu.apply();", "OptionsMenu.doOptionsMenuBackOut();", "Apply", "Discard");
-      }
-      else
-      {
-         %this.doOptionsMenuBackOut();
-      }
-   }
-}
-
-function OptionsMenu::doOptionsMenuBackOut(%this)
-{
-   //save the settings and then back out
-   if(OptionsMain.hidden == false)
-   {
-      //we're not in a specific menu, so we're actually exiting
-      Canvas.popDialog(OptionsMenu);
-
-      if(isObject(OptionsMenu.returnGui) && OptionsMenu.returnGui.isMethod("onReturnTo"))
-         OptionsMenu.returnGui.onReturnTo();
-   }
-   else
-   {
-      OptionsMain.hidden = false;
-      ControlsMenu.hidden = true;
-      GraphicsMenu.hidden = true;
-      CameraMenu.hidden = true;
-      AudioMenu.hidden = true;
-      ScreenBrightnessMenu.hidden = true;
-   }
-}
-
 function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
 {
    %option = %this.getObject(%row);
@@ -955,16 +937,25 @@ function getDisplayDeviceName()
 //
 function MenuOptionsButton::onMouseEnter(%this)
 {
+   if(isObject(OptionName))
    OptionName.setText(%this.getLabel());
+   if(isObject(OptionDescription))
    OptionDescription.setText(%this.getToolTip());
 }
 
 function MenuOptionsButton::onMouseLeave(%this)
 {
+   if(isObject(OptionName))
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
 }
 
+function MenuOptionsButton::onHighlighted(%this, %state)
+{
+   MenuListButton::onHighlighted(%this, %state);
+}
+
 function MenuOptionsButton::onChange(%this)
 {
    %optionMode = %this.getMode();

+ 87 - 102
Templates/BaseGame/game/data/UI/guis/pauseMenu.gui

@@ -1,178 +1,163 @@
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(PauseMenu) {
-   position = "0 0";
    extent = "1024 768";
-   minExtent = "8 2";
-   horizSizing = "right";
-   vertSizing = "bottom";
    profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
-   canSave = "1";
+   superClass = "UINavigation";
    canSaveDynamicFields = "1";
-      tamlReader = "19772";
-      tile = "0";
-      useVariable = "0";
 
    new GuiChunkedBitmapCtrl(PauseMenuBG) {
-      bitmapAsset = "UI:hudfill_image";
-      useVariable = "0";
-      tile = "0";
-      position = "0 0";
+      BitmapAsset = "UI:hudfill_image";
       extent = "1024 768";
-      minExtent = "8 2";
       horizSizing = "width";
       vertSizing = "height";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
-      canSave = "1";
       canSaveDynamicFields = "1";
    };
    new GuiControl() {
       position = "162 125";
       extent = "700 518";
-      minExtent = "8 2";
       horizSizing = "center";
       vertSizing = "center";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
-      canSave = "1";
-      canSaveDynamicFields = "0";
       
       new GuiStackControl(PauseMenuList) {
-         stackingType = "Vertical";
-         horizStacking = "Left to Right";
-         vertStacking = "Top to Bottom";
          padding = "15";
          dynamicSize = "0";
-         dynamicNonStackExtent = "0";
-         dynamicPos = "0";
-         changeChildSizeToFit = "1";
-         changeChildPosition = "1";
-         position = "0 0";
          extent = "700 320";
-         minExtent = "16 16";
          horizSizing = "center";
          vertSizing = "center";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
-         class = "MenuList";
+         superClass = "MenuList";
+
+         new GuiButtonCtrl() {
+            text = "Options";
+            extent = "700 55";
+            profile = "GuiMenuButtonProfile";
+            command = "openPauseMenuOptions();";
+            tooltipProfile = "GuiToolTipProfile";
+         };
+         new GuiButtonCtrl() {
+            text = "Exit to Menu";
+            position = "0 70";
+            extent = "700 55";
+            profile = "GuiMenuButtonProfile";
+            command = "pauseMenuExitToMenu();";
+            tooltipProfile = "GuiToolTipProfile";
+         };
+         new GuiButtonCtrl() {
+            text = "Exit to Desktop";
+            position = "0 140";
+            extent = "700 55";
+            profile = "GuiMenuButtonProfile";
+            command = "pauseMenuExitToDesktop();";
+            tooltipProfile = "GuiToolTipProfile";
+         };
       };
    };
    new GuiControl(PauseButtonHolder) {
-      position = "189 711";
-      extent = "646 40";
-      minExtent = "8 2";
+      position = "144 711";
+      extent = "736 40";
       horizSizing = "center";
       vertSizing = "top";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       class = "MenuInputButtonContainer";
-      canSave = "1";
-      canSaveDynamicFields = "0";
 
       new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
-         iconLocation = "Left";
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         position = "11 0";
+         extent = "140 40";
+         profile = "GuiMenuButtonProfile";
+         visible = "0";
+         active = "0";
+         tooltipProfile = "GuiToolTipProfile";
+         internalName = "button1";
+         class = "MenuInputButton";
+         hidden = "1";
+      };
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         position = "155 0";
+         extent = "140 40";
+         profile = "GuiMenuButtonProfile";
+         visible = "0";
+         active = "0";
+         tooltipProfile = "GuiToolTipProfile";
+         internalName = "button2";
+         class = "MenuInputButton";
+         hidden = "1";
+      };
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "OK";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "363 0";
+         position = "299 0";
          extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "PauseMenuList.activateRow();";
+         visible = "0";
+         active = "0";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "goButton";
+         internalName = "button3";
          class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
+         hidden = "1";
       };
       new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
-         iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc";
-         iconLocation = "Left";
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Back";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "507 0";
+         position = "443 0";
          extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "Canvas.popDialog();";
+         visible = "0";
+         active = "0";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "backButton";
+         internalName = "button4";
          class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
+         hidden = "1";
+      };
+      new GuiIconButtonCtrl() {
+         BitmapAsset = "UI:Keyboard_Black_Return_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Right";
+         position = "587 0";
+         extent = "140 40";
+         profile = "GuiMenuButtonProfile";
+         visible = "0";
+         active = "0";
+         tooltipProfile = "GuiToolTipProfile";
+         internalName = "button5";
+         class = "MenuInputButton";
+         hidden = "1";
       };
    };
    new GuiInputCtrl(PauseMenuInputHandler) {
-      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";
+      class = "MenuInputHandler";
    };
 };
 //--- OBJECT WRITE END ---

+ 10 - 17
Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript

@@ -23,6 +23,8 @@ function PauseMenu::onWake(%this)
    PauseMenuList.setAsActiveMenuList();
    PauseButtonHolder.setActive();
    PauseMenuInputHandler.setFirstResponder();
+   
+   %this.resizePages = true;
 }
 
 
@@ -35,37 +37,28 @@ function PauseMenu::onSleep(%this)
    }
 }
 
-function PauseMenu::onReturnTo(%this)
-{
-   PauseMenuList.hidden = false;
-   PauseMenuList.setAsActiveMenuList();
-   PauseButtonHolder.setActive();
-   PauseMenuInputHandler.setFirstResponder();
-}
-
 function openPauseMenuOptions()
 {
-   Canvas.pushDialog(OptionsMenu);
-   OptionsMenu.returnGui = PauseMenu; 
-   PauseMenuList.hidden = true;
+   PauseMenu.pushPage(OptionsMenu);
 }
 
 function pauseMenuExitToMenu()
 {
-   PauseMenuList.hidden = true;
-   MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "PauseMenu.onReturnTo();");
+   MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
 }
 
 function pauseMenuExitToDesktop()
 {
-   PauseMenuList.hidden = true;
-   MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "PauseMenu.onReturnTo();");
+   MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
 }
 
 function PauseButtonHolder::onWake(%this)
 {
-   %this-->goButton.set("btn_a", "Return", "OK", "PauseMenuList.activate();", true);
-   %this-->backButton.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
+   %this-->button1.disable();
+   %this-->button2.disable();
+   %this-->button3.disable();
+   %this-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();");
+   %this-->button4.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
 }
 
 function PauseMenu::addPauseMenuButton(%this, %buttonText, %buttonCallback)

二进制
Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Left.png


二进制
Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Middle.png


二进制
Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Right.png


+ 96 - 25
Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript

@@ -54,23 +54,41 @@ function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal)
 /// \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)
+function MenuInputButton::set(%this, %gamepadButton, %keyboardButton, %text, %command)
 {
+   %this.setHidden(false);
+   
    %set = (! ((%text $= "") && (%command $= "")));
-   %this.setText(%text);
-   %this.setActive(%set);
-   %this.setVisible(%set);
    
    %this.gamepadButton = %gamepadButton;
    %this.keyboardButton = %keyboardButton;
    
-   if(%gamepadOnly $= "")
-      %gamepadOnly = false;
+   if(%gamepadButton $= "")
+      %this.gamepadValid = false;
+   else
+      %this.gamepadValid = true;
       
-   %this.gamepadOnly = %gamepadOnly;
+   if(%keyboardButton $= "")
+      %this.kbmValid = false;
+   else
+      %this.kbmValid = true;
 
+   if((!%this.kbmValid && $activeControllerType !$= "gamepad") ||
+      (!%this.gamepadValid && $activeControllerType $= "gamepad"))
+      %set = false;
+      
+   %this.setText(%text);
    %this.Command = %command;
+   
+   %this.refresh();
+}
+
+function MenuInputButton::disable(%this)
+{
+   %this.setText("");
+   %this.Command = "";
+   %this.setActive(false);
+   %this.setVisible(false);
 }
 
 /// Refreshes the specific button, updating it's visbility status and the displayed input image
@@ -78,8 +96,10 @@ 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")
+   //Do a check so if a MenuInput is selectively bound and we're not using the
+   //matched input type, then we skip
+   if((!%this.kbmValid && $activeControllerType !$= "gamepad") ||
+      (!%this.gamepadValid && $activeControllerType $= "gamepad"))
       %set = false;
       
    %this.setActive(%set);
@@ -430,7 +450,7 @@ function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode)
          
    $activeMenuList = %this;
    $activeMenuList.hidden = false; 
-   $activeMenuListPosition = %startPosition;
+   $activeMenuList.ListPosition = %startPosition;
    $activeMenuListMode = %menuMode;
    
    %this.refresh();
@@ -440,21 +460,21 @@ function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode)
 function MenuList::activate(%this)
 {
    //check for a highlighted element
-   if($activeMenuListPosition.y > -1 && $activeMenuListPosition < $activeMenuList.getCount())
+   if($activeMenuList.ListPosition.y > -1 && $activeMenuList.ListPosition < $activeMenuList.getCount())
    {
-      %btn = $activeMenuList.getObject($activeMenuListPosition.y);
+      %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
       %btn.performClick();
    }
 }
 
 function MenuList::refresh(%this)
 {
-   %selectedObject = 0;
+   %selectedObject = -1;
    for(%i=0; %i < $activeMenuList.getCount(); %i++)
    {
       %btn = $activeMenuList.getObject(%i);
       
-      %isSelected = %i == $activeMenuListPosition.y;
+      %isSelected = %i == $activeMenuList.ListPosition.y;
       
       %btn.setHighlighted(%isSelected);
       
@@ -462,8 +482,32 @@ function MenuList::refresh(%this)
          %selectedObject = %i;
    }
    
+   if(isObject(%this.buttonPointerCtrl))
+   {
+      if(%selectedObject != -1)
+      {
+         %this.buttonPointerCtrl.setHidden(false);
+         
+         %buttonCenter = $activeMenuList.getObject(%selectedObject).getGlobalCenter();
+         
+         if(%this.centerButtonPointerCtrl)
+         {
+            %this.buttonPointerCtrl.setCenter(%buttonCenter.x, %buttonCenter.y);
+         }
+         else
+         {
+            //if we're not centering, then left-justify
+            %this.buttonPointerCtrl.setCenter(%buttonCenter.x - $activeMenuList.getObject(%selectedObject).extent.x / 2, %buttonCenter.y);  
+         }
+      }
+      else
+      {
+         %this.buttonPointerCtrl.setHidden(true);
+      }
+   }
+   
    if($activeMenuList.isMethod("onNavigate"))
-      $activeMenuList.onNavigate($activeMenuListPosition.y);
+      $activeMenuList.onNavigate($activeMenuList.ListPosition.y);
    
    %parent = $activeMenuList.getParent();
    if(%parent.getClassName() $= "GuiScrollCtrl")
@@ -474,18 +518,18 @@ function MenuList::refresh(%this)
 
 function MenuList::navigateUp(%this)
 {
-   $activeMenuListPosition.y -= 1;
-   if($activeMenuListPosition.y < 0)
-      $activeMenuListPosition.y = 0;
+   $activeMenuList.ListPosition.y -= 1;
+   if($activeMenuList.ListPosition.y < 0)
+      $activeMenuList.ListPosition.y = 0;
       
    %this.refresh();
 }
 
 function MenuList::navigateDown(%this)
 {
-   $activeMenuListPosition.y += 1;
-   if($activeMenuListPosition.y >= $activeMenuList.getCount())
-      $activeMenuListPosition.y = $activeMenuList.getCount()-1;
+   $activeMenuList.ListPosition.y += 1;
+   if($activeMenuList.ListPosition.y >= $activeMenuList.getCount())
+      $activeMenuList.ListPosition.y = $activeMenuList.getCount()-1;
       
    %this.refresh();
 }
@@ -496,7 +540,7 @@ function MenuList::navigateLeft()
    //this could readily be expanded upon to handle grids like for inventory screens
    //or the like
     
-   %btn = $activeMenuList.getObject($activeMenuListPosition.y);
+   %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
    if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
    {
       %mode = %btn.getMode();
@@ -522,7 +566,7 @@ function MenuList::navigateLeft()
 
 function MenuList::navigateRight()
 {
-   %btn = $activeMenuList.getObject($activeMenuListPosition.y);
+   %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
    if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
    {
       %mode = %btn.getMode();
@@ -548,5 +592,32 @@ function MenuList::navigateRight()
 
 function MenuList::getActiveRow(%this)
 {
-   return $activeMenuListPosition.y;
+   return $activeMenuList.ListPosition.y;
+}
+
+function MenuListButton::onHighlighted(%this, %state)
+{
+   %parentContainer = %this.getParent();
+   if(%parentContainer.class $= "MenuList" || %parentContainer.superClass $= "MenuList")
+   {
+      if(isObject(%parentContainer.buttonPointerCtrl))
+      {
+         if(%state)
+         {
+	         %parentContainer.buttonPointerCtrl.setHidden(false);
+	         
+	         %buttonCenter = %this.getGlobalCenter();
+	         
+	         if(%parentContainer.centerButtonPointerCtrl)
+	         {
+	               %parentContainer.buttonPointerCtrl.setGlobalCenter(%buttonCenter.x, %buttonCenter.y);
+	         }
+	         else
+	         {
+	            //if we're not centering, then left-justify
+	            %parentContainer.buttonPointerCtrl.setGlobalCenter(%buttonCenter.x - %this.extent.x / 2, %buttonCenter.y);  
+	         }
+	      }
+      }
+   }
 }

+ 220 - 0
Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript

@@ -0,0 +1,220 @@
+function UINavigation::setRootPage(%this, %rootPage)
+{
+   if(!isObject(%this.pageStack))
+   {
+      %this.pageStack = new ArrayObject();  
+   }
+   
+   if(isObject(%this.rootPage))
+   {
+      %canClose = true;
+      if(%this.rootPage.isMethod("canClose"))
+         %canClose = %this.rootPage.call("canClose");
+         
+      if(!%canClose)
+         return; //if we're not allowed to close, just bail out wholesale because clearly 
+                  //something is blocking changes to pages
+         
+      %this.remove(%this.rootPage);
+      if(%this.rootPage.isMethod("onClose"))
+         %this.rootPage.call("onClose");
+         
+      %this.rootPage.navigation = "";
+   }
+      
+   %this.rootPage = %rootPage;
+   
+   %this.add(%rootPage);
+   if(%this.resizePages)
+   {
+      %rootPage.resize(%this.position.x, %this.position.y, 
+         %this.extent.x, %this.extent.y);
+   }
+   %rootPage.navigation = %this;
+   
+   if(%rootPage.isMethod("onOpen"))
+      %rootPage.call("onOpen");
+}
+
+function UINavigation::pushPage(%this, %newPage, %callback)
+{
+   if(!isObject(%this.pageStack))
+   {
+      %this.pageStack = new ArrayObject();
+   }
+   
+   %canChange = true;
+   if(%newPage.isMethod("canOpen"))
+      %canChange = %newPage.call("canOpen");
+      
+   if(!%canChange)
+      return;
+      
+   %currentPage = %this.getCurrentPage();
+   if(isObject(%currentPage))
+   {
+      if(%currentPage.isMethod("canClose"))
+         %canChange = %currentPage.call("canClose");
+         
+      if(!%canChange)
+         return;
+         
+      if(%currentPage.isMethod("onClose"))
+         %currentPage.call("onClose");
+   }
+   
+   %this.pageStack.push_back(%newPage);
+   %this.add(%newPage);
+   if(%this.resizePages)
+   {
+      %newPage.resize(%this.position.x, %this.position.y, 
+         %this.extent.x, %this.extent.y);
+   }
+   
+   if(%newPage.isMethod("onOpen"))
+      %newPage.call("onOpen");
+   
+   %newPage.navigation = %this;
+   
+   if(%callback !$= "")
+   eval(%callback);
+}
+
+function UINavigation::popPage(%this, %callback)
+{
+   if(%this.pageStack.count() == 0)
+      return;
+      
+   %currentPage = %this.getCurrentPage();
+   if(isObject(%currentPage))
+   {
+      %canChange = true;
+      if(%currentPage.isMethod("canClose"))
+         %canChange = %currentPage.call("canClose");
+         
+      if(!%canChange)
+         return;
+   }
+   
+   %prevPage = %this.getPreviousPage();
+   if(isObject(%prevPage))
+   {
+      %canChange = true;
+      if(%prevPage.isMethod("canOpen"))
+         %canChange = %prevPage.call("canOpen");
+         
+      if(!%canChange)
+         return;
+   }
+      
+   if(isObject(%currentPage))
+   {
+      if(%currentPage.isMethod("onClose"))
+      {
+         %currentPage.call("onClose");
+      }    
+      
+      %this.pageStack.pop_back();
+      %this.remove(%currentPage);
+      
+      %currentPage.navigation = "";
+   }
+   
+   %newTopPage = %this.getCurrentPage();
+   if(%newTopPage.isMethod("onOpen"))
+      %newTopPage.call("onOpen");
+   
+   if(%callback !$= "")
+   eval(%callback);
+}
+
+function UINavigation::popToRoot(%this, %callback)
+{
+   %pageChanged = false;
+   while(%this.getPageCount() != 0)
+   {
+      %currentPage = %this.getCurrentPage();
+      if(isObject(%currentPage))
+      {
+         if(%currentPage.isMethod("canClose"))
+            %canChange = %currentPage.call("canClose");
+            
+         if(!%canChange)
+            return;
+      }
+      
+      %prevPage = %this.getPreviousPage();
+      if(isObject(%prevPage))
+      {
+         if(%prevPage.isMethod("canOpen"))
+            %canChange = %prevPage.call("canOpen");
+            
+         if(!%canChange)
+            return;
+      }
+         
+      if(isObject(%currentPage))
+      {
+         if(%currentPage.isMethod("onClose"))
+         {
+            %currentPage.call("onClose");
+         }    
+
+         %this.pageStack.pop_back();
+         %this.remove(%currentPage);
+         
+         %currentPage.navigation = "";
+      }
+      
+      %newTopPage = %this.getCurrentPage();
+      if(%newTopPage.isMethod("onOpen"))
+         %newTopPage.call("onOpen");
+         
+      %pageChanged = true;
+   }
+   
+   if(%pageChanged && %callback !$= "")
+      eval(%callback);
+}
+
+function UINavigation::getCurrentPage(%this)
+{
+   if(isObject(%this.pageStack) && %this.pageStack.count() != 0)
+   {
+      return %this.pageStack.getKey(%this.pageStack.count()-1);
+   }
+   else
+   {
+      if(isObject(%this.rootPage))
+         return %this.rootPage;
+   }
+   
+   return 0;
+}
+
+function UINavigation::getPreviousPage(%this)
+{
+   if(isObject(%this.pageStack) && %this.pageStack.count() > 1)
+   {
+      return %this.pageStack.getKey(%this.pageStack.count()-2);
+   }
+   else
+   {
+      if(isObject(%this.rootPage))
+         return %this.rootPage;
+   }
+   
+   return 0;
+}   
+
+function UINavigation::getPageCount(%this)
+{
+   %count = 0;
+   if(isObject(%this.pageStack))
+      %count = %this.pageStack.count();
+      
+   if(isObject(%this.rootPage))
+      %count++;
+      
+   return %count;
+}