From 6c67e84ecdb71883b4841664baf444d668df7e54 Mon Sep 17 00:00:00 2001 From: Acumen Date: Sat, 4 Mar 2006 00:20:09 +0000 Subject: [PATCH] * Added player colour to player name, using Matei's new getColour() function. * Used the actual player names instead of sharing the profile name (though the default names are a bit lengthy and extend off the UI; need to figure out how to change those during game setup using each player's profile name). * Fixed health/stamina bug. * Added an onMouseEnter() event for tabs at Matei's suggestion (so the tabs will open simply by getting the cursor in proximity, instead of needing two clicks). This was SVN commit r3592. --- .../gui/test/functions_page_pregame_load.js | 2 +- .../functions_page_session_status_commands.js | 35 ++++++++++------- .../functions_page_session_status_pane.js | 39 +++++++++---------- 3 files changed, 40 insertions(+), 36 deletions(-) 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; }