Browse Source

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 years ago
parent
commit
41add628ad

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

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

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

@@ -35,12 +35,18 @@ function UI::initClient(%this)
    //Profiles
    //Profiles
    %this.queueExec("./scripts/profiles");
    %this.queueExec("./scripts/profiles");
    
    
+   //Navigation Utility Scripts
+   %this.queueExec("./scripts/menuNavigation");
+   
    //Now gui files
    //Now gui files
    %this.queueExec("./scripts/menuInputHandling");
    %this.queueExec("./scripts/menuInputHandling");
    
    
    %this.queueExec("./guis/mainMenu");
    %this.queueExec("./guis/mainMenu");
    %this.queueExec("./guis/mainMenu.gui");
    %this.queueExec("./guis/mainMenu.gui");
    
    
+   %this.queueExec("./guis/mainMenuButtons");
+   %this.queueExec("./guis/mainMenuButtons.gui");
+   
    %this.queueExec("./guis/chooseLevelDlg");
    %this.queueExec("./guis/chooseLevelDlg");
    %this.queueExec("./guis/chooseLevelDlg.gui");
    %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 ---
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(ChooseLevelDlg) {
 $guiContent = new GuiControl(ChooseLevelDlg) {
-   position = "0 0";
    extent = "1024 768";
    extent = "1024 768";
    minExtent = "8 8";
    minExtent = "8 8";
    horizSizing = "width";
    horizSizing = "width";
    vertSizing = "height";
    vertSizing = "height";
-   profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
+   profile = "GuiNonModalDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
    isContainer = "1";
-   canSave = "1";
    canSaveDynamicFields = "1";
    canSaveDynamicFields = "1";
       Enabled = "1";
       Enabled = "1";
       launchInEditor = "0";
       launchInEditor = "0";
@@ -20,294 +15,91 @@ $guiContent = new GuiControl(ChooseLevelDlg) {
    new GuiControl(ChooseLevelWindow) {
    new GuiControl(ChooseLevelWindow) {
       position = "48 56";
       position = "48 56";
       extent = "928 655";
       extent = "928 655";
-      minExtent = "8 2";
       horizSizing = "center";
       horizSizing = "center";
       vertSizing = "center";
       vertSizing = "center";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       isContainer = "1";
-      canSave = "1";
-      canSaveDynamicFields = "0";
 
 
       new GuiBitmapBarCtrl() {
       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";
          extent = "927 40";
-         minExtent = "8 2";
          horizSizing = "width";
          horizSizing = "width";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl(LevelSelectTitle) {
       new GuiTextCtrl(LevelSelectTitle) {
          text = "SINGLE PLAYER";
          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";
          position = "22 10";
          extent = "307 28";
          extent = "307 28";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuHeaderText";
          profile = "MenuHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiBitmapBarCtrl() {
       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";
          position = "0 40";
          extent = "927 618";
          extent = "927 618";
-         minExtent = "8 2";
          horizSizing = "width";
          horizSizing = "width";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiBitmapCtrl() {
       new GuiBitmapCtrl() {
-         bitmapAsset = "UI:no_preview_image";
-         color = "255 255 255 255";
-         wrap = "0";
+         BitmapAsset = "Core_Rendering:missingTexture_image";
          position = "513 71";
          position = "513 71";
          extent = "400 300";
          extent = "400 300";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
          internalName = "CurrentPreview";
          internalName = "CurrentPreview";
-         canSave = "1";
          canSaveDynamicFields = "1";
          canSaveDynamicFields = "1";
             Enabled = "1";
             Enabled = "1";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Example Level";
          text = "Example Level";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "514 375";
          position = "514 375";
          extent = "398 27";
          extent = "398 27";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuHeaderText";
          profile = "MenuHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
          internalName = "LevelName";
          internalName = "LevelName";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Description:";
          text = "Description:";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "522 410";
          position = "522 410";
          extent = "91 18";
          extent = "91 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuSubHeaderText";
          profile = "MenuSubHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
          internalName = "LevelDescriptionLabel";
          internalName = "LevelDescriptionLabel";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiMLTextCtrl() {
       new GuiMLTextCtrl() {
-         lineSpacing = "2";
-         allowColorChars = "0";
-         maxChars = "-1";
          text = "This is placeholder text";
          text = "This is placeholder text";
-         useURLMouseCursor = "0";
          position = "522 436";
          position = "522 436";
          extent = "391 14";
          extent = "391 14";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
          internalName = "LevelDescription";
          internalName = "LevelDescription";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiScrollCtrl() {
       new GuiScrollCtrl() {
-         willFirstRespond = "1";
          hScrollBar = "dynamic";
          hScrollBar = "dynamic";
          vScrollBar = "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";
          position = "0 40";
          extent = "450 580";
          extent = "450 580";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuScrollProfile";
          profile = "GuiMenuScrollProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
 
 
          new GuiGameListMenuCtrl(LevelList) {
          new GuiGameListMenuCtrl(LevelList) {
-            debugRender = "0";
             callbackOnInputs = "1";
             callbackOnInputs = "1";
             position = "1 1";
             position = "1 1";
             extent = "450 90";
             extent = "450 90";
-            minExtent = "8 2";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "DefaultListMenuProfile";
             profile = "DefaultListMenuProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
-            isContainer = "0";
             class = "UIMenuButtonList";
             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))
    if(!isObject(LevelListEntries))
       new ArrayObject(LevelListEntries){};
       new ArrayObject(LevelListEntries){};
       
       
+   if(!isObject(ChooseLevelAssetQuery))
+      new AssetQuery(ChooseLevelAssetQuery);
+}
+
+function ChooseLevelDlg::onOpen(%this)
+{
    LevelList.clearRows();
    LevelList.clearRows();
    LevelListEntries.empty();
    LevelListEntries.empty();
    
    
@@ -33,10 +39,10 @@ function ChooseLevelDlg::onWake( %this )
    ChooseLevelWindow->LevelDescriptionLabel.visible = false;
    ChooseLevelWindow->LevelDescriptionLabel.visible = false;
    ChooseLevelWindow->LevelDescription.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"))
    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.", 
       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();");
          "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();");
          
          
-      %assetQuery.delete();
+      ChooseLevelAssetQuery.delete();
       return;
       return;
    }
    }
    
    
    for(%i=0; %i < %count; %i++)
    for(%i=0; %i < %count; %i++)
 	{
 	{
-	   %assetId = %assetQuery.getAsset(%i);
+	   %assetId = ChooseLevelAssetQuery.getAsset(%i);
 	   
 	   
 	   if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
 	   if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
 	      continue;
 	      continue;
@@ -97,12 +103,12 @@ function ChooseLevelDlg::onWake( %this )
       LevelSelectTitle.setText("CREATE SERVER");
       LevelSelectTitle.setText("CREATE SERVER");
    
    
    ChooseLevelButtonHolder.setActive();
    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 )
 function ChooseLevelDlg::onSleep( %this )
@@ -202,10 +208,3 @@ function ChooseLevelDlg::beginLevel(%this)
       StartGame(); 
       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 ---
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(JoinServerMenu) {
 $guiContent = new GuiControl(JoinServerMenu) {
-   position = "0 0";
    extent = "1024 768";
    extent = "1024 768";
-   minExtent = "8 2";
-   horizSizing = "right";
-   vertSizing = "bottom";
-   profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
+   profile = "GuiNonModalDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
    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";
       horizSizing = "width";
       vertSizing = "height";
       vertSizing = "height";
-      profile = "GuiInputCtrlProfile";
-      visible = "1";
-      active = "1";
-      tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "0";
-      canSave = "1";
       canSaveDynamicFields = "0";
       canSaveDynamicFields = "0";
-   };
+
    new GuiControl(JoinServerWindow) {
    new GuiControl(JoinServerWindow) {
       position = "48 56";
       position = "48 56";
       extent = "928 655";
       extent = "928 655";
-      minExtent = "8 2";
       horizSizing = "center";
       horizSizing = "center";
       vertSizing = "center";
       vertSizing = "center";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       isContainer = "1";
-      canSave = "1";
-      canSaveDynamicFields = "0";
 
 
       new GuiBitmapBarCtrl() {
       new GuiBitmapBarCtrl() {
-         percent = "100";
-         vertical = "0";
-         flipClip = "0";
          BitmapAsset = "UI:panel_image";
          BitmapAsset = "UI:panel_image";
-         color = "255 255 255 255";
-         position = "0 0";
          extent = "927 40";
          extent = "927 40";
-         minExtent = "8 2";
          horizSizing = "width";
          horizSizing = "width";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "JOIN SERVER";
          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";
          position = "22 10";
          extent = "207 28";
          extent = "207 28";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuHeaderText";
          profile = "MenuHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiBitmapBarCtrl() {
       new GuiBitmapBarCtrl() {
-         percent = "100";
-         vertical = "0";
-         flipClip = "0";
          BitmapAsset = "UI:panel_low_image";
          BitmapAsset = "UI:panel_low_image";
-         color = "255 255 255 255";
          position = "0 40";
          position = "0 40";
          extent = "927 618";
          extent = "927 618";
-         minExtent = "8 2";
          horizSizing = "width";
          horizSizing = "width";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl(JS_status) {
       new GuiTextCtrl(JS_status) {
          text = "No servers found.";
          text = "No servers found.";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "392 47";
          position = "392 47";
          extent = "148 18";
          extent = "148 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "MenuSubHeaderText";
          profile = "MenuSubHeaderText";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Players";
          text = "Players";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "269 67";
          position = "269 67";
          extent = "36 18";
          extent = "36 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Version";
          text = "Version";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "335 67";
          position = "335 67";
          extent = "38 18";
          extent = "38 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Game";
          text = "Game";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "412 67";
          position = "412 67";
          extent = "28 18";
          extent = "28 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Ping";
          text = "Ping";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "212 67";
          position = "212 67";
          extent = "20 18";
          extent = "20 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "Server Name";
          text = "Server Name";
          maxLength = "255";
          maxLength = "255";
-         margin = "0 0 0 0";
-         padding = "0 0 0 0";
-         anchorTop = "1";
-         anchorBottom = "0";
-         anchorLeft = "1";
-         anchorRight = "0";
          position = "12 67";
          position = "12 67";
          extent = "63 18";
          extent = "63 18";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMLWhiteTextProfile";
          profile = "GuiMLWhiteTextProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "0";
          isContainer = "0";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
       new GuiScrollCtrl() {
       new GuiScrollCtrl() {
-         willFirstRespond = "1";
          hScrollBar = "dynamic";
          hScrollBar = "dynamic";
          vScrollBar = "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";
          position = "19 98";
          extent = "890 501";
          extent = "890 501";
          minExtent = "8 8";
          minExtent = "8 8";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuScrollProfile";
          profile = "GuiMenuScrollProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
 
 
          new GuiStackControl(JoinServerList) {
          new GuiStackControl(JoinServerList) {
-            stackingType = "Vertical";
-            horizStacking = "Left to Right";
-            vertStacking = "Top to Bottom";
             padding = "10";
             padding = "10";
-            dynamicSize = "1";
-            dynamicNonStackExtent = "0";
-            dynamicPos = "0";
             changeChildSizeToFit = "0";
             changeChildSizeToFit = "0";
-            changeChildPosition = "1";
             position = "1 1";
             position = "1 1";
             extent = "888 16";
             extent = "888 16";
-            minExtent = "16 16";
             horizSizing = "center";
             horizSizing = "center";
             vertSizing = "center";
             vertSizing = "center";
             profile = "GuiDefaultProfile";
             profile = "GuiDefaultProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
-            isContainer = "1";
-            canSave = "1";
-            canSaveDynamicFields = "0";
-            class = "MenuList";
+            superClass = "MenuList";
          };
          };
       };
       };
       new GuiControl(JS_queryStatus) {
       new GuiControl(JS_queryStatus) {
          position = "16 615";
          position = "16 615";
          extent = "900 35";
          extent = "900 35";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
          visible = "0";
          visible = "0";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
          isContainer = "1";
          isContainer = "1";
          hidden = "1";
          hidden = "1";
-         canSave = "1";
-         canSaveDynamicFields = "0";
 
 
          new GuiProgressCtrl(JS_statusBar) {
          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";
             position = "84 0";
             extent = "695 35";
             extent = "695 35";
             minExtent = "8 8";
             minExtent = "8 8";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "GuiProgressProfile";
             profile = "GuiProgressProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
             isContainer = "0";
             isContainer = "0";
-            canSave = "1";
-            canSaveDynamicFields = "0";
          };
          };
          new GuiButtonCtrl(JS_cancelQuery) {
          new GuiButtonCtrl(JS_cancelQuery) {
             text = "Cancel!";
             text = "Cancel!";
-            groupNum = "-1";
-            buttonType = "PushButton";
-            useMouseEvents = "0";
-            position = "0 0";
             extent = "84 35";
             extent = "84 35";
             minExtent = "8 8";
             minExtent = "8 8";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "GuiMenuButtonProfile";
             profile = "GuiMenuButtonProfile";
-            visible = "1";
-            active = "1";
             command = "JoinServerDlg.cancel();";
             command = "JoinServerDlg.cancel();";
             tooltipProfile = "GuiToolTipProfile";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
-            isContainer = "0";
-            canSave = "1";
-            canSaveDynamicFields = "0";
          };
          };
          new GuiTextCtrl(JS_statusText) {
          new GuiTextCtrl(JS_statusText) {
             text = "Querying master server";
             text = "Querying master server";
             maxLength = "255";
             maxLength = "255";
-            margin = "0 0 0 0";
-            padding = "0 0 0 0";
-            anchorTop = "1";
-            anchorBottom = "0";
-            anchorLeft = "1";
-            anchorRight = "0";
             position = "84 0";
             position = "84 0";
             extent = "695 35";
             extent = "695 35";
             minExtent = "8 8";
             minExtent = "8 8";
-            horizSizing = "right";
-            vertSizing = "bottom";
             profile = "GuiMenuButtonProfile";
             profile = "GuiMenuButtonProfile";
-            visible = "1";
-            active = "1";
             tooltipProfile = "GuiToolTipProfile";
             tooltipProfile = "GuiToolTipProfile";
-            hovertime = "1000";
             isContainer = "0";
             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)
 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)
 function JoinServerMenu::refresh(%this)
 {
 {
    cancelServerQuery();
    cancelServerQuery();
-   %index= JS_serverList.getSelectedId();
+   %index= JoinServerList.getActiveRow();
 
 
    // The server info index is stored in the row along with the
    // The server info index is stored in the row along with the
    // rest of displayed info.
    // rest of displayed info.
@@ -93,16 +84,6 @@ function JoinServerMenu::refreshSelectedServer( %this )
    querySingleServer( $JoinGameAddress, 0 );
    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)
 function JoinServerMenu::update(%this)
 {
 {
@@ -124,7 +105,7 @@ function JoinServerMenu::update(%this)
       JoinServerList.add(%serverBtn);
       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 ---
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
 $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
    BitmapAsset = "UI:backgrounddark_image";
    BitmapAsset = "UI:backgrounddark_image";
-   useVariable = "0";
-   tile = "0";
-   position = "0 0";
    extent = "1024 768";
    extent = "1024 768";
    minExtent = "8 8";
    minExtent = "8 8";
    horizSizing = "width";
    horizSizing = "width";
    vertSizing = "height";
    vertSizing = "height";
    profile = "GuiDefaultProfile";
    profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
    tooltipProfile = "GuiToolTipProfile";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
    isContainer = "1";
-   canSave = "1";
-   canSaveDynamicFields = "1";
-      Enabled = "1";
-      isDecoy = "0";
-      navigationIndex = "-1";
+   superClass = "UINavigation";
+   canSaveDynamicFields = "0";
 
 
    new GuiBitmapCtrl(MainMenuAppLogo) {
    new GuiBitmapCtrl(MainMenuAppLogo) {
       BitmapAsset = "UI:Torque_3D_logo_alt_image";
       BitmapAsset = "UI:Torque_3D_logo_alt_image";
-      color = "255 255 255 255";
-      wrap = "0";
       position = "550 30";
       position = "550 30";
       extent = "443 139";
       extent = "443 139";
-      minExtent = "8 2";
       horizSizing = "left";
       horizSizing = "left";
-      vertSizing = "bottom";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "0";
-      canSave = "1";
       canSaveDynamicFields = "1";
       canSaveDynamicFields = "1";
          autoFitExtents = "0";
          autoFitExtents = "0";
          bitmapMode = "Stretched";
          bitmapMode = "Stretched";
@@ -45,239 +27,98 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
          useModifiers = "0";
          useModifiers = "0";
          useStates = "1";
          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";
       horizSizing = "center";
-      vertSizing = "center";
+      vertSizing = "top";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       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";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "openOptionsMenu();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
          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";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "openWorldEditorBtn();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
          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";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "openGUIEditorBtn();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
          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";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "quit();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
          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() {
       new GuiIconButtonCtrl() {
-         buttonMargin = "4 4";
          BitmapAsset = "UI:Keyboard_Black_Return_image";
          BitmapAsset = "UI:Keyboard_Black_Return_image";
-         iconLocation = "Left";
          sizeIconToButton = "1";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          makeIconSquare = "1";
          textLocation = "Right";
          textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
          text = "Go";
          text = "Go";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "507 0";
+         position = "587 0";
          extent = "140 40";
          extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuButtonProfile";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "MainMenuButtonList.activateRow();";
+         command = "MainMenuButtonList.activate();";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "goButton";
+         internalName = "button5";
          class = "MenuInputButton";
          class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
       };
       };
    };
    };
    new GuiInputCtrl(MainMenuInputHandler) {
    new GuiInputCtrl(MainMenuInputHandler) {
-      class = "MenuInputHandler";
       sendAxisEvents = "1";
       sendAxisEvents = "1";
       sendBreakEvents = "1";
       sendBreakEvents = "1";
-      sendModifierEvents = "0";
       ignoreMouseEvents = "1";
       ignoreMouseEvents = "1";
-      lockMouse = "0";
       position = "-50 0";
       position = "-50 0";
       extent = "10 10";
       extent = "10 10";
-      minExtent = "8 2";
       horizSizing = "width";
       horizSizing = "width";
       vertSizing = "height";
       vertSizing = "height";
       profile = "GuiInputCtrlProfile";
       profile = "GuiInputCtrlProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "0";
-      canSave = "1";
-      canSaveDynamicFields = "0";
+      class = "MenuInputHandler";
    };
    };
 };
 };
 //--- OBJECT WRITE END ---
 //--- 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)
 function MainMenuGui::onWake(%this)
 {
 {
-   MainMenuButtonList.setAsActiveMenuList();
    MainMenuButtonHolder.setActive();
    MainMenuButtonHolder.setActive();
    MainMenuInputHandler.setFirstResponder();
    MainMenuInputHandler.setFirstResponder();
-}
-
-function MainMenuGui::onSleep(%this)
-{
-   MainMenuButtonHolder.hidden = true;
+   
+   %this.setRootPage(MainMenuButtonList);
+   
+   %this.resizePages = true;
 }
 }
 
 
 function MainMenuButtonHolder::onWake(%this)
 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 ---
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(OptionsMenu) {
 $guiContent = new GuiControl(OptionsMenu) {
    extent = "1024 768";
    extent = "1024 768";
-   profile = "GuiDefaultProfile";
+   profile = "GuiNonModalDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
    tooltipProfile = "GuiToolTipProfile";
    isContainer = "1";
    isContainer = "1";
+   horizSizing = "width";
+   vertSizing = "height";
    canSaveDynamicFields = "0";
    canSaveDynamicFields = "0";
 
 
-   new GuiControl() {
+   new GuiControl(OptionsMenuContainer) {
       position = "48 56";
       position = "48 56";
       extent = "928 655";
       extent = "928 655";
       horizSizing = "aspectCenter";
       horizSizing = "aspectCenter";
@@ -33,7 +35,7 @@ $guiContent = new GuiControl(OptionsMenu) {
       new GuiTextCtrl() {
       new GuiTextCtrl() {
          text = "OPTIONS";
          text = "OPTIONS";
          position = "22 7";
          position = "22 7";
-         extent = "120 28";
+         extent = "220 28";
          profile = "MenuHeaderText";
          profile = "MenuHeaderText";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
       };
       };
@@ -77,7 +79,7 @@ $guiContent = new GuiControl(OptionsMenu) {
                vertSizing = "height";
                vertSizing = "height";
                profile = "GuiDefaultProfile";
                profile = "GuiDefaultProfile";
                tooltipProfile = "GuiToolTipProfile";
                tooltipProfile = "GuiToolTipProfile";
-               class = "MenuList";
+               superClass = "MenuList";
 
 
                new GuiButtonCtrl() {
                new GuiButtonCtrl() {
                   text = "Display";
                   text = "Display";
@@ -118,6 +120,14 @@ $guiContent = new GuiControl(OptionsMenu) {
                   command = "populateGamepadSettingsList();";
                   command = "populateGamepadSettingsList();";
                   tooltipProfile = "GuiToolTipProfile";
                   tooltipProfile = "GuiToolTipProfile";
                };
                };
+               new GuiButtonCtrl() {
+                  text = "Example Options";
+                  position = "0 225";
+                  extent = "248 35";
+                  profile = "GuiMenuButtonProfile";
+                  command = "testExampleOptions();";
+                  tooltipProfile = "GuiToolTipProfile";
+               };
             };
             };
          };
          };
          new GuiPanel() {
          new GuiPanel() {
@@ -141,81 +151,76 @@ $guiContent = new GuiControl(OptionsMenu) {
                   padding = "5";
                   padding = "5";
                   changeChildSizeToFit = "0";
                   changeChildSizeToFit = "0";
                   position = "1 1";
                   position = "1 1";
-                  extent = "661 30";
+                  extent = "661 170";
                   horizSizing = "width";
                   horizSizing = "width";
                   vertSizing = "height";
                   vertSizing = "height";
                   profile = "GuiDefaultProfile";
                   profile = "GuiDefaultProfile";
                   tooltipProfile = "GuiToolTipProfile";
                   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 ---
 //--- OBJECT WRITE END ---

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

@@ -72,16 +72,7 @@ function OptionsMenu::onAdd(%this)
    callOnModules("populateOptionsMenuCategories", "Game");
    callOnModules("populateOptionsMenuCategories", "Game");
 }
 }
 
 
-function OptionsMenuSettingsList::onAdd(%this)
-{
-}
-
-function OptionsMenuSettingsList::getOptionsList(%this, %index)
-{
-     
-}
-
-function OptionsMenu::onWake(%this)
+function OptionsMenu::onOpen(%this)
 {
 {
    OptionsMenuCategoryList.clear(); 
    OptionsMenuCategoryList.clear(); 
    
    
@@ -116,22 +107,48 @@ function OptionsMenu::onWake(%this)
    
    
    %this.unappliedChanges.empty();
    %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();
    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)
 function OptionsMenu::select(%this)
@@ -281,9 +298,6 @@ function OptionsMenu::apply(%this)
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    
    
    OptionsMenu.unappliedChanges.empty();
    OptionsMenu.unappliedChanges.empty();
-   
-   //Now we can back out of the options menu
-   OptionsMenu.doOptionsMenuBackOut();
 }
 }
 
 
 function OptionsMenu::resetToDefaults(%this)
 function OptionsMenu::resetToDefaults(%this)
@@ -346,7 +360,9 @@ function populateDisplaySettingsList()
    
    
    OptionsMenu.currentCategory = "Display";
    OptionsMenu.currentCategory = "Display";
    
    
+   if(isObject(OptionName))
    OptionName.setText("");
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
    %apiList = "";
    %apiList = "";
@@ -433,7 +449,9 @@ function populateGraphicsSettingsList()
    
    
    OptionsMenu.currentCategory = "Graphics";
    OptionsMenu.currentCategory = "Graphics";
    
    
+   if(isObject(OptionName))
    OptionName.setText("");
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
    %yesNoList = "No\tYes";
    %yesNoList = "No\tYes";
@@ -598,7 +616,9 @@ function populateAudioSettingsList()
    
    
    OptionsMenu.currentCategory = "Audio";
    OptionsMenu.currentCategory = "Audio";
    
    
+   if(isObject(OptionName))
    OptionName.setText("");
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
    %buffer = sfxGetAvailableDevices();
    %buffer = sfxGetAvailableDevices();
@@ -691,7 +711,9 @@ function populateKeyboardMouseSettingsList()
    
    
    OptionsMenu.currentCategory = "Keyboard & Mouse";
    OptionsMenu.currentCategory = "Keyboard & Mouse";
    
    
+   if(isObject(OptionName))
    OptionName.setText("");
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
    $remapListDevice = "keyboard";
    $remapListDevice = "keyboard";
@@ -706,7 +728,9 @@ function populateGamepadSettingsList()
    
    
    OptionsMenu.currentCategory = "Gamepad";
    OptionsMenu.currentCategory = "Gamepad";
    
    
+   if(isObject(OptionName))
    OptionName.setText("");
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    OptionDescription.setText("");
    
    
    $remapListDevice = "gamepad";
    $remapListDevice = "gamepad";
@@ -723,48 +747,6 @@ function OptionsMenuList::activateRow(%this)
    OptionsMenuSettingsList.setFirstResponder();
    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)
 function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
 {
 {
    %option = %this.getObject(%row);
    %option = %this.getObject(%row);
@@ -955,16 +937,25 @@ function getDisplayDeviceName()
 //
 //
 function MenuOptionsButton::onMouseEnter(%this)
 function MenuOptionsButton::onMouseEnter(%this)
 {
 {
+   if(isObject(OptionName))
    OptionName.setText(%this.getLabel());
    OptionName.setText(%this.getLabel());
+   if(isObject(OptionDescription))
    OptionDescription.setText(%this.getToolTip());
    OptionDescription.setText(%this.getToolTip());
 }
 }
 
 
 function MenuOptionsButton::onMouseLeave(%this)
 function MenuOptionsButton::onMouseLeave(%this)
 {
 {
+   if(isObject(OptionName))
    OptionName.setText("");
    OptionName.setText("");
+   if(isObject(OptionDescription))
    OptionDescription.setText("");
    OptionDescription.setText("");
 }
 }
 
 
+function MenuOptionsButton::onHighlighted(%this, %state)
+{
+   MenuListButton::onHighlighted(%this, %state);
+}
+
 function MenuOptionsButton::onChange(%this)
 function MenuOptionsButton::onChange(%this)
 {
 {
    %optionMode = %this.getMode();
    %optionMode = %this.getMode();

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

@@ -1,178 +1,163 @@
 //--- OBJECT WRITE BEGIN ---
 //--- OBJECT WRITE BEGIN ---
 $guiContent = new GuiControl(PauseMenu) {
 $guiContent = new GuiControl(PauseMenu) {
-   position = "0 0";
    extent = "1024 768";
    extent = "1024 768";
-   minExtent = "8 2";
-   horizSizing = "right";
-   vertSizing = "bottom";
    profile = "GuiDefaultProfile";
    profile = "GuiDefaultProfile";
-   visible = "1";
-   active = "1";
    tooltipProfile = "GuiToolTipProfile";
    tooltipProfile = "GuiToolTipProfile";
-   hovertime = "1000";
    isContainer = "1";
    isContainer = "1";
-   canSave = "1";
+   superClass = "UINavigation";
    canSaveDynamicFields = "1";
    canSaveDynamicFields = "1";
-      tamlReader = "19772";
-      tile = "0";
-      useVariable = "0";
 
 
    new GuiChunkedBitmapCtrl(PauseMenuBG) {
    new GuiChunkedBitmapCtrl(PauseMenuBG) {
-      bitmapAsset = "UI:hudfill_image";
-      useVariable = "0";
-      tile = "0";
-      position = "0 0";
+      BitmapAsset = "UI:hudfill_image";
       extent = "1024 768";
       extent = "1024 768";
-      minExtent = "8 2";
       horizSizing = "width";
       horizSizing = "width";
       vertSizing = "height";
       vertSizing = "height";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       isContainer = "1";
-      canSave = "1";
       canSaveDynamicFields = "1";
       canSaveDynamicFields = "1";
    };
    };
    new GuiControl() {
    new GuiControl() {
       position = "162 125";
       position = "162 125";
       extent = "700 518";
       extent = "700 518";
-      minExtent = "8 2";
       horizSizing = "center";
       horizSizing = "center";
       vertSizing = "center";
       vertSizing = "center";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       isContainer = "1";
-      canSave = "1";
-      canSaveDynamicFields = "0";
       
       
       new GuiStackControl(PauseMenuList) {
       new GuiStackControl(PauseMenuList) {
-         stackingType = "Vertical";
-         horizStacking = "Left to Right";
-         vertStacking = "Top to Bottom";
          padding = "15";
          padding = "15";
          dynamicSize = "0";
          dynamicSize = "0";
-         dynamicNonStackExtent = "0";
-         dynamicPos = "0";
-         changeChildSizeToFit = "1";
-         changeChildPosition = "1";
-         position = "0 0";
          extent = "700 320";
          extent = "700 320";
-         minExtent = "16 16";
          horizSizing = "center";
          horizSizing = "center";
          vertSizing = "center";
          vertSizing = "center";
          profile = "GuiDefaultProfile";
          profile = "GuiDefaultProfile";
-         visible = "1";
-         active = "1";
          tooltipProfile = "GuiToolTipProfile";
          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) {
    new GuiControl(PauseButtonHolder) {
-      position = "189 711";
-      extent = "646 40";
-      minExtent = "8 2";
+      position = "144 711";
+      extent = "736 40";
       horizSizing = "center";
       horizSizing = "center";
       vertSizing = "top";
       vertSizing = "top";
       profile = "GuiDefaultProfile";
       profile = "GuiDefaultProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
       isContainer = "1";
       isContainer = "1";
       class = "MenuInputButtonContainer";
       class = "MenuInputButtonContainer";
-      canSave = "1";
-      canSaveDynamicFields = "0";
 
 
       new GuiIconButtonCtrl() {
       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";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          makeIconSquare = "1";
          textLocation = "Right";
          textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "OK";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "363 0";
+         position = "299 0";
          extent = "140 40";
          extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuButtonProfile";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "PauseMenuList.activateRow();";
+         visible = "0";
+         active = "0";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "goButton";
+         internalName = "button3";
          class = "MenuInputButton";
          class = "MenuInputButton";
-         canSave = "1";
-         canSaveDynamicFields = "0";
+         hidden = "1";
       };
       };
       new GuiIconButtonCtrl() {
       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";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          makeIconSquare = "1";
          textLocation = "Right";
          textLocation = "Right";
-         textMargin = "4";
-         autoSize = "0";
-         text = "Back";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "507 0";
+         position = "443 0";
          extent = "140 40";
          extent = "140 40";
-         minExtent = "8 2";
-         horizSizing = "right";
-         vertSizing = "bottom";
          profile = "GuiMenuButtonProfile";
          profile = "GuiMenuButtonProfile";
-         visible = "1";
-         active = "1";
-         command = "Canvas.popDialog();";
+         visible = "0";
+         active = "0";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
-         hovertime = "1000";
-         isContainer = "0";
-         internalName = "backButton";
+         internalName = "button4";
          class = "MenuInputButton";
          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) {
    new GuiInputCtrl(PauseMenuInputHandler) {
-      class = "MenuInputHandler";
       sendAxisEvents = "1";
       sendAxisEvents = "1";
       sendBreakEvents = "1";
       sendBreakEvents = "1";
-      sendModifierEvents = "0";
       ignoreMouseEvents = "1";
       ignoreMouseEvents = "1";
-      lockMouse = "0";
       position = "-50 0";
       position = "-50 0";
       extent = "10 10";
       extent = "10 10";
-      minExtent = "8 2";
       horizSizing = "width";
       horizSizing = "width";
       vertSizing = "height";
       vertSizing = "height";
       profile = "GuiInputCtrlProfile";
       profile = "GuiInputCtrlProfile";
-      visible = "1";
-      active = "1";
       tooltipProfile = "GuiToolTipProfile";
       tooltipProfile = "GuiToolTipProfile";
-      hovertime = "1000";
-      isContainer = "0";
-      canSave = "1";
-      canSaveDynamicFields = "0";
+      class = "MenuInputHandler";
    };
    };
 };
 };
 //--- OBJECT WRITE END ---
 //--- OBJECT WRITE END ---

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

@@ -23,6 +23,8 @@ function PauseMenu::onWake(%this)
    PauseMenuList.setAsActiveMenuList();
    PauseMenuList.setAsActiveMenuList();
    PauseButtonHolder.setActive();
    PauseButtonHolder.setActive();
    PauseMenuInputHandler.setFirstResponder();
    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()
 function openPauseMenuOptions()
 {
 {
-   Canvas.pushDialog(OptionsMenu);
-   OptionsMenu.returnGui = PauseMenu; 
-   PauseMenuList.hidden = true;
+   PauseMenu.pushPage(OptionsMenu);
 }
 }
 
 
 function pauseMenuExitToMenu()
 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()
 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)
 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)
 function PauseMenu::addPauseMenuButton(%this, %buttonText, %buttonCallback)

BIN
Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Left.png


BIN
Templates/BaseGame/game/data/UI/images/Inputs/Keyboard & Mouse/Keyboard_Black_Mouse_Middle.png


BIN
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 %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 %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 %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 $= "")));
    %set = (! ((%text $= "") && (%command $= "")));
-   %this.setText(%text);
-   %this.setActive(%set);
-   %this.setVisible(%set);
    
    
    %this.gamepadButton = %gamepadButton;
    %this.gamepadButton = %gamepadButton;
    %this.keyboardButton = %keyboardButton;
    %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.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
 /// 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 $= "")));
    %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;
       %set = false;
       
       
    %this.setActive(%set);
    %this.setActive(%set);
@@ -430,7 +450,7 @@ function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode)
          
          
    $activeMenuList = %this;
    $activeMenuList = %this;
    $activeMenuList.hidden = false; 
    $activeMenuList.hidden = false; 
-   $activeMenuListPosition = %startPosition;
+   $activeMenuList.ListPosition = %startPosition;
    $activeMenuListMode = %menuMode;
    $activeMenuListMode = %menuMode;
    
    
    %this.refresh();
    %this.refresh();
@@ -440,21 +460,21 @@ function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode)
 function MenuList::activate(%this)
 function MenuList::activate(%this)
 {
 {
    //check for a highlighted element
    //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();
       %btn.performClick();
    }
    }
 }
 }
 
 
 function MenuList::refresh(%this)
 function MenuList::refresh(%this)
 {
 {
-   %selectedObject = 0;
+   %selectedObject = -1;
    for(%i=0; %i < $activeMenuList.getCount(); %i++)
    for(%i=0; %i < $activeMenuList.getCount(); %i++)
    {
    {
       %btn = $activeMenuList.getObject(%i);
       %btn = $activeMenuList.getObject(%i);
       
       
-      %isSelected = %i == $activeMenuListPosition.y;
+      %isSelected = %i == $activeMenuList.ListPosition.y;
       
       
       %btn.setHighlighted(%isSelected);
       %btn.setHighlighted(%isSelected);
       
       
@@ -462,8 +482,32 @@ function MenuList::refresh(%this)
          %selectedObject = %i;
          %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"))
    if($activeMenuList.isMethod("onNavigate"))
-      $activeMenuList.onNavigate($activeMenuListPosition.y);
+      $activeMenuList.onNavigate($activeMenuList.ListPosition.y);
    
    
    %parent = $activeMenuList.getParent();
    %parent = $activeMenuList.getParent();
    if(%parent.getClassName() $= "GuiScrollCtrl")
    if(%parent.getClassName() $= "GuiScrollCtrl")
@@ -474,18 +518,18 @@ function MenuList::refresh(%this)
 
 
 function MenuList::navigateUp(%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();
    %this.refresh();
 }
 }
 
 
 function MenuList::navigateDown(%this)
 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();
    %this.refresh();
 }
 }
@@ -496,7 +540,7 @@ function MenuList::navigateLeft()
    //this could readily be expanded upon to handle grids like for inventory screens
    //this could readily be expanded upon to handle grids like for inventory screens
    //or the like
    //or the like
     
     
-   %btn = $activeMenuList.getObject($activeMenuListPosition.y);
+   %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
    if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
    if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
    {
    {
       %mode = %btn.getMode();
       %mode = %btn.getMode();
@@ -522,7 +566,7 @@ function MenuList::navigateLeft()
 
 
 function MenuList::navigateRight()
 function MenuList::navigateRight()
 {
 {
-   %btn = $activeMenuList.getObject($activeMenuListPosition.y);
+   %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
    if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
    if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
    {
    {
       %mode = %btn.getMode();
       %mode = %btn.getMode();
@@ -548,5 +592,32 @@ function MenuList::navigateRight()
 
 
 function MenuList::getActiveRow(%this)
 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;
+}