From c9250bd415fdd15dee884d915a9402e92e7fb667 Mon Sep 17 00:00:00 2001 From: Acumen Date: Fri, 3 Mar 2006 00:02:01 +0000 Subject: [PATCH] GUI Updates: * Implemented Jason's new tabs for portraits. Shuffled buttons around a bit. * Started on Status Pane elements ... portrait, health and stamina bars, garrison and supply counters, and descriptive text. This was SVN commit r3585. --- .../ui/session/icons/bkg/portrait_black.dds | 3 + .../template_gaia_flora_bush_berry.xml | 3 +- .../entities/template_gaia_flora_tree.xml | 3 +- .../entities/template_gaia_geo_mineral.xml | 3 + .../entities/template_gaia_geo_rock.xml | 4 +- .../template_structure_gaia_settlement.xml | 4 +- .../official/entities/template_unit_fauna.xml | 3 + .../data/mods/official/gui/test/4_session.xml | 101 ++- .../gui/test/functions_page_session.js | 6 +- .../functions_page_session_status_commands.js | 23 +- .../functions_page_session_status_pane.js | 117 ++++ .../data/mods/official/gui/test/setup.xml | 166 +++-- .../data/mods/official/gui/test/sprite1.xml | 662 +++++++++--------- .../data/mods/official/gui/test/styles.xml | 16 + 14 files changed, 700 insertions(+), 414 deletions(-) create mode 100644 binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait_black.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait_black.dds b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait_black.dds new file mode 100644 index 0000000000..467089d853 --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait_black.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea92978b3dc3233755ed80552955e5f7e9b3e27f60d9fdfcce6ae6b10e0e9f3a +size 16512 diff --git a/binaries/data/mods/official/entities/template_gaia_flora_bush_berry.xml b/binaries/data/mods/official/entities/template_gaia_flora_bush_berry.xml index 056a9f0ed4..53c6145348 100644 --- a/binaries/data/mods/official/entities/template_gaia_flora_bush_berry.xml +++ b/binaries/data/mods/official/entities/template_gaia_flora_bush_berry.xml @@ -11,7 +11,8 @@ Berry Bush Berry Bush - flora_deciduotree + PortraitSheetTree + 2 Resource diff --git a/binaries/data/mods/official/entities/template_gaia_flora_tree.xml b/binaries/data/mods/official/entities/template_gaia_flora_tree.xml index 551092c3b6..f2c1fb75ac 100644 --- a/binaries/data/mods/official/entities/template_gaia_flora_tree.xml +++ b/binaries/data/mods/official/entities/template_gaia_flora_tree.xml @@ -11,7 +11,8 @@ Tree - flora_deciduotree + PortraitSheetTree + 0 Tree, Resource diff --git a/binaries/data/mods/official/entities/template_gaia_geo_mineral.xml b/binaries/data/mods/official/entities/template_gaia_geo_mineral.xml index 97005ea1f1..f6913bdd94 100644 --- a/binaries/data/mods/official/entities/template_gaia_geo_mineral.xml +++ b/binaries/data/mods/official/entities/template_gaia_geo_mineral.xml @@ -9,6 +9,9 @@ Mineral + + PortraitSheetRock + 1 Mineral diff --git a/binaries/data/mods/official/entities/template_gaia_geo_rock.xml b/binaries/data/mods/official/entities/template_gaia_geo_rock.xml index a1b121281f..54452fbf28 100644 --- a/binaries/data/mods/official/entities/template_gaia_geo_rock.xml +++ b/binaries/data/mods/official/entities/template_gaia_geo_rock.xml @@ -9,9 +9,11 @@ Rock - Rock + PortraitSheetRock + 0 + Rock A lump of hard common mineral. It can be mined to provide stone building material. diff --git a/binaries/data/mods/official/entities/template_structure_gaia_settlement.xml b/binaries/data/mods/official/entities/template_structure_gaia_settlement.xml index beb31fdea0..ee0149080b 100644 --- a/binaries/data/mods/official/entities/template_structure_gaia_settlement.xml +++ b/binaries/data/mods/official/entities/template_structure_gaia_settlement.xml @@ -9,10 +9,12 @@ Gaia Building - Settlement Gaia + + PortraitSheetSpecial + 1 Building, Gaia, Special, Settlement diff --git a/binaries/data/mods/official/entities/template_unit_fauna.xml b/binaries/data/mods/official/entities/template_unit_fauna.xml index a88dccf082..d622da8598 100644 --- a/binaries/data/mods/official/entities/template_unit_fauna.xml +++ b/binaries/data/mods/official/entities/template_unit_fauna.xml @@ -11,6 +11,9 @@ Fauna Gaia + + PortraitSheetAnimal + 0 Gaia, Fauna diff --git a/binaries/data/mods/official/gui/test/4_session.xml b/binaries/data/mods/official/gui/test/4_session.xml index 5ec1940b3e..85036a269d 100644 --- a/binaries/data/mods/official/gui/test/4_session.xml +++ b/binaries/data/mods/official/gui/test/4_session.xml @@ -233,7 +233,7 @@ hotkey="selection.snap" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binaries/data/mods/official/gui/test/functions_page_session.js b/binaries/data/mods/official/gui/test/functions_page_session.js index c2dbaf0bd3..9d87817c18 100644 --- a/binaries/data/mods/official/gui/test/functions_page_session.js +++ b/binaries/data/mods/official/gui/test/functions_page_session.js @@ -172,7 +172,11 @@ function initCellReference() addCell (groupName, "structciv", "Construct Civic Buildings"); addCell (groupName, "structmil", "Construct Military Buildings"); addCell (groupName, "train", "Train"); - addCell (groupName, "research", "Research"); + addCell (groupName, "research", "Research"); + addCell (groupName, "barter", "Barter"); + addCell (groupName, "allegiance", "Allegiance"); + addCell (groupName, "selection", "Selection"); + addCell (groupName, "garrison", "Garrison"); addCell (groupName, "command", "Command"); // Define the cells in this icon sheet. 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 1b32acaaa8..3f3ce2056c 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 @@ -47,7 +47,7 @@ function defineCommandButtons(command) { if (listLoop == 1) { - var x = currCrd.coord[rb].x+currCrd.coord[rb].width; + var x = currCrd.coord[rb].x+currCrd.coord[rb].width-14; if (tabLoop == snStatusPaneCommand.split && listLoop == 1) var y = currCrd.coord[rb].y; @@ -70,9 +70,9 @@ function defineCommandButtons(command) var x = currCrd.coord[rb].x; else var x = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width - +snStatusPaneCommand.span;; + +snStatusPaneCommand.span; - var y = currCrd.coord[rb].y+currCrd.coord[rb].height; + var y = currCrd.coord[rb].y+currCrd.coord[rb].height-7; } else { @@ -352,11 +352,11 @@ console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet + function refreshCommandButtons() { - if ( selection[0].actions && shouldUpdateStat ( "actions" ) ) + // Reset button counter. + tabCounter = 1; + + if ( selectionChanged && selection[0].actions && shouldUpdateStat ("actions") ) { - // Reset button counter. - tabCounter = 1; - // Update production lists (both types of Construction, Train). (Tab button, persistent buttons, click them to do things.) listRoot = selection[0].actions.create.list; for (listTab in listRoot) @@ -394,8 +394,15 @@ function refreshCommandButtons() // End of commands. Store end position. commandCounter = tabCounter; } + else + { + console.write ("No buttons"); + // Ensure tabs should be cleanable. + listCounter = 1; + commandCounter = snStatusPaneCommand.split-1; + } - if (listCounter > 0 && commandCounter > 0) + if ( selectionChanged ) { // Clear remaining buttons between the lists and commands. for (commandClearLoop = listCounter; commandClearLoop <= snStatusPaneCommand.split-1; commandClearLoop++) 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 3db036028d..94e3168f7b 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 @@ -14,7 +14,124 @@ function refreshStatusPane() setPortrait ("snStatusPanePortrait", selection[0].traits.id.icon, toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell); } + + // Update portrait tooltip. + if ( shouldUpdateStat ( "traits.id.generic" ) ) + { + getGUIObjectByName ("snStatusPanePortrait").tooltip = selection[0].traits.id.generic; + } + + // Update hitpoint bar. + if ( (shouldUpdateStat ( "traits.health.max" ) || shouldUpdateStat ( "traits.health.curr" )) ) + { + guiObject = getGUIObjectByName ("snStatusPaneHealthBar"); + 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; + } + else + { + guiObject.hidden = true; + } +console.write ("Updated hitpoints"); + } + + // Update stamina bar. + if ( (shouldUpdateStat ( "traits.stamina.max" ) || shouldUpdateStat ( "traits.stamina.curr" )) ) + { + guiObject = getGUIObjectByName ("snStatusPaneStaminaBar"); + 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; + } + else + { + guiObject.hidden = true; + } +console.write ("Updated stamina"); + } + + // 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=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"; + getGUIObjectByName ("snStatusPaneText").caption = textCaption; + } + + // Update rank icon. + if ( shouldUpdateStat ( "traits.promotion" ) ) + { + rankObject = getGUIObjectByName ("snStatusPaneRank"); + + // Don't show a rank icon for Basic or unranked units. + if (selection[0].traits.promotion.rank > 1) + { + rankObject.cell_id = selection[0].traits.promotion.rank-2; + rankObject.tooltip = "Next Promotion: " + selection[0].traits.promotion.curr + "/" + selection[0].traits.promotion.req; + rankObject.hidden = false; + } + else + rankObject.hidden = true; + } + + // Update garrison capacity. + if( shouldUpdateStat( "traits.garrison" ) ) + { + // Update Supply/Garrison + guiObject = getGUIObjectByName("snStatusPaneGarrison"); + guiObject.caption = ''; + + if (selection[0].traits.garrison) + { + if (selection[0].traits.garrison.curr && selection[0].traits.garrison.max) + { + guiObject.caption += '[color="blue"]' + selection[0].traits.garrison.curr + '/' + selection[0].traits.garrison.max + '[/color] '; + } + guiObject.hidden = false; + getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = false; + } + else + { + guiObject.hidden = true; + getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = true; + } + } + if( shouldUpdateStat( "traits.supply" ) ) + { + guiObject = getGUIObjectByName("snStatusPaneSupply"); + guiObject.caption = ''; + + if (selection[0].traits.supply) + { + if (selection[0].traits.supply.curr && selection[0].traits.supply.max && selection[0].traits.supply.type) + { + // Set resource icon. + getGUIObjectByName ("snStatusPaneSupplyIcon").cell_id = cellGroup["Resource"][selection[0].traits.supply.type]; + // Special case for infinity. + if (selection[0].traits.supply.curr == "0" && selection[0].traits.supply.max == "0") + guiObject.caption += '[color="brown"] [icon="iconInfinity"] [/color] '; + else + guiObject.caption += '[color="brown"]' + selection[0].traits.supply.curr + '/' + selection[0].traits.supply.max + '[/color] '; + } + guiObject.hidden = false; + getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = false; + } + else + { + guiObject.hidden = true; + getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = true; + } + } + + // Refresh command buttons. if( shouldUpdateStat( "actions" ) ) refreshCommandButtons(); } diff --git a/binaries/data/mods/official/gui/test/setup.xml b/binaries/data/mods/official/gui/test/setup.xml index 30140a772a..58b4af5b89 100755 --- a/binaries/data/mods/official/gui/test/setup.xml +++ b/binaries/data/mods/official/gui/test/setup.xml @@ -87,8 +87,102 @@ cell_id="4" size="30 30" /> + + + + + + + + + + + + + + + + 0 0 0 + + + 237 227 167 + + + 255 255 255 + + + 243 242 240 + + + 43 42 40 + + + 0 0 255 + + + 0 200 0 + + + 191 191 2 + + + 159 98 24 + + + - - - - - - - - - - - - - - - 0 0 0 - - - 237 227 167 - - - 255 255 255 - - - 243 242 240 - - - 0 0 255 - - diff --git a/binaries/data/mods/official/gui/test/sprite1.xml b/binaries/data/mods/official/gui/test/sprite1.xml index 1984aae6dc..3dcdd4625a 100644 --- a/binaries/data/mods/official/gui/test/sprite1.xml +++ b/binaries/data/mods/official/gui/test/sprite1.xml @@ -2,16 +2,8 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - @@ -716,72 +776,33 @@ --> + - - - - - - - - + - - - - - - - - + - - - - - - - - + - - - - - - - - + - - - - - - - - + - - - - - - - - @@ -866,71 +848,32 @@ --> + - - - - - - - - + - - - - - - - - + - - - - - - - - @@ -941,71 +884,32 @@ --> + - - - - - - - - + size="2 2 100%-2 100%-2" + /> + - - - - - - - - + size="2 2 100%-2 100%-2" + /> + - - - - - - - - @@ -1016,71 +920,32 @@ --> + - - - - - - - - + size="2 2 100%-2 100%-2" + /> + - - - - - - - - + - - - - - - - - @@ -1091,73 +956,214 @@ --> + - - - - - - - - + size="2 2 100%-2 100%-2" + /> + - - - - - - - - + size="2 2 100%-2 100%-2" + /> + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - @@ -1703,7 +1709,7 @@ - @@ -1713,7 +1719,7 @@ - @@ -1723,7 +1729,7 @@ - diff --git a/binaries/data/mods/official/gui/test/styles.xml b/binaries/data/mods/official/gui/test/styles.xml index bd9b68f758..e37ddba924 100755 --- a/binaries/data/mods/official/gui/test/styles.xml +++ b/binaries/data/mods/official/gui/test/styles.xml @@ -501,6 +501,22 @@ text_align="left" text_valign="top" /> + +