- Timestamp:
- 06/10/11 01:52:29 (14 years ago)
- Location:
- ps/trunk/binaries/data
- Files:
-
- 2 added
- 3 edited
-
mods/public/gui/common/functions_utility.js (modified) (1 diff)
-
mods/public/gui/gamesetup/gamesetup.js (modified) (6 diffs)
-
mods/public/simulation/data/map_sizes.json (added)
-
tools/atlas/lists.xml (modified) (2 diffs)
-
tools/atlas/toolbar/player.png (added)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/gui/common/functions_utility.js
r8800 r9610 163 163 // ==================================================================== 164 164 165 // Load map size data 166 function initMapSizes() 167 { 168 var filename = "simulation/data/map_sizes.json"; 169 var sizes = { 170 names: [], 171 tiles: [], 172 default: 0 173 }; 174 var rawData = readFile(filename); 175 if (!rawData) 176 error("Failed to read map sizes file: "+filename); 177 178 try 179 { // Catch nasty errors from JSON parsing 180 // TODO: Need more info from the parser on why it failed: line number, position, etc! 181 var data = JSON.parse(rawData); 182 if (!data || !data.Sizes) 183 error("Failed to parse map sizes in: "+filename+" (check for valid JSON data)"); 184 185 for (var i = 0; i < data.Sizes.length; ++i) 186 { 187 sizes.names.push(data.Sizes[i].LongName); 188 sizes.tiles.push(data.Sizes[i].Tiles); 189 190 if (data.Sizes[i].Default) 191 sizes.default = i; 192 } 193 } 194 catch(err) 195 { 196 error(err.toString()+": parsing map sizes in "+filename); 197 } 198 199 return sizes; 200 } 201 202 // ==================================================================== 203 165 204 // Convert integer color values to string (for use in GUI objects) 166 205 function iColorToString(color) -
ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js
r9507 r9610 1 1 //////////////////////////////////////////////////////////////////////////////////////////////// 2 2 // Constants 3 // TODO: Move these into common location (other scripts may need) 4 const MAP_SIZES_TEXT = ["Tiny (2 player)", "Small (3 player)", "Medium (4 player)", "Normal (6 player)", "Large (8 player)", "Very Large", "Giant"]; 5 const MAP_SIZES_DATA = [128, 192, 256, 320, 384, 448, 512]; 6 const MAP_SIZES_DEFAULTIDX = 2; 7 3 // TODO: Move these somewhere like simulation\data\game_types.json, Atlas needs them too 8 4 const VICTORY_TEXT = ["Conquest", "None"]; 9 5 const VICTORY_DATA = ["conquest", "endless"]; … … 33 29 }; 34 30 31 var g_MapSizes = {}; 32 35 33 var g_AIs = []; 36 34 … … 85 83 g_DefaultPlayerData = initPlayerDefaults(); 86 84 g_DefaultPlayerData.shift(); 85 86 g_MapSizes = initMapSizes(); 87 87 88 88 // Init civs … … 139 139 140 140 var mapSize = getGUIObjectByName("mapSize"); 141 mapSize.list = MAP_SIZES_TEXT;142 mapSize.list_data = MAP_SIZES_DATA;141 mapSize.list = g_MapSizes.names; 142 mapSize.list_data = g_MapSizes.tiles; 143 143 mapSize.onSelectionChange = function() 144 144 { // Update attributes so other players can see change 145 145 if (this.selected != -1) 146 146 { 147 g_GameAttributes.settings.Size = MAP_SIZES_DATA[this.selected];147 g_GameAttributes.settings.Size = g_MapSizes.tiles[this.selected]; 148 148 } 149 149 … … 769 769 var numPlayersBox = getGUIObjectByName("numPlayersBox"); 770 770 771 var sizeIdx = ( MAP_SIZES_DATA.indexOf(mapSettings.Size) != -1 ? MAP_SIZES_DATA.indexOf(mapSettings.Size) : MAP_SIZES_DEFAULTIDX);771 var sizeIdx = (g_MapSizes.tiles.indexOf(mapSettings.Size) != -1 ? g_MapSizes.tiles.indexOf(mapSettings.Size) : g_MapSizes.default); 772 772 var victoryIdx = (VICTORY_DATA.indexOf(mapSettings.GameType) != -1 ? VICTORY_DATA.indexOf(mapSettings.GameType) : VICTORY_DEFAULTIDX); 773 773 … … 797 797 else 798 798 { // Client 799 mapSizeText.caption = "Map size: " + MAP_SIZES_TEXT[sizeIdx];799 mapSizeText.caption = "Map size: " + g_MapSizes.names[sizeIdx]; 800 800 revealMapText.caption = "Reveal map: " + (mapSettings.RevealMap ? "Yes" : "No"); 801 801 victoryConditionText.caption = "Victory condition: " + VICTORY_TEXT[victoryIdx]; -
ps/trunk/binaries/data/tools/atlas/lists.xml
r9271 r9610 26 26 27 27 <animations> 28 29 <item>attack1 </item> 30 <item>attack2 </item> 31 <item>build </item> 32 <item>corpse </item> 33 <item>death </item> 34 <item>gather_fruit</item> 35 <item>gather_grain</item> 36 <item>gather_wood </item> 37 <item>gather_stone</item> 38 <item>gather_metal</item> 39 <item>gather_ruins</item> 28 <item>idle </item> 29 <item>walk </item> 30 <item>run </item> 31 <item>melee </item> 32 <item>death </item> 33 <item>build </item> 34 <item>gather_fruit </item> 35 <item>gather_grain </item> 36 <item>gather_meat </item> 37 <item>gather_tree </item> 38 <item>gather_rock </item> 39 <item>gather_ore </item> 40 <item>gather_ruins </item> 40 41 <item>gather_treasure</item> 41 <item>idle </item>42 <item>melee </item>43 <item>run </item>44 <item>walk </item>45 42 </animations> 46 43 … … 57 54 </playercolours> 58 55 59 <mapsizes>60 <size name="Tiny" tiles="128"/>61 <size name="Small" tiles="192"/>62 <size name="Medium" tiles="256"/>63 <size name="Normal" tiles="320"/>64 <size name="Large" tiles="384"/>65 <size name="Very Large" tiles="448"/>66 <size name="Giant" tiles="512"/>67 </mapsizes>68 69 56 </lists>
Note:
See TracChangeset
for help on using the changeset viewer.
