From 268584d177bbfeb74e8582511cbca0e9c2d347a6 Mon Sep 17 00:00:00 2001 From: Acumen Date: Mon, 27 Feb 2006 23:37:43 +0000 Subject: [PATCH] Initial commit of GUI changes. You're not liable to see much difference (in fact, there's probably less functionality than there used to be). This is mostly to commit the new icon sheets so Jason can commit changes directly if he prefers, and because I'm about to get back onto fixing the command lists (not necessarily ones that actually do things when you click them, but at least get them updating properly on the screen for Matei), and want to commit a semi-usable update before I potentially break it all again. This was SVN commit r3571. --- .../{snCounterEdge.dds => counter_edge.dds} | 0 .../{snCounterTile.dds => counter_tile.dds} | 0 .../bkg/banner.dds} | 0 .../textures/ui/session/icons/bkg/command.dds | 3 + .../ui/session/icons/bkg/portrait.dds | 3 + .../bkg/statistic.dds} | 0 .../art/textures/ui/session/icons/bkg/tab.dds | 3 + .../ui/session/icons/icon_sheet_resource.dds | 3 - .../session/icons/ui_icon_sheet_statistic.dds | 3 - .../cart.dds} | 0 .../celt.dds} | 0 .../gaia_animal.dds} | 0 .../ui/session/portraits/sheets/gaia_rock.dds | 3 + .../session/portraits/sheets/gaia_special.dds | 3 + .../ui/session/portraits/sheets/gaia_tree.dds | 3 + .../hele.dds} | 0 .../iber.dds} | 0 .../pers.dds} | 0 .../rome.dds} | 0 .../ui/session/portraits/sheets/tech.dds | 3 + .../ui_portrait_flora_deciduotree_gaia.dds | 3 - .../portraits/ui_portrait_sheet_action.dds | 3 - .../portraits/ui_portrait_unit_dude.dds | 3 - .../portraits/ui_portrait_unit_dudette.dds | 3 - .../entities/structures/cart_civil_centre.xml | 4 +- .../entities/structures/celt_civil_centre.xml | 4 +- .../entities/structures/hele_civil_centre.xml | 4 +- .../entities/structures/iber_civil_centre.xml | 4 +- .../entities/structures/pers_civil_centre.xml | 4 +- .../entities/structures/rome_civil_centre.xml | 4 +- .../official/entities/template_structure.xml | 2 +- .../template_structure_civic_civil_centre.xml | 8 +- .../mods/official/entities/template_unit.xml | 2 +- .../data/mods/official/gui/test/4_session.xml | 234 ++- .../mods/official/gui/test/6_1_manual.xml | 2 +- .../gui/test/functions_page_session.js | 233 ++- .../gui/test/functions_page_session_manual.js | 2 +- .../functions_page_session_status_commands.js | 502 +++-- .../functions_page_session_status_pane.js | 2 +- .../official/gui/test/functions_sim_player.js | 37 +- .../official/gui/test/functions_utility.js | 4 +- .../data/mods/official/gui/test/setup.xml | 20 +- .../data/mods/official/gui/test/sprite1.xml | 1849 +++++++++++++---- .../data/mods/official/gui/test/styles.xml | 23 +- binaries/system/Atlas.bat | 1 + binaries/system/RebuildRandomMaps.bat | 2 + 46 files changed, 2122 insertions(+), 864 deletions(-) rename binaries/data/mods/official/art/textures/ui/session/{snCounterEdge.dds => counter_edge.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/{snCounterTile.dds => counter_tile.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/{portraits/ui_portrait_default_square.dds => icons/bkg/banner.dds} (100%) create mode 100644 binaries/data/mods/official/art/textures/ui/session/icons/bkg/command.dds create mode 100644 binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait.dds rename binaries/data/mods/official/art/textures/ui/session/{portraits/ui_portrait_default_circle.dds => icons/bkg/statistic.dds} (100%) create mode 100644 binaries/data/mods/official/art/textures/ui/session/icons/bkg/tab.dds delete mode 100644 binaries/data/mods/official/art/textures/ui/session/icons/icon_sheet_resource.dds delete mode 100644 binaries/data/mods/official/art/textures/ui/session/icons/ui_icon_sheet_statistic.dds rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_civ_cart.dds => sheets/cart.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_civ_celt.dds => sheets/celt.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_tech_gen.dds => sheets/gaia_animal.dds} (100%) create mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_rock.dds create mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_special.dds create mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_tree.dds rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_civ_hele.dds => sheets/hele.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_civ_iber.dds => sheets/iber.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_civ_pers.dds => sheets/pers.dds} (100%) rename binaries/data/mods/official/art/textures/ui/session/portraits/{ui_portrait_sheet_civ_rome.dds => sheets/rome.dds} (100%) create mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/sheets/tech.dds delete mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_flora_deciduotree_gaia.dds delete mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_action.dds delete mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dude.dds delete mode 100644 binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dudette.dds create mode 100644 binaries/system/Atlas.bat create mode 100644 binaries/system/RebuildRandomMaps.bat diff --git a/binaries/data/mods/official/art/textures/ui/session/snCounterEdge.dds b/binaries/data/mods/official/art/textures/ui/session/counter_edge.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/snCounterEdge.dds rename to binaries/data/mods/official/art/textures/ui/session/counter_edge.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/snCounterTile.dds b/binaries/data/mods/official/art/textures/ui/session/counter_tile.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/snCounterTile.dds rename to binaries/data/mods/official/art/textures/ui/session/counter_tile.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_default_square.dds b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/banner.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_default_square.dds rename to binaries/data/mods/official/art/textures/ui/session/icons/bkg/banner.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/icons/bkg/command.dds b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/command.dds new file mode 100644 index 0000000000..aa72466517 --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/command.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dd170240495cd13dc8f271bba2d653be3e030b276617a1664dfe5d2db95f0d2 +size 87536 diff --git a/binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait.dds b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait.dds new file mode 100644 index 0000000000..f11c1372d6 --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/portrait.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e30281003e27cb746682a20842ec8a8d4934c435527b9937ba687ba3c108696 +size 2176 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_default_circle.dds b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/statistic.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_default_circle.dds rename to binaries/data/mods/official/art/textures/ui/session/icons/bkg/statistic.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/icons/bkg/tab.dds b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/tab.dds new file mode 100644 index 0000000000..1a48eb270e --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/icons/bkg/tab.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdc76899c964c709499defae222aab8278320496525d0ed31952bbf0ff33f7f8 +size 5616 diff --git a/binaries/data/mods/official/art/textures/ui/session/icons/icon_sheet_resource.dds b/binaries/data/mods/official/art/textures/ui/session/icons/icon_sheet_resource.dds deleted file mode 100644 index 332f4a0064..0000000000 --- a/binaries/data/mods/official/art/textures/ui/session/icons/icon_sheet_resource.dds +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c8880f4829285e8afb16f364f8d8d62612d22c29e962622290ddaa6d01c1c749 -size 87568 diff --git a/binaries/data/mods/official/art/textures/ui/session/icons/ui_icon_sheet_statistic.dds b/binaries/data/mods/official/art/textures/ui/session/icons/ui_icon_sheet_statistic.dds deleted file mode 100644 index 2af404fd01..0000000000 --- a/binaries/data/mods/official/art/textures/ui/session/icons/ui_icon_sheet_statistic.dds +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d0ecf6e96f0d2137831f352e1d12e701d1e22fe69e701f3786e9f5c89f6693c3 -size 262272 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_cart.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/cart.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_cart.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/cart.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_celt.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/celt.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_celt.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/celt.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_tech_gen.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_animal.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_tech_gen.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_animal.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_rock.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_rock.dds new file mode 100644 index 0000000000..ecbf32df7b --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_rock.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5cf857858e3fa5677f9b528d07e299d865fe75b1b6084e4310cd1728c87cb03 +size 65664 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_special.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_special.dds new file mode 100644 index 0000000000..ecbf32df7b --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_special.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5cf857858e3fa5677f9b528d07e299d865fe75b1b6084e4310cd1728c87cb03 +size 65664 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_tree.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_tree.dds new file mode 100644 index 0000000000..ecbf32df7b --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/gaia_tree.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5cf857858e3fa5677f9b528d07e299d865fe75b1b6084e4310cd1728c87cb03 +size 65664 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_hele.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/hele.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_hele.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/hele.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_iber.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/iber.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_iber.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/iber.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_pers.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/pers.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_pers.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/pers.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_rome.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/rome.dds similarity index 100% rename from binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_civ_rome.dds rename to binaries/data/mods/official/art/textures/ui/session/portraits/sheets/rome.dds diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/tech.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/tech.dds new file mode 100644 index 0000000000..ecbf32df7b --- /dev/null +++ b/binaries/data/mods/official/art/textures/ui/session/portraits/sheets/tech.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5cf857858e3fa5677f9b528d07e299d865fe75b1b6084e4310cd1728c87cb03 +size 65664 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_flora_deciduotree_gaia.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_flora_deciduotree_gaia.dds deleted file mode 100644 index d70f274daa..0000000000 --- a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_flora_deciduotree_gaia.dds +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9ff4a4395b686bcc6dd1c7c8167f95910f78afe94882fefb7e005c8858520120 -size 4224 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_action.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_action.dds deleted file mode 100644 index 282aa8038a..0000000000 --- a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_sheet_action.dds +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c06ab9dce6f620e87cb4f9cb557cbb3e66728b55061f699f84e99d3aedd8c6ef -size 349680 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dude.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dude.dds deleted file mode 100644 index 512bf702a0..0000000000 --- a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dude.dds +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c4b216485dc40014ae49a82a6adb87cd6134a3dd08c3e17ece2a8ed694e7510d -size 4224 diff --git a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dudette.dds b/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dudette.dds deleted file mode 100644 index c2aab60764..0000000000 --- a/binaries/data/mods/official/art/textures/ui/session/portraits/ui_portrait_unit_dudette.dds +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dc6c7902f00fbb96c710add83e1d0b0afaf5bf30eb4bb270a71fdc744580f441 -size 4224 diff --git a/binaries/data/mods/official/entities/structures/cart_civil_centre.xml b/binaries/data/mods/official/entities/structures/cart_civil_centre.xml index 15c7cae374..5663970327 100644 --- a/binaries/data/mods/official/entities/structures/cart_civil_centre.xml +++ b/binaries/data/mods/official/entities/structures/cart_civil_centre.xml @@ -18,11 +18,11 @@ - + - + diff --git a/binaries/data/mods/official/entities/structures/celt_civil_centre.xml b/binaries/data/mods/official/entities/structures/celt_civil_centre.xml index 673258aa4f..74fe7cadf4 100644 --- a/binaries/data/mods/official/entities/structures/celt_civil_centre.xml +++ b/binaries/data/mods/official/entities/structures/celt_civil_centre.xml @@ -22,11 +22,11 @@ - + - + diff --git a/binaries/data/mods/official/entities/structures/hele_civil_centre.xml b/binaries/data/mods/official/entities/structures/hele_civil_centre.xml index 9f42a81fc2..8ab09a2eb4 100644 --- a/binaries/data/mods/official/entities/structures/hele_civil_centre.xml +++ b/binaries/data/mods/official/entities/structures/hele_civil_centre.xml @@ -20,11 +20,11 @@ - + - + diff --git a/binaries/data/mods/official/entities/structures/iber_civil_centre.xml b/binaries/data/mods/official/entities/structures/iber_civil_centre.xml index 00a3c1b939..850da6a779 100644 --- a/binaries/data/mods/official/entities/structures/iber_civil_centre.xml +++ b/binaries/data/mods/official/entities/structures/iber_civil_centre.xml @@ -20,11 +20,11 @@ - + - + diff --git a/binaries/data/mods/official/entities/structures/pers_civil_centre.xml b/binaries/data/mods/official/entities/structures/pers_civil_centre.xml index d819986c51..2d212a0f6f 100644 --- a/binaries/data/mods/official/entities/structures/pers_civil_centre.xml +++ b/binaries/data/mods/official/entities/structures/pers_civil_centre.xml @@ -22,11 +22,11 @@ - + - + diff --git a/binaries/data/mods/official/entities/structures/rome_civil_centre.xml b/binaries/data/mods/official/entities/structures/rome_civil_centre.xml index c88dca060d..cc74fe34c7 100644 --- a/binaries/data/mods/official/entities/structures/rome_civil_centre.xml +++ b/binaries/data/mods/official/entities/structures/rome_civil_centre.xml @@ -22,11 +22,11 @@ - + - + diff --git a/binaries/data/mods/official/entities/template_structure.xml b/binaries/data/mods/official/entities/template_structure.xml index ae2ec52730..2705492bf8 100644 --- a/binaries/data/mods/official/entities/template_structure.xml +++ b/binaries/data/mods/official/entities/template_structure.xml @@ -11,7 +11,7 @@ Structure - sheet_civ + PortraitSheet Structure diff --git a/binaries/data/mods/official/entities/template_structure_civic_civil_centre.xml b/binaries/data/mods/official/entities/template_structure_civic_civil_centre.xml index d81953beb2..130e109c5a 100644 --- a/binaries/data/mods/official/entities/template_structure_civic_civil_centre.xml +++ b/binaries/data/mods/official/entities/template_structure_civic_civil_centre.xml @@ -56,12 +56,12 @@ - + - - + + - + 1 diff --git a/binaries/data/mods/official/entities/template_unit.xml b/binaries/data/mods/official/entities/template_unit.xml index fd875d41a5..8fe678741c 100644 --- a/binaries/data/mods/official/entities/template_unit.xml +++ b/binaries/data/mods/official/entities/template_unit.xml @@ -12,7 +12,7 @@ Unit - sheet_civ + PortraitSheet Unit diff --git a/binaries/data/mods/official/gui/test/4_session.xml b/binaries/data/mods/official/gui/test/4_session.xml index 7dee65ce2d..faff2b8025 100644 --- a/binaries/data/mods/official/gui/test/4_session.xml +++ b/binaries/data/mods/official/gui/test/4_session.xml @@ -201,7 +201,7 @@ // resource is updated, so at this point we don't sweat that they have the same // coordinates). addCrds (tempName, 50, 0, -200, 4, - snConst.MiniIcon.Width+54, snConst.MiniIcon.Height+5); + snConst.MiniIcon.Width+54, snConst.MiniIcon.Height-10+5); } ]]> @@ -228,7 +228,7 @@ ]]> @@ -249,165 +249,175 @@ - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + = snStatusPaneCommand.split) @@ -95,114 +83,268 @@ function defineCommandButtons(command) } // Define dimensions of list buttons. - addCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, rb, 0, 100, x, y, + addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop, 0, 100, x, y, snConst.Portrait.Sml.Width, snConst.Portrait.Sml.Height); - addCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, lb, 100, 100); - addCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, lt, 100, 0); - addCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, rt, 0, 0); - - // Set array affected when button pressed. - tempListObject.onPress = function (event) - { - pressCommandButton(this); - } +/* + // Store indexes to the button for easy future reference. + Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].tab = tabLoop; + Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].list = listLoop; + // Create quantity and entity for create lists for future use. + Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].entity = ""; + Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].quantity = 0; +*/ } } } // ==================================================================== -function UpdateList(listIcon, listCol) +function updateList (listTab, listGroup) { - // Populates a given column of command icons with appropriate build portraits for the selected object. - // Returns an array of this selection. - - // Build unit list. - if ( selection[0].traits.id.civ_code - && selection[0].actions - && selection[0].actions.create - && selection[0].actions.create.list ) + // If any items in the list (construction, train, research, etc, need to be updated, update that list.) + if ( shouldUpdateStat (listGroup) ) { - list = null; - - switch (listIcon) + // Get tab. + tabObject = getGUIObjectByName ("snStatusPaneCommand" + listCounter + "_1"); + groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + listCounter); + // Enable tab. + guiUnHide (tabObject.name); + // Set tab portrait. + setPortrait ("snStatusPaneCommand" + listCounter + "_1", "IconSheet", "TabButton", cellGroup["Tab"][listTab].id); + tooltip = cellGroup["Tab"][listTab].name; + tooltip += " Tab"; + tabObject.tooltip = tooltip; + // Set tab function. + tabObject.onPress = function (event) { - case action_tab_train: - if ( selection[0].actions.create.list.unit && shouldUpdateStat( "actions.create.list.unit" ) ) - list = selection[0].actions.create.list.unit; - break; - case action_tab_buildciv: - if ( selection[0].actions.create.list.structciv && shouldUpdateStat( "actions.create.list.structciv" ) ) - list = selection[0].actions.create.list.structciv; - break; - case action_tab_buildmil: - if ( selection[0].actions.create.list.structmil && shouldUpdateStat( "actions.create.list.structmil" ) ) - list = selection[0].actions.create.list.structmil; - break; - case action_tab_research: - if ( selection[0].actions.create.list.tech && shouldUpdateStat( "actions.create.list.tech" ) ) - list = selection[0].actions.create.list.tech; - break; - default: - return 0; - break; + // Click the tab button to toggle visibility of its list. + guiToggle ( "snStatusPaneCommandGroup" + this.name.substring (this.name.lastIndexOf ("d")+1, this.name.lastIndexOf ("_")) ); } - if ( list ) + // If the list hasn't been hidden (tab is open), + if ( groupObject.hidden == false ) { - // Enable tab portrait. - guiUnHide("snStatusPaneCommand" + "Group" + listCol); - guiUnHide("snStatusPaneCommand" + listCol + "_1"); - setPortrait("snStatusPaneCommand" + listCol + "_1", "sheet_action", "", listIcon); - // Reset list length. - snStatusPaneCommand[listCol][1].last = 0; - // Store content info in tab button for future reference. - snStatusPaneCommand[listCol][1].type = "list"; - + // Extract entity list into an array. listArray = []; - for( i in list ) + for ( i in listGroup ) { - listArray[listArray.length] = i.toString(); + listArray[listArray.length] = i; + // Store any current quantity in the queue for this object. +// if (listGroup[i].quantity) +// listArray[listArray.length].quantity = listGroup[i].quantity; } - // Populate appropriate command buttons. + // Populate the buttons in this tab's list. for (createLoop = 1; createLoop < snStatusPaneCommand.list.max; createLoop++) { if (createLoop < listArray.length) { + // Get name of current button. + listObject = getGUIObjectByName ("snStatusPaneCommand" + listCounter + "_" + (createLoop+1)); + // Get name of entity to display in list. - UpdateListEntityName = selection[0].traits.id.civ_code + "_" + listArray[createLoop]; + updateListEntityName = selection[0].traits.id.civ_code + "_" + listArray[createLoop]; - getGUIObjectByName ("snStatusPaneCommand" + listCol + "_" + (createLoop+1)).caption = ""; + // Store name of entity to display in list in this button's coordinate. +// Crd[getCrd (listObject.name, true)].entity = new Object(updateListEntityName); - guiUnHide("snStatusPaneCommand" + listCol + "_" + (createLoop+1)); - setPortrait("snStatusPaneCommand" + listCol + "_" + (createLoop+1), - getEntityTemplate(UpdateListEntityName).traits.id.icon, - selection[0].traits.id.civ_code, - getEntityTemplate(UpdateListEntityName).traits.id.icon_cell); + // Set tooltip. + listObject.tooltip = getEntityTemplate(updateListEntityName).traits.id.civ + " " + getEntityTemplate(updateListEntityName).traits.id.generic; - // Store content info in tab button for future reference. - snStatusPaneCommand[listCol][createLoop+1].name = listIcon; - snStatusPaneCommand[listCol][createLoop+1].object = listArray[createLoop]; - snStatusPaneCommand[listCol][createLoop+1].type = "list"; - snStatusPaneCommand[listCol][createLoop+1].last++; + // Create quantity container in entity's create list if necessary. +// if (!listGroup[listArray[createLoop]].quantity) +// listGroup[listArray[createLoop]].quantity = new Object(0); + // Set caption to counter. +// if (listGroup[listArray[createLoop]].quantity > 1) +// listObject.caption = listGroup[listArray[createLoop]].quantity-1; + // Store pointer to quantity in coordinate. +// Crd[getCrd (listObject.name, true)].quantity = new Object(listGroup[listArray[createLoop]].quantity); + + // Set portrait. + switch (listTab) + { + case "research": + // Skip research list for the moment, since we don't have any portraits for techs. + break; + default: + setPortrait (listObject.name, + getEntityTemplate(updateListEntityName).traits.id.icon, + toTitleCase(selection[0].traits.id.civ_code), + getEntityTemplate(updateListEntityName).traits.id.icon_cell); + break; + } + + // Reveal portrait. + guiUnHide (listObject.name); +/* + // Set function that occurs when the button is pressed (left-clicked). + // (Somehow, we also need to do one for right-clicking -- decrement counter and remove item from queue.) + listObject.onPress = function (event) + { + switch (listTab) + { + case "StructCiv": + case "StructMil": + // Create building placement cursor. + startPlacing (Crd[getCrd (this.name, true)].entity); + break; + default: + // Attempt to add the entry to the queue. + if (attemptAddToBuildQueue (selection[0], Crd[getCrd (this.name, true)].entity, Crd[getCrd (this.name, true)].tab, Crd[getCrd (this.name, true)].list)) +// if (attemptAddToBuildQueue (selection[0], updateListEntityName, tab, list)) + { +// // Create quantity container in entity's create list if necessary. + // if (!listGroup[Crd[getCrd (this.name, true)].list].quantity) + // listGroup[Crd[getCrd (this.name, true)].list].quantity = new Object(0); + // Increment counter. + listGroup[Crd[getCrd (this.name, true)].list].quantity++; + // Set caption to counter. + if (listGroup[Crd[getCrd (this.name, true)].list].quantity > 1) + this.caption = listGroup[Crd[getCrd (this.name, true)].list].quantity-1; + + console.write (this.caption); + } + break; + } + } +*/ } else { - guiHide("snStatusPaneCommand" + listCol + "_" + parseInt(createLoop+1)); + // Conceal this button. + guiHide ("snStatusPaneCommand" + listCounter + "_" + parseInt(createLoop+1)); + // Ensure it doesn't have a stored entity to display in list. +// Crd[getCrd ("snStatusPaneCommand" + listCounter + "_" + parseInt(createLoop+1), true)].entity = ""; + // Ensure it doesn't have a stored quantity of queued items. +// Crd[getCrd ("snStatusPaneCommand" + listCounter + "_" + parseInt(createLoop+1), true)].quantity = 0; } } - return listArray; } + listCounter++; } - - return 0; } // ==================================================================== -function UpdateCommand(listIcon, listCol) +function refreshCommandButtons() +{ + // Set start of tabs. + listCounter = 1; + + if ( selection[0].actions && shouldUpdateStat( "actions" ) ) + { + // Update production lists (Construction, Train, Barter). (Tab button, persistent buttons, click them to do things.) + if ( shouldUpdateStat( "actions.create" ) && shouldUpdateStat( "actions.create.list" ) ) + { + // Everything in this block is tied to properties in + // actions.create.list, the above check should limit the + // number of times this update is needlessly made. + + // Get train/research/build lists by seeking through entity's creation list. + listRoot = selection[0].actions.create.list; + + for (listTab in listRoot) + { + // Note: This check indicates the production lists are updated twice on some occasions. I don't know why (error from shouldUpdate()?). + console.write (listTab + " " + listRoot[listTab]); + if (listTab != "research") // Do research later. + updateList (listTab, listRoot[listTab]); + } + } + + // Update selection lists (formation, stance, trade). (Tab button holds current selection, click a button to select a new option and close the tab.) + + // Update research production list (which should always go last after all the other lists). + if ( shouldUpdateStat( "actions.create" ) && shouldUpdateStat( "actions.create.list" ) + && shouldUpdateStat( "actions.create.list.research" ) && selection[0].actions.create.list.research ) + { + updateList ("research", selection[0].actions.create.list.research); + } + + // Update commands. (Click "tab" button to do something; no list). + + +// This whole section needs to be rewritten (now list of XML attributes instead of semicolon-delimited string). +/* + unitArray = UpdateList(action_tab_train, listCounter); if (unitArray != 0) listCounter++; + structcivArray = UpdateList(action_tab_buildciv, listCounter); if (structcivArray != 0) listCounter++; + structmilArray = UpdateList(action_tab_buildmil, listCounter); if (structmilArray != 0) listCounter++; + techArray = UpdateList(action_tab_research, listCounter); if (techArray != 0) listCounter++; + + formationArray = UpdateList(action_tab_formation, listCounter); if (formationArray != 0) listCounter++; + stanceArray = UpdateList(action_tab_stance, listCounter); if (stanceArray != 0) listCounter++; +*/ + if ( shouldUpdateStat( "actions" ) ) + { + // Update commands. + commandCounter = snStatusPaneCommand.tab.max; +/* + commandCounter = UpdateCommand(cellGroup["Command"]["attack"].id, commandCounter); + commandCounter = UpdateCommand(cellGroup["Command"]["patrol"].id, commandCounter); + commandCounter = UpdateCommand(cellGroup["Command"]["repair"].id, commandCounter); + commandCounter = UpdateCommand(cellGroup["Gather"]["food"].id, commandCounter); + commandCounter = UpdateCommand(cellGroup["Gather"]["wood"].id, commandCounter); + commandCounter = UpdateCommand(cellGroup["Gather"]["stone"].id, commandCounter); + commandCounter = UpdateCommand(cellGroup["Gather"]["ore"].id, commandCounter); +*/ + } + } + + if (listCounter > 0 && commandCounter > 0) + { + // Clear remaining buttons between them. + for (commandClearLoop = listCounter; commandClearLoop <= commandCounter; commandClearLoop++) + { + guiHide ("snStatusPaneCommand" + commandClearLoop + "_1"); + // If this slot could possibly contain a list, hide that too. + guiHide ("snStatusPaneCommand" + "Group" + commandClearLoop); + } + } +/* + // Update production queue. + GUIObject = getGUIObjectByName("snStatusPaneCommandProgress"); + // If the entity has a production item underway, + if ( selection[0].actions.create && selection[0].actions.create.progress + && selection[0].actions.create.progress.valueOf() + && selection[0].actions.create.progress.valueOf().current + && selection[0].actions.create.queue.valueOf() + && selection[0].actions.create.queue.valueOf()[0].traits.creation.time ) + { + + // Set the value of the production progress bar. + GUIObject.caption = ((Math.round(Math.round(selection[0].actions.create.progress.valueOf().current)) * 100 ) / Math.round(selection[0].actions.create.queue.valueOf()[0].traits.creation.time)); + // Set position of progress bar. + GUIObject.size = getGUIObjectByName("snStatusPaneCommand" + selection[0].actions.create.queue.valueOf()[0].tab + "_" + selection[0].actions.create.queue.valueOf()[0].list).size; + // Set progress bar tooltip. +// GUIObject.tooltip = "Training " + selection[0].actions.create.queue.valueOf()[0].traits.id.generic + " ... " + (Math.round(selection[0].actions.create.queue.valueOf()[0].traits.creation.time-Math.round(selection[0].actions.create.progress.valueOf().current)) + " seconds remaining."; + // Reveal progressbar. + GUIObject.hidden = false; + + // Seek through queue. + for( queueEntry = 0; queueEntry < selection[0].actions.create.queue.valueOf().length; queueEntry++) + { + // Update list buttons so that they match the number of entries of that type in the queue. + getGUIObjectByName("snStatusPaneCommand" + selection[0].actions.create.queue.valueOf()[queueEntry].tab + "_" + selection[0].actions.create.queue.valueOf()[queueEntry].list).caption++; + } + } + else + { + // Hide the progress bar. + GUIObject.hidden = true; + GUIObject.tooltip = ""; + } +*/ +} + + +// ==================================================================== + + + +// ==================================================================== + +function UpdateCommand(listIcon, listCounter) { // Similar to UpdateList, but without the list. // Updates a particular command button with a particular action. @@ -223,25 +365,25 @@ function UpdateCommand(listIcon, listCol) ) { // Set appearance of tab. - setPortrait("snStatusPaneCommand" + listCol + "_1", "sheet_action", "", listIcon); - guiUnHide("snStatusPaneCommand" + listCol + "_1"); + setPortrait("snStatusPaneCommand" + listCounter + "_1", "IconSheetCommand", "Button", listIcon); + guiUnHide("snStatusPaneCommand" + listCounter + "_1"); // Hide its list. - guiHide("snStatusPaneCommand" + "Group" + listCol); + guiHide("snStatusPaneCommand" + "Group" + listCounter); // Store content info in tab button for future reference. - snStatusPaneCommand[listCol][1].type = "command"; - snStatusPaneCommand[listCol][1].last = 0; - snStatusPaneCommand[listCol][1].name = listIcon; + snStatusPaneCommand[listCounter][1].type = "command"; + snStatusPaneCommand[listCounter][1].last = 0; + snStatusPaneCommand[listCounter][1].name = listIcon; - return (listCol-1); + return (listCounter-1); } else - return (listCol); + return (listCounter); } // ==================================================================== - +/* function pressCommandButton(commandButton) { // Determine current object, tab, and list from command button name. @@ -305,88 +447,96 @@ console.write (snStatusPaneCommand[tab][list].type); break; } } - -// ==================================================================== - -function refreshCommandButtons() -{ - if( shouldUpdateStat( "actions.create.list" ) ) - { - // Everything in this block is tied to properties in - // actions.create.list, the above check should limit the - // number of times this update is needlessly made. - - // Update train/research/build lists. - listCounter = 1; - -// This whole section needs to be rewritten (now list of XML attributes instead of semicolon-delimited string). - - unitArray = UpdateList(action_tab_train, listCounter); if (unitArray != 0) listCounter++; - structcivArray = UpdateList(action_tab_buildciv, listCounter); if (structcivArray != 0) listCounter++; - structmilArray = UpdateList(action_tab_buildmil, listCounter); if (structmilArray != 0) listCounter++; - techArray = UpdateList(action_tab_research, listCounter); if (techArray != 0) listCounter++; - - formationArray = UpdateList(action_tab_formation, listCounter); if (formationArray != 0) listCounter++; - stanceArray = UpdateList(action_tab_stance, listCounter); if (stanceArray != 0) listCounter++; - } - - if( shouldUpdateStat( "actions" ) ) - { - // Update commands. - commandCounter = snStatusPaneCommand.tab.max; - commandCounter = UpdateCommand(action_attack, commandCounter); - commandCounter = UpdateCommand(action_patrol, commandCounter); - commandCounter = UpdateCommand(action_repair, commandCounter); - commandCounter = UpdateCommand(action_gather_food, commandCounter); - commandCounter = UpdateCommand(action_gather_wood, commandCounter); - commandCounter = UpdateCommand(action_gather_stone, commandCounter); - commandCounter = UpdateCommand(action_gather_ore, commandCounter); - } - - if (listCounter > 0 && commandCounter > 0) - { - // Clear remaining buttons between them. - for (commandClearLoop = listCounter; commandClearLoop <= commandCounter; commandClearLoop++) - { - guiHide("snStatusPaneCommand" + commandClearLoop + "_1"); - // If this slot could possibly contain a list, hide that too. - guiHide("snStatusPaneCommand" + "Group" + commandClearLoop); - } - } -/* - // Update production queue. - GUIObject = getGUIObjectByName("snStatusPaneCommandProgress"); - // If the entity has a production item underway, - if ( selection[0].actions.create && selection[0].actions.create.progress - && selection[0].actions.create.progress.valueOf() - && selection[0].actions.create.progress.valueOf().current - && selection[0].actions.create.queue.valueOf() - && selection[0].actions.create.queue.valueOf()[0].traits.creation.time ) - { - - // Set the value of the production progress bar. - GUIObject.caption = ((Math.round(Math.round(selection[0].actions.create.progress.valueOf().current)) * 100 ) / Math.round(selection[0].actions.create.queue.valueOf()[0].traits.creation.time)); - // Set position of progress bar. - GUIObject.size = getGUIObjectByName("snStatusPaneCommand" + selection[0].actions.create.queue.valueOf()[0].tab + "_" + selection[0].actions.create.queue.valueOf()[0].list).size; - // Set progress bar tooltip. -// GUIObject.tooltip = "Training " + selection[0].actions.create.queue.valueOf()[0].traits.id.generic + " ... " + (Math.round(selection[0].actions.create.queue.valueOf()[0].traits.creation.time-Math.round(selection[0].actions.create.progress.valueOf().current)) + " seconds remaining."; - // Reveal progressbar. - GUIObject.hidden = false; - - // Seek through queue. - for( queueEntry = 0; queueEntry < selection[0].actions.create.queue.valueOf().length; queueEntry++) - { - // Update list buttons so that they match the number of entries of that type in the queue. - getGUIObjectByName("snStatusPaneCommand" + selection[0].actions.create.queue.valueOf()[queueEntry].tab + "_" + selection[0].actions.create.queue.valueOf()[queueEntry].list).caption++; - } - } - else - { - // Hide the progress bar. - GUIObject.hidden = true; - GUIObject.tooltip = ""; - } */ -} + // ==================================================================== +/* +function UpdateListold(listIcon, listCounter) +{ + // Populates a given column of command icons with appropriate build portraits for the selected object. + // Returns an array of this selection. + + // Build unit list. + if ( selection[0].traits.id.civ_code + && selection[0].actions + && selection[0].actions.create + && selection[0].actions.create.list ) + { + list = null; + + switch (listIcon) + { + case action_tab_train: + if ( selection[0].actions.create.list.unit && shouldUpdateStat( "actions.create.list.unit" ) ) + list = selection[0].actions.create.list.unit; + break; + case action_tab_buildciv: + if ( selection[0].actions.create.list.structciv && shouldUpdateStat( "actions.create.list.structciv" ) ) + list = selection[0].actions.create.list.structciv; + break; + case action_tab_buildmil: + if ( selection[0].actions.create.list.structmil && shouldUpdateStat( "actions.create.list.structmil" ) ) + list = selection[0].actions.create.list.structmil; + break; + case action_tab_research: + if ( selection[0].actions.create.list.tech && shouldUpdateStat( "actions.create.list.tech" ) ) + list = selection[0].actions.create.list.tech; + break; + default: + return 0; + break; + } + + if ( list ) + { + // Enable tab portrait. + guiUnHide("snStatusPaneCommand" + "Group" + listCounter); + guiUnHide("snStatusPaneCommand" + listCounter + "_1"); + setPortrait("snStatusPaneCommand" + listCounter + "_1", "sheet_action", "", listIcon); + // Reset list length. + snStatusPaneCommand[listCounter][1].last = 0; + // Store content info in tab button for future reference. + snStatusPaneCommand[listCounter][1].type = "list"; + + // Extract entity list into an array. + listArray = []; + for( i in list ) + { + listArray[listArray.length] = i.toString(); + } + + // Populate appropriate command buttons. + for (createLoop = 1; createLoop < snStatusPaneCommand.list.max; createLoop++) + { + if (createLoop < listArray.length) + { + // Get name of entity to display in list. + UpdateListEntityName = selection[0].traits.id.civ_code + "_" + listArray[createLoop]; + + getGUIObjectByName ("snStatusPaneCommand" + listCounter + "_" + (createLoop+1)).caption = ""; + + guiUnHide("snStatusPaneCommand" + listCounter + "_" + (createLoop+1)); + setPortrait("snStatusPaneCommand" + listCounter + "_" + (createLoop+1), + getEntityTemplate(UpdateListEntityName).traits.id.icon, + selection[0].traits.id.civ_code, + getEntityTemplate(UpdateListEntityName).traits.id.icon_cell); + + // Store content info in tab button for future reference. + snStatusPaneCommand[listCounter][createLoop+1].name = listIcon; + snStatusPaneCommand[listCounter][createLoop+1].object = listArray[createLoop]; + snStatusPaneCommand[listCounter][createLoop+1].type = "list"; + snStatusPaneCommand[listCounter][createLoop+1].last++; + } + else + { + guiHide("snStatusPaneCommand" + listCounter + "_" + parseInt(createLoop+1)); + } + } + return listArray; + } + } + + return 0; +} +*/ 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 4cea5eed3e..3db036028d 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 @@ -12,7 +12,7 @@ function refreshStatusPane() // Update portrait if (selection[0].traits.id.icon) setPortrait ("snStatusPanePortrait", selection[0].traits.id.icon, - selection[0].traits.id.civ_code, selection[0].traits.id.icon_cell); + toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell); } if( shouldUpdateStat( "actions" ) ) diff --git a/binaries/data/mods/official/gui/test/functions_sim_player.js b/binaries/data/mods/official/gui/test/functions_sim_player.js index a113fcd545..b576b3e6e9 100644 --- a/binaries/data/mods/official/gui/test/functions_sim_player.js +++ b/binaries/data/mods/official/gui/test/functions_sim_player.js @@ -45,8 +45,6 @@ function addResource (resourceName, resourceQty) // Ensure resource name is title-case. resourceName = toTitleCase (resourceName); - // Create uppercase name. - resourceNameU = resourceName.toUpperCase(); if (!localPlayer.resource) { @@ -59,7 +57,7 @@ function addResource (resourceName, resourceQty) } // Store resource's name and starting value. - localPlayer.resource.valueOf()[resourceNameU] = resourceQty; + localPlayer.resource.valueOf()[resourceName] = resourceQty; // The array is now one index longer. localPlayer.resource.length++; @@ -91,13 +89,11 @@ function setResources (resourceName, resourceQty) // Ensure resource name is title-case. resourceName = toTitleCase (resourceName); - // Create uppercase name. - resourceNameU = resourceName.toUpperCase(); -// if ( localPlayer.resource.valueOf()[resourceNameU] ) +// if ( localPlayer.resource.valueOf()[resourceName] ) // { // Set resource value. - localPlayer.resource.valueOf()[resourceNameU] = resourceQty; + localPlayer.resource.valueOf()[resourceName] = resourceQty; // Dynamically adjust width of resource counter based on caption length. refreshResources(); @@ -119,13 +115,11 @@ function giveResources (resourceName, resourceQty) // Ensure resource name is title-case. resourceName = toTitleCase (resourceName); - // Create uppercase name. - resourceNameU = resourceName.toUpperCase(); -// console.write (localPlayer.resource.valueOf()[resourceNameU]); -// if ( localPlayer.resource.valueOf()[resourceNameU] ) + +// if ( localPlayer.resource.valueOf()[resourceName] ) // { // Set resource value. - localPlayer.resource.valueOf()[resourceNameU] += resourceQty; + localPlayer.resource.valueOf()[resourceName] += resourceQty; // Dynamically adjust width of resource counter based on caption length. refreshResources(); @@ -148,13 +142,11 @@ function deductResources (resourceName, resourceQty) // Ensure resource name is title-case. resourceName = toTitleCase (resourceName); - // Create uppercase name. - resourceNameU = resourceName.toUpperCase(); -// if( localPlayer.resource.valueOf()[resourceNameU] ) +// if( localPlayer.resource.valueOf()[resourceName] ) // { // Set resource value. - localPlayer.resource.valueOf()[resourceNameU] -= resourceQty; + localPlayer.resource.valueOf()[resourceName] -= resourceQty; // Dynamically adjust width of resource counter based on caption length. refreshResources(); @@ -175,12 +167,12 @@ function refreshResources () { // Refreshes all resource counters after update. - pool = localPlayer.resource; + resourcePool = localPlayer.resource; resourceCount = 0; - for (resource in pool) + for (currResource in resourcePool) { // Pass the array index of the resource as the second parameter (as we'll need that to determine the centered screen position of each counter). - refreshResource (toTitleCase(resource), resourceUIArray[resourceCount]); + refreshResource (toTitleCase(currResource), resourceUIArray[resourceCount]); resourceCount++; } } @@ -190,6 +182,9 @@ function refreshResources () function refreshResource (resourceName, resourceIndex) { // Refresh the onscreen counter for a given resource (called to recalculate the size of the coordinates, as these dynamically adjust depending on character length). + + // Ensure resource name is title-case. + resourceName = toTitleCase (resourceName); // Ignore the "Housing" resource ... It doesn't work like normal resources and doesn't have a counter to resize. if (resourceName == "Housing") @@ -200,11 +195,11 @@ function refreshResource (resourceName, resourceIndex) // Update counter caption (since we need to have up-to-date text to determine the length of the counter). caption = "[icon=iconResource" + resourceName + " displace=\"0 0\"] " - + localPlayer.resource.valueOf()[resourceName.toUpperCase()]; + + localPlayer.resource.valueOf()[resourceName]; // The Population counter also lists the amount of available housing. if (resourceName == "Population") caption - += "/" + localPlayer.resource.valueOf()["HOUSING"]; + += "/" + localPlayer.resource.valueOf()["Housing"]; resourceObject.caption = caption; // Update caption tooltip. diff --git a/binaries/data/mods/official/gui/test/functions_utility.js b/binaries/data/mods/official/gui/test/functions_utility.js index 08b581e5d2..04e5f71a1f 100755 --- a/binaries/data/mods/official/gui/test/functions_utility.js +++ b/binaries/data/mods/official/gui/test/functions_utility.js @@ -69,8 +69,10 @@ function addArrayElement(Array) function toTitleCase (string) { - // Returns the title-case version of a given string. + if (!string) console.write ("toTileCase(): String " + string + " has no properties."); + // Returns the title-case version of a given string. + string = string.toString(); string = string.substring(0,1).toUpperCase() + string.substring(1, string.length).toLowerCase(); return (string); } diff --git a/binaries/data/mods/official/gui/test/setup.xml b/binaries/data/mods/official/gui/test/setup.xml index 895ee09660..30140a772a 100755 --- a/binaries/data/mods/official/gui/test/setup.xml +++ b/binaries/data/mods/official/gui/test/setup.xml @@ -59,33 +59,33 @@ --> diff --git a/binaries/data/mods/official/gui/test/sprite1.xml b/binaries/data/mods/official/gui/test/sprite1.xml index 13a70367be..22bf4eab8c 100644 --- a/binaries/data/mods/official/gui/test/sprite1.xml +++ b/binaries/data/mods/official/gui/test/sprite1.xml @@ -416,9 +416,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1211,52 +2218,52 @@ NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -1564,7 +2571,7 @@ NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET - + @@ -1573,7 +2580,7 @@ NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET - + @@ -1598,8 +2605,8 @@ NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET - - + + diff --git a/binaries/data/mods/official/gui/test/styles.xml b/binaries/data/mods/official/gui/test/styles.xml index da9dd2e8e1..2762b9b00e 100755 --- a/binaries/data/mods/official/gui/test/styles.xml +++ b/binaries/data/mods/official/gui/test/styles.xml @@ -456,9 +456,9 @@ />