diff --git a/binaries/data/mods/official/gui/test/functions_page_pregame_load.js b/binaries/data/mods/official/gui/test/functions_page_pregame_load.js index 8b97d10f0a..6ddbf78b5b 100644 --- a/binaries/data/mods/official/gui/test/functions_page_pregame_load.js +++ b/binaries/data/mods/official/gui/test/functions_page_pregame_load.js @@ -22,7 +22,7 @@ function startMap (mapName, losSetting, openWindow) // Set up game g_GameAttributes.mapFile = mapName; g_GameAttributes.losSetting = losSetting; - + // Close setup window closeMainMenuSubWindow (openWindow); diff --git a/binaries/data/mods/official/gui/test/functions_page_session_status_commands.js b/binaries/data/mods/official/gui/test/functions_page_session_status_commands.js index 0afc86294c..f0be15985e 100644 --- a/binaries/data/mods/official/gui/test/functions_page_session_status_commands.js +++ b/binaries/data/mods/official/gui/test/functions_page_session_status_commands.js @@ -165,38 +165,43 @@ console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet + // Set tab tooltip. tooltip = cellGroup[cellSheet][tab].name; tooltip += " " + cellSheet; - - // Set tab function. - tabObject.onPress = function (event) - { - } break; case "pick": // Set tab tooltip. tooltip = cellSheet; tooltip += " List\nCurrent " + cellSheet + ": " + cellGroup[cellSheet][tab].name; - - // Set tab function. - tabObject.onPress = function (event) - { - // Click the tab button to toggle visibility of its list. - guiToggle ( "snStatusPaneCommandGroup" + this.name.substring (this.name.lastIndexOf ("d")+1, this.name.lastIndexOf ("_")) ); - } break; default: // Set tab tooltip. tooltip = cellGroup[cellSheet][tab].name; tooltip += " " + cellSheet; + break; + } + tabObject.tooltip = tooltip; - // Set tab function. + switch (type) + { + case "command": + // An array of actions for the command "tabs" can be triggered by clicking the individual commands. We'll set them here. + tabObject.onPress = function (event) + { + } + break; + default: + // Set tab function when user moves mouse over tab. + tabObject.onMouseEnter = function (event) + { + // Click the tab button to toggle visibility of its list. + guiToggle ( "snStatusPaneCommandGroup" + this.name.substring (this.name.lastIndexOf ("d")+1, this.name.lastIndexOf ("_")) ); + } + // Set tab function when user clicks tab. tabObject.onPress = function (event) { // Click the tab button to toggle visibility of its list. guiToggle ( "snStatusPaneCommandGroup" + this.name.substring (this.name.lastIndexOf ("d")+1, this.name.lastIndexOf ("_")) ); - } + } break; } - tabObject.tooltip = tooltip; // Get group. groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter); diff --git a/binaries/data/mods/official/gui/test/functions_page_session_status_pane.js b/binaries/data/mods/official/gui/test/functions_page_session_status_pane.js index 102ebc9bf3..76895f020a 100644 --- a/binaries/data/mods/official/gui/test/functions_page_session_status_pane.js +++ b/binaries/data/mods/official/gui/test/functions_page_session_status_pane.js @@ -22,51 +22,50 @@ function refreshStatusPane() } // Update hitpoint bar. - if ( (shouldUpdateStat ( "traits.health.max" ) || shouldUpdateStat ( "traits.health.curr" )) ) + if ( selectionChanged || shouldUpdateStat ( "traits.health.max" ) || shouldUpdateStat ( "traits.health.curr" ) ) { - guiObject = getGUIObjectByName ("snStatusPaneHealthBar"); + barObject = getGUIObjectByName ("snStatusPaneHealthBar"); + textObject = getGUIObjectByName ("snStatusPaneHealthBarText"); if (selection[0].traits.health.max && selection[0].traits.health.max != 0) { - guiObject.caption = (selection[0].traits.health.curr * 100) / selection[0].traits.health.max; - guiObject.hidden = false; + barObject.caption = (selection[0].traits.health.curr * 100) / selection[0].traits.health.max; + barObject.hidden = false; + textObject.caption = "[font=verdana8][color=white]" + selection[0].traits.health.curr + "[/color][/font]"; } else { - guiObject.hidden = true; + barObject.hidden = true; + textObject.caption = ""; } - // Update text. - getGUIObjectByName ("snStatusPaneHealthBarText").caption = - "[font=verdana8][color=white]" + selection[0].traits.health.curr + "[/color][/font]"; } // Update stamina bar. - if ( (shouldUpdateStat ( "traits.stamina.max" ) || shouldUpdateStat ( "traits.stamina.curr" )) ) + if ( selectionChanged || shouldUpdateStat ( "traits.stamina.max" ) || shouldUpdateStat ( "traits.stamina.curr" ) ) { - guiObject = getGUIObjectByName ("snStatusPaneStaminaBar"); + barObject = getGUIObjectByName ("snStatusPaneStaminaBar"); + textObject = getGUIObjectByName ("snStatusPaneStaminaBarText"); if (selection[0].traits.stamina.max && selection[0].traits.stamina.max != 0) { - guiObject.caption = (selection[0].traits.stamina.curr * 100) / selection[0].traits.stamina.max; - guiObject.hidden = false; + barObject.caption = (selection[0].traits.stamina.curr * 100) / selection[0].traits.stamina.max; + barObject.hidden = false; + textObject.caption = "[font=verdana8][color=white]" + selection[0].traits.stamina.curr + "[/color][/font]"; } else { - guiObject.hidden = true; + barObject.hidden = true; + textObject.caption = ""; } - // Update text. - getGUIObjectByName ("snStatusPaneStaminaBarText").caption = - "[font=verdana8][color=white]" + selection[0].traits.stamina.curr + "[/color][/font]"; } // Update unit text panel. if ( shouldUpdateStat ("player") || shouldUpdateStat ( "traits.id.civ" ) || shouldUpdateStat ( "traits.id.generic" ) || shouldUpdateStat ( "traits.id.specific" ) ) { textCaption = ""; - // (Is there some way to grab the player colour RGB values? It'd be good if we could put the player name in player colour.) - textCaption += "[font=verdana10][color=white]" + getCurrItemValue ("pgProfileName") + "[/color][/font]\n"; +textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getColour().r*255) + ' ' + Math.round(selection[0].player.getColour().g*255) + ' ' + Math.round(selection[0].player.getColour().b*255) + '"]' + selection[0].player.name + '[/color][/font]\n'; textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.civ + "[/color][/font]\n"; textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.specific + "[/color][/font]\n"; - textCaption += "[font=optimus12][color=gold]" + selection[0].traits.id.generic + "[/color][/font]\n"; - + textCaption += "[font=optimus12][color=gold]" + selection[0].traits.id.generic + "[/color][/font]"; +console.write (textCaption); getGUIObjectByName ("snStatusPaneText").caption = textCaption; }