Ticket #3987: civselection_randomcivoption_v3.1.patch
File civselection_randomcivoption_v3.1.patch, 61.8 KB (added by , 8 years ago) |
---|
-
binaries/data/config/default.cfg
85 85 noautomipmap = true 86 86 novbo = false 87 87 noframebufferobject = false 88 randomcultures = true 88 89 89 90 ; Disable hardware cursors 90 91 nohwcursor = false … … 234 235 toggle = "Ctrl+F11" ; Enable/disable HTTP/GPU modes for new profiler 235 236 236 237 [hotkey.selection] 237 add = Shift ; Add units to selection238 add = Shift ; Add units/civilizations to selection 238 239 milonly = Alt ; Add only military units to selection 239 240 idleonly = "I" ; Select only idle units 240 241 remove = Ctrl ; Remove units from selection -
binaries/data/mods/public/gui/civselect/civselect.js
1 let g_CivData = {}; 2 let g_GroupingData = {}; 3 let g_GroupingChoice = "none"; 4 let g_SelectedGroupingChoice = "none"; 5 let g_Player = 0; 6 let g_Selected = { 7 "isGroup": false, 8 "code": "athen" 9 }; 10 let g_EmblemMargin = 8; 11 let g_HeaderEmblemSize = 80; 12 let g_DoubleClick = false; 13 let g_CustomGrouping = false; 14 let g_PreviousSelection = {}; 15 16 /** 17 * Run when UI Page loaded. 18 */ 19 function init(settings) 20 { 21 // Cache civ data 22 g_CivData = loadCivData(true); 23 g_Player = settings.player; 24 25 // If no civ passed, choose one at random 26 if (!settings.civ) 27 { 28 let num = Math.floor(Math.random() * Object.keys(g_CivData).length); 29 settings.civ = { 30 "codes": [Object.keys(g_CivData)[num]], 31 "grouped": false 32 }; 33 } 34 g_DoubleClick = false; 35 // Cache grouping data and create list 36 let grpList = ["Ungrouped"]; 37 let grpList_data = ["nogroup"]; 38 for (let grp of Engine.BuildDirEntList("simulation/data/civs/grouping/", "*.json", false)) 39 { 40 let data = Engine.ReadJSONFile(grp); 41 if (!data) 42 continue; 43 translateObjectKeys(data, ["ListEntry"]); 44 g_GroupingData[data.Code] = loadGroupingSchema(data.Folder, data.CivAttribute); 45 46 grpList.push(data.ListEntry); 47 grpList_data.push(data.Code); 48 } 49 50 g_GroupingData["custom"] = {"custom": {"Name": "Custom", "History": "", "code": "cust", "Singular": "Custom", "civlist": settings.civ.codes, "embs": []}}; 51 52 let grpSel = Engine.GetGUIObjectByName("groupSelection"); 53 grpSel.list = grpList; 54 grpSel.list_data = grpList_data; 55 56 // Read civ choice from passed data 57 if (!settings.civ.grouped) 58 { 59 g_Selected.code = settings.civ.codes[0]; 60 grpSel.selected = 0; 61 selectCiv(g_Selected.code, true, false); 62 } 63 else 64 { 65 g_GroupingChoice = settings.civ.group.type; 66 g_SelectedGroupingChoice = settings.civ.group.type; 67 68 g_Selected.isGroup = true; 69 if (settings.civ.group.code !== "all") 70 { 71 g_Selected.code = settings.civ.group.code; 72 if (settings.civ.group.type != "custom") 73 grpSel.selected = grpSel.list_data.indexOf(g_GroupingChoice); 74 else 75 grpSel.selected = 0; 76 if (settings.civ.group.type == "custom") 77 { 78 g_CustomGrouping = true; 79 g_GroupingData["custom"]["custom"].civlist = settings.civ.codes; 80 } 81 selectCiv(g_Selected.code, true, true); 82 } 83 else 84 { 85 grpSel.selected = 0; 86 selectAllCivs(); 87 } 88 } 89 Engine.GetGUIObjectByName("randomCultures").checked = Engine.ConfigDB_GetValue("user", "randomcultures") === "true"; 90 Engine.GetGUIObjectByName("selectAll").checked = g_Selected.code == "all"; 91 } 92 93 function chooseGrouping(choice) 94 { 95 if (g_CustomGrouping) 96 { 97 g_CustomGrouping = false; 98 selectCiv(Object.keys(g_CivData)[Math.floor(Math.random() * Object.keys(g_CivData).length)], false, false); 99 } 100 if (choice === "nogroup") 101 draw_ungrouped(); 102 else 103 draw_grouped(choice); 104 } 105 106 function draw_grouped(group) 107 { 108 Engine.GetGUIObjectByName("optionRandomCultures").hidden = !Engine.GetGUIObjectByName("selectAll").checked; 109 110 let grp = 0; 111 let emb = 0; 112 let vOffset = 0; 113 let hOffset = 0; 114 g_GroupingChoice = group; 115 116 let grouping = g_GroupingData[group]; 117 let selectedCivs = []; 118 119 for (let civ in g_CivData) 120 g_CivData[civ].embs = []; 121 for (let code in grouping) 122 { 123 // Pre-emptive check to make sure we have at least one emblem left 124 if (!Engine.GetGUIObjectByName("emblem["+emb+"]")) 125 break; 126 127 let grpObj = Engine.GetGUIObjectByName("civGroup["+grp+"]"); 128 129 let grpSize = grpObj.size; 130 grpSize.top = vOffset; 131 grpSize.right = hOffset; 132 133 grpSize.left = (grp % 2 == 0 || grouping[code].civlist.length > 3) ? g_HeaderEmblemSize-g_EmblemMargin : 400; 134 grpObj.size = grpSize; 135 grpObj.hidden = false; 136 137 g_GroupingData[g_GroupingChoice][code].embs = []; 138 139 let grpHeading = Engine.GetGUIObjectByName("civGroup["+grp+"]_heading"); 140 grpHeading.caption = grouping[code].Name; 141 142 let embHeading = Engine.GetGUIObjectByName("emblem["+emb+"]_heading"); 143 embHeading.caption = ''; 144 145 if (code !== "groupless") 146 { 147 let grpBtn = Engine.GetGUIObjectByName("emblem["+emb+"]_btn"); 148 grpBtn.tooltip = grouping[code].Name; 149 setBtnFunc(grpBtn, selectCiv, [code, false, true]); 150 151 setEmbPos("emblem["+emb+"]", hOffset, vOffset+g_EmblemMargin); 152 setEmbSize("emblem["+emb+"]", g_HeaderEmblemSize); 153 154 let sprite = (code !== g_Selected.code) ? "grayscale:" : ""; 155 if (grouping[code].Emblem) 156 sprite += grouping[code].Emblem; 157 else 158 sprite += g_CivData[grouping[code].civlist[0]].Emblem; 159 Engine.GetGUIObjectByName("emblem["+emb+"]_img").sprite = "stretched:"+sprite; 160 Engine.GetGUIObjectByName("emblem["+emb+"]").hidden = grouping[code].civlist.length == 1; 161 g_GroupingData[g_GroupingChoice][code].embs.push(emb); 162 ++emb; 163 } 164 165 let range = [emb]; 166 167 for (let civ of grouping[code].civlist) 168 { 169 if (g_GroupingData["custom"]["custom"].civlist.indexOf(civ) > -1) 170 selectedCivs.push(emb); 171 172 if (!g_Selected.isGroup && civ == g_Selected.code) 173 selectedCivs.push(emb); 174 let embImg = Engine.GetGUIObjectByName("emblem["+emb+"]_img"); 175 if (!embImg) 176 { 177 error("There are not enough images in the current GUI layout to support that many civs"); 178 break; 179 } 180 181 let embHeading = Engine.GetGUIObjectByName("emblem["+emb+"]_heading"); 182 embHeading.caption = ''; 183 184 g_CivData[civ].embs.push(emb); 185 g_GroupingData[g_GroupingChoice][code].embs.push(emb); 186 187 embImg.sprite = "stretched:"; 188 if (civ !== g_Selected.code && code !== g_Selected.code) 189 embImg.sprite += "grayscale:"; 190 embImg.sprite += g_CivData[civ].Emblem; 191 192 let embBtn = Engine.GetGUIObjectByName("emblem["+emb+"]_btn"); 193 embBtn.tooltip = g_CivData[civ].Name; 194 setBtnFunc(embBtn, selectCiv, [civ, false, false]); 195 Engine.GetGUIObjectByName("emblem["+emb+"]").hidden = false; 196 197 emb++; 198 } 199 range[1] = emb - 1; 200 201 if (grp % 2 == 1 && grouping[code].civlist.length < 4) 202 { 203 setEmbSize("emblem["+range[0]+"]", 80); 204 vOffset += grpHeading.size.bottom + 2; 205 vOffset += gridArrayRepeatedObjects("emblem[emb]", "emb", 4, 0, range, vOffset, (g_HeaderEmblemSize+325)); 206 vOffset += g_EmblemMargin * 2; 207 } 208 else 209 { 210 setEmbSize("emblem["+range[0]+"]", 80); 211 if (grouping[code].civlist.length > 4) 212 { 213 vOffset += gridArrayRepeatedObjects("emblem[emb]", "emb", 4, 0, range, vOffset+25, g_HeaderEmblemSize); 214 vOffset += 50; 215 } 216 else 217 gridArrayRepeatedObjects("emblem[emb]", "emb", 4, 0, range, vOffset+25, g_HeaderEmblemSize); 218 } 219 hOffset = (hOffset >= 325) || (grouping[code].civlist.length > 3) ? 0 : 325; 220 221 grp++; 222 } 223 hideRemaining("emblem[", emb, "]"); 224 hideRemaining("civGroup[", grp, "]"); 225 highlightEmblems(selectedCivs); 226 227 if (g_Selected.code === "all") 228 selectAllCivs(); 229 } 230 231 function draw_ungrouped() 232 { 233 setEmbSize("emblem[0]"); 234 gridArrayRepeatedObjects("emblem[emb]", "emb", 30, 25, [], 0, 0, 4); 235 gridArrayRepeatedObjects("emblem[emb]_heading", "emb", 0, 0, [], 5, 10); 236 237 let emb = 0; 238 let selectedCivs = []; 239 for (let civ in g_CivData) 240 { 241 if (g_GroupingData["custom"]["custom"].civlist.indexOf(civ) != -1) 242 { 243 selectedCivs.push(emb); 244 g_GroupingData["custom"]["custom"].embs.push(emb); 245 } 246 247 if (!g_Selected.isGroup && civ == g_Selected.code) 248 selectedCivs.push(emb); 249 250 g_CivData[civ].embs = [emb]; 251 252 let embImg = Engine.GetGUIObjectByName("emblem["+emb+"]_img"); 253 254 let embHeading = Engine.GetGUIObjectByName("emblem["+emb+"]_heading"); 255 embHeading.caption = g_CivData[civ].Name; 256 257 let range = [emb]; 258 if (!embImg) 259 { 260 error("There are not enough images in the current GUI layout to support that many civs"); 261 break; 262 } 263 264 range[1] = emb - 1; 265 266 embImg.sprite = "stretched:"; 267 if (civ !== g_Selected.code) 268 embImg.sprite += ":"; 269 embImg.sprite += g_CivData[civ].Emblem; 270 271 let embBtn = Engine.GetGUIObjectByName("emblem["+emb+"]_btn"); 272 embBtn.tooltip = ''; 273 setBtnFunc(embBtn, selectCiv, [civ, false, false]); 274 275 Engine.GetGUIObjectByName("emblem["+emb+"]").hidden = false; 276 emb++; 277 } 278 hideRemaining("emblem[", emb, "]"); 279 hideRemaining("civGroup[", 0, "]"); 280 281 highlightEmblems(selectedCivs); 282 283 if (g_Selected.code === "all") 284 selectAllCivs(); 285 } 286 287 function selectCiv(code, onInit, isGroup) 288 { 289 let customCivs = g_GroupingData["custom"]["custom"].civlist; 290 let customCivsEmbs = g_GroupingData["custom"]["custom"].embs; 291 292 if (g_Selected.code == code && customCivs.length == 1 && !onInit) 293 { 294 selectAllCivs(); 295 return; 296 } 297 298 let selection = []; 299 if (isGroup) 300 selection = g_GroupingData[g_GroupingChoice][code]; 301 else 302 selection = g_CivData[code]; 303 304 g_Selected.isGroup = isGroup; 305 g_Selected.code = code; 306 if (g_Selected.code !== "all") 307 g_PreviousSelection = clone(g_Selected); 308 309 if (Engine.HotkeyIsPressed("selection.add")) 310 { 311 g_CustomGrouping = true; 312 // if the civ has already been selected, remove it 313 if (customCivsEmbs.indexOf(selection.embs[0]) != -1 314 && customCivsEmbs.length >= 1 || customCivsEmbs.indexOf(selection.embs[0]) != -1) 315 { 316 customCivs.splice(customCivs.indexOf(code), 1); 317 318 for (let civEmb of selection.embs) 319 { 320 let index = customCivsEmbs.indexOf(civEmb); 321 customCivsEmbs.splice(index, 1); 322 } 323 } 324 else 325 { 326 for (let civEmb of selection.embs) 327 customCivsEmbs.push(civEmb); 328 329 customCivs.push(code) 330 } 331 332 if (customCivs.length > 1) 333 g_SelectedGroupingChoice = "custom"; 334 else 335 { 336 g_CustomGrouping = false; 337 code = customCivs[0]; 338 g_Selected.code = customCivs[0]; 339 } 340 highlightEmblems(customCivsEmbs); 341 } 342 else if (!onInit) 343 { 344 if (!onInit && code != "custom") 345 g_CustomGrouping = false; 346 customCivs = []; 347 customCivsEmbs = []; 348 if (selection) 349 for (let civEmb of selection.embs) 350 customCivsEmbs.push(civEmb); 351 customCivs.push(code); 352 if (selection) 353 highlightEmblems(selection.embs); 354 if (isGroup) 355 g_SelectedGroupingChoice = g_GroupingChoice; 356 } 357 358 g_GroupingData["custom"]["custom"].civlist = customCivs; 359 g_GroupingData["custom"]["custom"].embs = customCivsEmbs; 360 361 Engine.GetGUIObjectByName("optionRandomCultures").hidden = true; 362 Engine.GetGUIObjectByName("selectAll").checked = false; 363 364 let choice = Engine.GetGUIObjectByName("selected_text"); 365 366 choice.caption = g_CustomGrouping ? sprintf(translate("Random choice between civilizations/groupings")) : isGroup ? 367 sprintf(translate("A random %(civGroup)s civilization will be chosen"), {"civGroup": g_GroupingData[g_GroupingChoice][code].Singular}) : 368 sprintf(translate("You have selected the %(civname)s"), {"civname": selection.Name}); 369 370 displayCivInfo(code, selection, isGroup); 371 } 372 373 function updateSelectedText() 374 { 375 let choice = Engine.GetGUIObjectByName("selected_text"); 376 if (g_CustomGrouping) 377 choice.caption = sprintf(translate("Random choice between selected civilizations and groupings")); 378 } 379 380 function displayCivInfo(code, selection, isGroup) 381 { 382 if (g_DoubleClick) 383 return; 384 385 let heading = Engine.GetGUIObjectByName("selected_heading"); 386 heading.caption = g_CustomGrouping ? "Random Custom" : isGroup ? 387 selection.Name : g_CivData[code].Name; 388 389 let civList = Engine.GetGUIObjectByName("selected_civs"); 390 civList.hidden = !g_CustomGrouping; 391 civList.caption = ""; 392 let civCount = 0; 393 for (let item of g_GroupingData["custom"]["custom"].civlist) 394 { 395 civList.caption += Object.keys(g_CivData).indexOf(item) > -1 ? g_CivData[item].Name : g_GroupingData[g_GroupingChoice][item].Name; 396 civList.caption += "\n"; 397 civCount++; 398 } 399 400 let history = Engine.GetGUIObjectByName("selected_history"); 401 if (!g_CustomGrouping) 402 history.caption = selection.History; 403 404 let size = history.parent.size; 405 size.top = 48; 406 history.parent.size = size; 407 history.parent.hidden = g_CustomGrouping; 408 } 409 410 function selectAllCivs() 411 { 412 if (g_Selected.code == "all") 413 { 414 Engine.GetGUIObjectByName("selectAll").checked = false; 415 416 g_PreviousSelection.code = g_PreviousSelection.code || Object.keys(g_CivData)[Math.floor(Math.random() * Object.keys(g_CivData).length)]; 417 g_PreviousSelection.isGroup = g_PreviousSelection.isGroup || false; 418 selectCiv(g_PreviousSelection.code, false, g_PreviousSelection.isGroup); 419 return; 420 } 421 422 Engine.GetGUIObjectByName("optionRandomCultures").hidden = false; 423 424 let embs = []; 425 for (let i=0; ; ++i) 426 { 427 if (!Engine.GetGUIObjectByName("emblem["+i+"]")) 428 break; 429 embs.push(i); 430 } 431 highlightEmblems(embs); 432 433 g_Selected.isGroup = true; 434 g_Selected.code = "all"; 435 436 let heading = Engine.GetGUIObjectByName("selected_heading"); 437 heading.caption = sprintf(translate("Random %(civGroup)s"), { 438 "civGroup": translateWithContext("All Civs", "All") 439 }); 440 441 let civList = Engine.GetGUIObjectByName("selected_civs"); 442 civList.hidden = false; 443 civList.caption = ""; 444 let civCount = 0; 445 for (let civ in g_CivData) 446 { 447 civList.caption += g_CivData[civ].Name + "\n"; 448 civCount++; 449 } 450 451 let history = Engine.GetGUIObjectByName("selected_history"); 452 history.parent.hidden = true; 453 454 let choice = Engine.GetGUIObjectByName("selected_text"); 455 choice.caption = translate("A civilization will be chosen at random"); 456 457 Engine.GetGUIObjectByName("selectAll").checked = g_Selected.code == "all"; 458 } 459 460 function highlightEmblems(embs = []) 461 { 462 for (let e=0; ; ++e) 463 { 464 if (!Engine.GetGUIObjectByName("emblem["+e+"]")) 465 return; 466 467 let embImg = Engine.GetGUIObjectByName("emblem["+e+"]_img"); 468 let sprite = embImg.sprite.split(":"); 469 embImg.sprite = "stretched:" + ((embs.indexOf(e)<0)?"grayscale:":"") + sprite.pop(); 470 } 471 } 472 473 function setBtnFunc(btn, func, vars = null) 474 { 475 btn.onMouseLeftRelease = function () { func.apply(null, vars); }; 476 btn.onMouseLeftDoubleClick = function () { returnCiv.apply(null, vars); g_DoubleClick = true; }; 477 } 478 479 function randomCultures() 480 { 481 Engine.ConfigDB_CreateValue("user", "randomcultures", String(Engine.GetGUIObjectByName("randomCultures").checked)); 482 Engine.ConfigDB_SetChanges("user", true); 483 Engine.ConfigDB_WriteFile("user", "config/user.cfg"); 484 } 485 486 function returnCiv() 487 { 488 let code = g_Selected.code; 489 let civ = { 490 "codes": [g_Selected.code], 491 "grouped": false, 492 } 493 494 if (g_CustomGrouping) 495 { 496 civ.codes = g_GroupingData["custom"]["custom"].civlist; 497 civ.grouped = true; 498 civ.group = { 499 "caption": "Custom", 500 "code": "custom", 501 "type": g_SelectedGroupingChoice, 502 }; 503 504 for (let item of civ.codes) 505 { 506 if ((Object.keys(g_CivData).indexOf(item)) == -1) 507 civ.codes.splice(civ.codes.indexOf(item), 1, g_GroupingData[g_GroupingChoice][item].civlist); 508 } 509 } 510 else if (g_Selected.isGroup && !g_CustomGrouping) 511 { 512 civ.codes = g_Selected.code == "all" ? Object.keys(g_CivData) : g_GroupingData[g_SelectedGroupingChoice][code].civlist; 513 civ.grouped = true; 514 civ.group = { 515 "caption": g_Selected.code === "all" ? "All" : g_GroupingData[g_SelectedGroupingChoice][code].Singular, 516 "code": g_Selected.code, 517 "type": g_SelectedGroupingChoice, 518 }; 519 } 520 Engine.PopGuiPageCB({ 521 "player": g_Player, 522 "civ": civ, 523 "randomCultures" : Engine.GetGUIObjectByName("randomCultures").checked 524 }); 525 } -
binaries/data/mods/public/gui/civselect/civselect.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <objects> 4 <script file="gui/common/functions_civinfo.js"/> 5 <script file="gui/common/functions_global_object.js"/> 6 <script file="gui/common/functions_repeat_positioning.js"/> 7 <script file="gui/common/functions_utility.js"/> 8 <script file="gui/civselect/helpers.js"/> 9 <script file="gui/civselect/civselect.js"/> 10 11 <!-- Add a translucent black background to fade out the match page --> 12 <object type="image" z="0" sprite="bkTranslucent"/> 13 14 <object type="image" style="ModernDialog" size="50%-488 50%-360 50%+488 50%+360"> 15 16 <object style="TitleText" type="text" size="50%-128 -18 50%+128 14"> 17 <translatableAttribute id="caption">Civilization Selection</translatableAttribute> 18 </object> 19 20 <object size="16 32 70%-8 100%-32"> 21 22 <!-- grouping selection --> 23 <object size="50% 0 100% 40"> 24 <object 25 name="groupSelectionHeading" 26 type="text" 27 font="sans-bold-16" 28 textcolor="white" 29 text_align="right" 30 size="0 2 100%-196 32" 31 > 32 <translatableAttribute id="caption">Group by:</translatableAttribute> 33 </object> 34 35 <object name="groupSelection" type="dropdown" style="ModernDropDown" size="100%-192 0 100% 26"> 36 <translatableAttribute id="tooltip">Choose how to group civilizations</translatableAttribute> 37 <action on="SelectionChange">chooseGrouping(this.list_data[this.selected]);</action> 38 </object> 39 </object> 40 41 <!-- draw space --> 42 <object type="image" size="0 40 100% 100%"> 43 44 <repeat count="32" var="em"> 45 <object type="text" size="4 8 4+159 100+64" font="sans-bold-24" textcolor="white" name="emblem[em]_heading"/> 46 <object name="emblem[em]" size="4 8 4+64 8+64"> 47 48 <object type="image" style="EmblemImage" name="emblem[em]_img"/> 49 <object type="button" style="EmblemButton" name="emblem[em]_btn" tooltip_style="sessionToolTipBold"> 50 </object> 51 </object> 52 </repeat> 53 54 <repeat count="12" var="g"> 55 <object size="8 8 100%-8 24+72+16" name="civGroup[g]"> 56 <object 57 name="civGroup[g]_heading" 58 type="text" 59 font="sans-16" 60 textcolor="white" 61 text_align="left" 62 size="2 0 50% 24" 63 > 64 <translatableAttribute id="caption">A group:</translatableAttribute> 65 </object> 66 <object sprite="ModernGoldLine" type="image" size="0 24 45% 25"/> 67 </object> 68 </repeat> 69 </object> 70 71 </object> 72 73 <object sprite="ModernDarkBoxGold" type="image" size="70%+8 32 100%-16 90%-70"> 74 75 <!-- Selection Details --> 76 <object 77 name="selected_heading" 78 type="text" 79 font="sans-bold-24" 80 textcolor="white" 81 text_align="center" 82 size="0 12 100% 40" 83 /> 84 85 <object 86 name="selected_civs" 87 type="text" 88 font="sans-16" 89 textcolor="white" 90 text_align="center" 91 size="4 44 100%-4 100%-4" 92 /> 93 94 <object size="8 48 100%-8 100%-8" type="image" sprite="ModernDarkBoxGold"> 95 <object 96 name="selected_history" 97 type="text" 98 font="sans-14" 99 textcolor="white" 100 text_align="center" 101 size="4 4 100%-4 100%-4" 102 /> 103 </object> 104 105 </object> 106 <object 107 name="selected_text" 108 type="text" 109 font="sans-12" 110 textcolor="green" 111 text_align="center" 112 text_valign="bottom" 113 size="70%+8 100%-64 100%-16 100%-48" 114 /> 115 116 <object name="optionSelectAll" size="650 589 120% 25%"> 117 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 118 <translatableAttribute id="caption">Select All:</translatableAttribute> 119 </object> 120 <object name="selectAll" size="225 5 46% -5%" type="checkbox" style="ModernTickBox"> 121 <action on="Press">selectAllCivs();</action> 122 <translatableAttribute id="tooltip">A civilization will be picked from all possible civilizations (Random All).</translatableAttribute> 123 </object> 124 </object> 125 126 <object name="optionRandomCultures" size="650 619 120% 25%"> 127 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 128 <translatableAttribute id="caption">Random Cultures:</translatableAttribute> 129 </object> 130 <object name="randomCultures" size="225 5 46% -5%" type="checkbox" style="ModernTickBox"> 131 <action on="Press">randomCultures();</action> 132 <translatableAttribute id="tooltip">Civilizations set to "Random All" will be chosen by culture.</translatableAttribute> 133 </object> 134 </object> 135 136 <!-- Close the dialog --> 137 <object 138 type="button" 139 style="StoneButton" 140 size="70%+8 100%-44 85%-8 100%-16" 141 > 142 <translatableAttribute id="caption">Cancel</translatableAttribute> 143 <action on="Press"> 144 <![CDATA[ 145 Engine.PopGuiPage(); 146 ]]> 147 </action> 148 </object> 149 150 <object 151 type="button" 152 style="StoneButton" 153 size="85% 100%-44 100%-16 100%-16" 154 > 155 <translatableAttribute id="caption">Select</translatableAttribute> 156 <action on="Press"> 157 <![CDATA[ 158 returnCiv(); 159 ]]> 160 </action> 161 </object> 162 163 </object> 164 165 </objects> -
binaries/data/mods/public/gui/civselect/helpers.js
1 2 /** 3 * Arranges same-size `<repeat>`d objects in a grid. Automatically scales to object size. 4 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 5 * @param splitlet The var identifying the repeat count, without the square brackets 6 * @param vMargin The gap, in px, between the rows 7 * @param hMargin The gap, in px, between the columns 8 * @param limit Array of limits, of the form `[ {from}, {to} ]`. If an empty array, then it will do all objects matching the basname 9 * @param vOffset Vertical offset from top of parent object to start drawing from 10 * @return The height difference between the top of the first element and the bottom of the last. 11 */ 12 function gridArrayRepeatedObjects(basename, splitlet="n", vMargin=0, hMargin=0, limit=[], vOffset=0, hOffset=0, rowLength) 13 { 14 basename = basename.split("["+splitlet+"]", 2); 15 16 if (limit.length == 0) 17 { 18 limit = [0, 0, 1]; 19 while (Engine.GetGUIObjectByName(basename.join("["+ (limit[1]+1) +"]"))) 20 { 21 ++limit[1]; 22 ++limit[2]; 23 } 24 } 25 else if (limit.length < 2) 26 { 27 error("Invalid limit arguments"); 28 return 0; 29 } 30 else 31 limit[2] = limit[1] - limit[0] + 1; 32 33 let firstObj = Engine.GetGUIObjectByName(basename.join("["+limit[0]+"]")); 34 let child = firstObj.getComputedSize(); 35 child.width = child.right - child.left; 36 child.height = child.bottom - child.top; 37 38 let parent = firstObj.parent.getComputedSize(); 39 parent.width = parent.right - parent.left - hOffset; 40 41 rowLength = rowLength || Math.floor(parent.width / child.width); 42 43 child.width += hMargin; 44 child.height += vMargin; 45 46 let i = limit[0]; 47 for (let r = 0; r < Math.ceil(limit[2] / rowLength); ++r) 48 { 49 for (let c = 0; c < rowLength; ++c) 50 { 51 let newSize = new GUISize(); 52 newSize.left = c * child.width + hMargin + hOffset; 53 newSize.right = (c+1) * child.width + hOffset; 54 newSize.top = r * child.height + vMargin + vOffset; 55 newSize.bottom = (r+1) * child.height + vOffset; 56 Engine.GetGUIObjectByName(basename.join("["+ i++ +"]")).size = newSize; 57 58 if (i > limit[1]) 59 break; 60 } 61 } 62 63 let lastObj = Engine.GetGUIObjectByName(basename.join("["+(i-1)+"]")); 64 return (lastObj.size.bottom - firstObj.size.top); 65 } 66 67 /** 68 * Load Data about a grouping schema 69 * 70 * @param attr The JSON attribute in the Civ JSON files that lists which of the groups in this schema that civ belongs to 71 * @param folder The folder containing the groups of this schema 72 */ 73 function loadGroupingSchema(folder, attr) 74 { 75 let groupData = {}; 76 let groupless = []; 77 78 for (let code of Object.keys(g_CivData)) 79 { 80 let civ = g_CivData[code]; 81 let nogroup = true; 82 let groups = civ[attr] || []; 83 if (typeof groups === "string") 84 groups = [ groups ]; 85 86 for (let grp of groups) 87 { 88 if (groupData[grp] === undefined) 89 { 90 let data = Engine.ReadJSONFile("simulation/data/civs/"+folder+"/"+grp+".json"); 91 92 if (!data) 93 continue; 94 95 groupData[grp] = data; 96 groupData[grp].civlist = []; 97 98 } 99 groupData[grp].civlist.push(code); 100 nogroup = false; 101 } 102 if (nogroup) 103 groupless.push(code); 104 105 } 106 if (groupless.length > 0) 107 groupData.groupless = { 108 "Name" : "Ungrouped", 109 "Code" : "groupless", 110 "History" : "-", 111 "civlist": groupless 112 }; 113 114 return groupData; 115 } 116 117 function setEmbSize(objectName, length=128) 118 { 119 let objSize = Engine.GetGUIObjectByName(objectName).size; 120 objSize.right = objSize.left + length; 121 objSize.bottom = objSize.top + length; 122 Engine.GetGUIObjectByName(objectName).size = objSize; 123 } 124 125 function setEmbPos(objectName, x=0, y=0) 126 { 127 let objSize = Engine.GetGUIObjectByName(objectName).size; 128 let wid = objSize.right - objSize.left; 129 objSize.left = x; 130 objSize.top = y; 131 Engine.GetGUIObjectByName(objectName).size = objSize; 132 setEmbSize(objectName, wid); 133 } -
binaries/data/mods/public/gui/civselect/setup.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <setup> 4 <tooltip name="treeTooltip" 5 anchor="top" 6 buffer_zone="4" 7 delay="50" 8 font="sans-14" 9 maxwidth="480" 10 offset="16 24" 11 sprite="bkTooltip" 12 textcolor="white" 13 /> 14 </setup> -
binaries/data/mods/public/gui/civselect/sprites.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <sprites> 4 5 <sprite name="CivIconPress"> 6 <image 7 texture="session/portraits/emblems/states/click.png" 8 /> 9 </sprite> 10 11 </sprites> -
binaries/data/mods/public/gui/civselect/styles.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <styles> 4 5 <style name="EmblemButton" 6 sprite="" 7 sprite_over="CivIconOver" 8 sprite_pressed="CivIconPress" 9 size="0 0 100% 100%" 10 sound_pressed="audio/interface/ui/ui_button_click.ogg" 11 /> 12 13 <style name="EmblemImage" 14 sprite="stretched:pregame/shell/logo/wfg_logo_white.png" 15 size="0 0 100% 100%" 16 /> 17 18 <style name="HeroImage" 19 sprite="stretched:pregame/shell/logo/wfg_logo_white.png" 20 size="0 0 32 32" 21 /> 22 23 </styles> -
binaries/data/mods/public/gui/common/functions_repeat_positioning.js
1 /* 2 DESCRIPTION : Functions related to positioning UI elements 3 NOTES : 4 */ 5 6 /** 7 * Horizontally spaces same-width objects repeated with the `<repeat>` tag 8 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 9 * @param splitvar The var identifying the repeat count, without the square brackets 10 * @param margin The gap, in px, between the repeated objects 11 * @return The number of elements affected 12 */ 13 function horizSpaceRepeatedObjects (basename, splitvar="n", margin=0) 14 { 15 basename = basename.split("["+splitvar+"]", 2); 16 for (let c = 0;;) 17 { 18 let objObj = Engine.GetGUIObjectByName(basename.join("["+ c +"]")); 19 if (!objObj) 20 return c; 21 22 let objSize = objObj.size; 23 let objWidth = objSize.right - objSize.left; 24 objSize.left = c * (objWidth + margin) + margin; 25 objSize.right = ++c * (objWidth + margin); 26 objObj.size = objSize; 27 } 28 } 29 30 /** 31 * Horizontally fit objects repeated with the `<repeat>` tag within a parent object 32 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 33 * @param splitvar The var identifying the repeat count, without the square brackets 34 * @param margin The gap, in px, between the repeated objects 35 * @param limit The number of elements to fit 36 * @return The number of elements affected 37 */ 38 function horizFitRepeatedObjects(basename, splitvar="n", margin=0, limit=0) 39 { 40 basename = basename.split("["+splitvar+"]", 2); 41 42 var objObj; 43 if (limit == 0) 44 do 45 objObj = Engine.GetGUIObjectByName(basename.join("["+ ++limit +"]")); 46 while (objObj !== undefined) 47 48 for (let c = 0; c < limit; ++c) 49 { 50 objObj = Engine.GetGUIObjectByName(basename.join("["+ c +"]")); 51 let objSize = objObj.size; 52 objSize.rleft = c * (100/limit); 53 objSize.rright = (c+1) * (100/limit); 54 objSize.right = -margin; 55 objObj.size = objSize; 56 } 57 58 return limit; 59 } 60 61 /** 62 * Vertically spaces same-height objects repeated with the `<repeat>` tag 63 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 64 * @param splitvar The var identifying the repeat count, without the square brackets 65 * @param margin The gap, in px, between the repeated objects 66 * @return The number of elements affected 67 */ 68 function vertiSpaceRepeatedObjects(basename, splitvar="n", margin=0) 69 { 70 basename = basename.split("["+splitvar+"]", 2); 71 for (let c=0;;) 72 { 73 let objObj = Engine.GetGUIObjectByName(basename.join("["+ c +"]")); 74 if (!objObj) 75 return c; 76 77 let objSize = objObj.size; 78 let objHeight = objSize.bottom - objSize.top; 79 objSize.top = c * (objHeight + margin) + margin; 80 objSize.bottom = ++c * (objHeight + margin); 81 objObj.size = objSize; 82 } 83 } 84 85 /** 86 * Hide all repeated elements after a certain index 87 * @param prefix The part of the element name preceeding the index 88 * @param idx The index from which to start 89 * @param prefix The part of the element name after the index 90 */ 91 function hideRemaining(prefix, idx, suffix) 92 { 93 for (;; ++idx) 94 { 95 let obj = Engine.GetGUIObjectByName(prefix+idx+suffix); 96 if (!obj) 97 break; 98 obj.hidden = true; 99 } 100 } -
binaries/data/mods/public/gui/gamesetup/gamesetup.js
144 144 const g_RandomMap = '[color="' + g_ColorRandom + '"]' + translateWithContext("map selection", "Random") + "[/color]"; 145 145 146 146 /** 147 * Placeholder item for the civ-dropdownlists.147 * Style for the random civ strings. 148 148 */ 149 const g_RandomCiv = '[color="' + g_ColorRandom + '"]' + translateWithContext("civilization", "Random") + '[/color]';149 const g_RandomCivStyle = ['[color="' + g_ColorRandom + '"]', '[/color]']; 150 150 151 151 /** 152 * 153 */ 154 var g_RandomCivObj = {}; 155 156 var g_RandomCultures = Engine.ConfigDB_GetValue("user", "randomcultures") === "true"; 157 158 /** 152 159 * Whether this is a single- or multiplayer match. 153 160 */ 154 161 var g_IsNetworked; … … 259 266 g_DefaultPlayerData = g_Settings.PlayerDefaults; 260 267 g_DefaultPlayerData.shift(); 261 268 for (let i in g_DefaultPlayerData) 262 g_DefaultPlayerData[i].Civ = "random"; 269 g_DefaultPlayerData[i].CivObj = { 270 "codes": [ g_DefaultPlayerData[i].Civ ], 271 "grouped": false 272 }; 273 274 g_RandomCivObj = { 275 "codes": Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup), 276 "grouped": true, 277 "group": { "type": "none", "code": "all", "caption": translateWithContext("All Civs", "All") } 278 }; 263 279 264 280 setTimeout(displayGamestateNotifications, 1000); 265 281 } … … 271 287 { 272 288 Engine.GetGUIObjectByName("cancelGame").tooltip = Engine.HasXmppClient() ? translate("Return to the lobby.") : translate("Return to the main menu."); 273 289 274 initCivNameList();275 290 initMapTypes(); 276 291 initMapFilters(); 277 292 … … 536 551 for (let i = 0; i < g_MaxPlayers; ++i) 537 552 { 538 553 Engine.GetGUIObjectByName("playerAssignment["+i+"]").hidden = true; 539 Engine.GetGUIObjectByName("playerCiv["+i+"]").hidden = true;540 554 Engine.GetGUIObjectByName("playerTeam["+i+"]").hidden = true; 541 555 } 542 556 … … 622 636 colorPicker.list_data = g_PlayerColors.map((color, index) => index); 623 637 colorPicker.selected = -1; 624 638 colorPicker.onSelectionChange = function() { selectPlayerColor(playerSlot, this.selected); }; 625 626 Engine.GetGUIObjectByName("playerCiv["+i+"]").onSelectionChange = function() {627 if ((this.selected != -1)&&(g_GameAttributes.mapType !== "scenario"))628 g_GameAttributes.settings.PlayerData[playerSlot].Civ = this.list_data[this.selected];629 630 updateGameAttributes();631 };632 639 } 633 640 } 634 641 … … 808 815 return undefined; 809 816 } 810 817 811 /** 812 * Initialize the dropdowns containing all selectable civs (including random). 813 */ 814 function initCivNameList() 818 function setCiv(args) 815 819 { 816 let civList = Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup).map(civ => ({ "name": g_CivData[civ].Name, "code": civ })).sort(sortNameIgnoreCase); 817 let civListNames = [g_RandomCiv].concat(civList.map(civ => civ.name)); 818 let civListCodes = ["random"].concat(civList.map(civ => civ.code)); 819 820 for (let i = 0; i < g_MaxPlayers; ++i) 821 { 822 let civ = Engine.GetGUIObjectByName("playerCiv["+i+"]"); 823 civ.list = civListNames; 824 civ.list_data = civListCodes; 825 civ.selected = 0; 826 } 820 g_GameAttributes.settings.PlayerData[args.player].CivObj = args.civ; 821 g_RandomCultures = args.randomCultures; 822 updateGameAttributes(); 827 823 } 828 824 829 825 /** … … 918 914 if (!g_IsNetworked) 919 915 mapSettings.CheatsEnabled = true; 920 916 921 // Replace unselectable civs with random civ917 // Filter out unselectable civs 922 918 let playerData = mapSettings.PlayerData; 923 919 if (playerData && g_GameAttributes.mapType != "scenario") 924 920 for (let i in playerData) 925 if (!g_CivData[playerData[i].Civ] || !g_CivData[playerData[i].Civ].SelectableInGameSetup) 926 playerData[i].Civ = "random"; 921 { 922 if (!playerData[i].CivObj) 923 continue; 924 playerData[i].CivObj.codes = playerData[i].CivObj.codes.filter((code) => {return g_CivData[code] && g_CivData[code].SelectableInGameSetup}); 925 if (playerData[i].CivObj.codes.length === 0) 926 playerData[i].CivObj = g_RandomCivObj; 927 } 927 928 928 929 // Apply map settings 929 930 let newMapData = loadMapData(mapName); … … 962 963 963 964 playerData.forEach((pData, index) => { 964 965 pData.Color = pData.Color || g_PlayerColors[index]; 965 pData.Civ = pData.Civ || "random";966 pData.CivObj = pData.CivObj ? pData.CivObj : (pData.Civ && pData.Civ !== "random" ? { "codes": [ pData.Civ ], "grouped": false } : g_RandomCivObj) 966 967 pData.AI = pData.AI || ""; 967 968 }); 968 969 … … 1246 1247 let cultures = Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup).map(civ => g_CivData[civ].Culture); 1247 1248 cultures = cultures.filter((culture, index) => cultures.indexOf(culture) === index); 1248 1249 1249 // Determine random civs and botnames1250 1250 for (let i in g_GameAttributes.settings.PlayerData) 1251 1251 { 1252 // Pick a random civ of a random culture 1253 let chosenCiv = g_GameAttributes.settings.PlayerData[i].Civ || "random"; 1254 if (chosenCiv == "random") 1252 // Determine civ 1253 let civs = g_GameAttributes.settings.PlayerData[i].CivObj.codes; 1254 let chosenCiv = civs[Math.floor(Math.random() * civs.length)]; 1255 1256 if (civs.length > 1) 1255 1257 { 1256 let culture = cultures[Math.floor(Math.random() * cultures.length)]; 1257 let civs = Object.keys(g_CivData).filter(civ => g_CivData[civ].Culture == culture); 1258 chosenCiv = civs[Math.floor(Math.random() * civs.length)]; 1258 if (g_RandomCultures && g_GameAttributes.settings.PlayerData[i].CivObj.group.code == "all") 1259 { 1260 let culture = cultures[Math.floor(Math.random() * cultures.length)]; 1261 warn(uneval(culture)); 1262 let civs = Object.keys(g_CivData).filter(civ => g_CivData[civ].Culture == culture); 1263 chosenCiv = civs[Math.floor(Math.random() * civs.length)]; 1264 } 1265 else if (g_GameAttributes.settings.PlayerData[i].CivObj.group.code == "custom" && Object.keys(g_CivData).indexOf(chosenCiv) == -1) 1266 chosenCiv = chosenCiv[Math.floor(Math.random() * chosenCiv.length)]; 1259 1267 } 1268 1260 1269 g_GameAttributes.settings.PlayerData[i].Civ = chosenCiv; 1261 1270 1262 1271 // Pick one of the available botnames for the chosen civ … … 1417 1426 let pName = Engine.GetGUIObjectByName("playerName["+i+"]"); 1418 1427 let pAssignment = Engine.GetGUIObjectByName("playerAssignment["+i+"]"); 1419 1428 let pAssignmentText = Engine.GetGUIObjectByName("playerAssignmentText["+i+"]"); 1420 let pCiv = Engine.GetGUIObjectByName("playerCiv["+i+"]");1421 let pCivText = Engine.GetGUIObjectByName("playerCiv Text["+i+"]");1429 //let pCivText = Engine.GetGUIObjectByName("playerCivText["+i+"]"); 1430 let pCivText = Engine.GetGUIObjectByName("playerCivButton["+i+"]"); 1422 1431 let pTeam = Engine.GetGUIObjectByName("playerTeam["+i+"]"); 1423 1432 let pTeamText = Engine.GetGUIObjectByName("playerTeamText["+i+"]"); 1424 1433 let pColor = Engine.GetGUIObjectByName("playerColor["+i+"]"); … … 1432 1441 1433 1442 let team = getSetting(pData, pDefs, "Team"); 1434 1443 let civ = getSetting(pData, pDefs, "Civ"); 1444 let civObj = getSetting(pData, pDefs, "CivObj"); 1435 1445 1436 1446 pAssignmentText.caption = pAssignment.list[0] ? pAssignment.list[Math.max(0, pAssignment.selected)] : translate("Loading..."); 1437 pCivText.caption = civ == "random" ? g_RandomCiv : (g_CivData[civ] ? g_CivData[civ].Name : "Unknown"); 1447 1448 if (civObj) 1449 { 1450 if (civObj.grouped) 1451 pCivText.caption = g_RandomCivStyle[0] + sprintf(translate("Random %(civGroup)s"), {"civGroup": civObj.group.caption }) + g_RandomCivStyle[1]; 1452 else if (civObj.codes.length > 1) 1453 pCivText.caption = g_RandomCivStyle[0] + translateWithContext("Selection from a group of civilizations", "Arbitrary Selection") + g_RandomCivStyle[1]; 1454 else 1455 pCivText.caption = (g_CivData[civObj.codes[0]] ? g_CivData[civObj.codes[0]].Name : translateWithContext("Unnamed civilization", "Unknown")); 1456 } 1457 1438 1458 pTeamText.caption = (team !== undefined && team >= 0) ? team+1 : "-"; 1439 1440 pCiv.selected = civ ? pCiv.list_data.indexOf(civ) : 0;1441 1459 pTeam.selected = team !== undefined && team >= 0 ? team+1 : 0; 1442 1460 1443 1461 hideControl("playerAssignment["+i+"]", "playerAssignmentText["+i+"]", g_IsController); 1444 hideControl("playerCiv["+i+"]", "playerCivText["+i+"]", notScenario);1445 1462 hideControl("playerTeam["+i+"]", "playerTeamText["+i+"]", notScenario); 1463 //Engine.GetGUIObjectByName("playerCivButton["+i+"]").hidden = !notScenario; 1446 1464 1447 1465 // Allow host to chose player colors on non-scenario maps 1448 1466 let pColorPicker = Engine.GetGUIObjectByName("playerColorPicker["+i+"]"); … … 1742 1760 // Swap civilizations if they aren't fixed 1743 1761 if (g_GameAttributes.mapType != "scenario") 1744 1762 { 1745 [g_GameAttributes.settings.PlayerData[playerID - 1].Civ , g_GameAttributes.settings.PlayerData[newSlot].Civ] =1746 [g_GameAttributes.settings.PlayerData[newSlot].Civ , g_GameAttributes.settings.PlayerData[playerID - 1].Civ];1763 [g_GameAttributes.settings.PlayerData[playerID - 1].CivObj, g_GameAttributes.settings.PlayerData[newSlot].CivObj] = 1764 [g_GameAttributes.settings.PlayerData[newSlot].CivObj, g_GameAttributes.settings.PlayerData[playerID - 1].CivObj]; 1747 1765 } 1748 1766 } 1749 1767 … … 1753 1771 g_PlayerAssignments[guid].player = newPlayerID; 1754 1772 1755 1773 g_GameAttributes.settings.PlayerData[newSlot].AI = ""; 1774 updateGameAttributes(); 1756 1775 } 1757 1776 1758 1777 function submitChatInput() … … 1831 1850 function resetCivilizations() 1832 1851 { 1833 1852 for (let i in g_GameAttributes.settings.PlayerData) 1834 g_GameAttributes.settings.PlayerData[i].Civ = "random";1853 g_GameAttributes.settings.PlayerData[i].CivObj = g_RandomCivObj; 1835 1854 1836 1855 updateGameAttributes(); 1837 1856 } -
binaries/data/mods/public/gui/gamesetup/gamesetup.xml
78 78 size="67.5%+93 0 67.5%+109 16" 79 79 tooltip_style="onscreenToolTip" 80 80 > 81 <translatableAttribute id="tooltip">Reset any civilizations that have been selected to the default ( random)</translatableAttribute>81 <translatableAttribute id="tooltip">Reset any civilizations that have been selected to the default (Random All)</translatableAttribute> 82 82 <action on="Press">resetCivilizations();</action> 83 83 </object> 84 84 … … 119 119 > 120 120 <translatableAttribute id="tooltip">Configure AI settings.</translatableAttribute> 121 121 </object> 122 <object name="playerCiv[n]" type="dropdown" style="ModernDropDown" size="50%+69 2 85% 30" tooltip_style="onscreenToolTip"> 123 <translatableAttribute id="tooltip">Select player's civilization.</translatableAttribute> 122 <object name="playerCivText[n]" 123 type="text" 124 style="ModernLabelText" 125 size="50%+65 0 85%-16 30" 126 > 124 127 </object> 125 <object name="playerCivText[n]" type="text" style="ModernLabelText" size="50%+65 0 85% 30"/> 128 129 <object name="playerCivButton[n]" 130 type="button" 131 style="StoneButton" 132 size="50%+65 0 85%-16 30" 133 tooltip_style="onscreenToolTip" 134 > 135 <translatableAttribute id="tooltip">Select a civilisation</translatableAttribute> 136 <action on="MouseLeftRelease"><![CDATA[ 137 let player = this.name.slice(16, -1); 138 Engine.PushGuiPage("page_civselect.xml", { 139 "player": player, 140 "civ": g_GameAttributes.settings.PlayerData[player].CivObj, 141 "callback": "setCiv" 142 }); 143 ]]></action> 144 </object> 126 145 <object name="playerTeam[n]" type="dropdown" style="ModernDropDown" size="85%+5 2 100%-5 30" tooltip_style="onscreenToolTip"> 127 146 <translatableAttribute id="tooltip">Select player's team.</translatableAttribute> 128 147 </object> 148 129 149 <object name="playerTeamText[n]" type="text" style="ModernLabelText" size="85%+5 0 100%-5 100%"/> 130 150 </object> 131 151 </repeat> 132 152 </object> 133 153 </object> 154 134 155 <object size="24 64 100%-460 358" type="image" sprite="CoverFillDark" name="playerAssignmentsPanelCover" hidden="true"/> 156 135 157 <!-- Map selection --> 136 137 158 <object size="100%-425 355 100%-285 470" name="mapTypeTooltip"> 138 159 <object type="text" style="ModernRightLabelText" size="0 0 100% 30"> 139 160 <translatableAttribute id="caption">Map Type:</translatableAttribute> -
binaries/data/mods/public/gui/page_civselect.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <page> 3 <include>common/modern/setup.xml</include> 4 <include>common/modern/styles.xml</include> 5 <include>common/modern/sprites.xml</include> 6 7 <include>common/setup.xml</include> 8 <include>common/sprite1.xml</include> 9 <include>common/styles.xml</include> 10 <include>common/common_sprites.xml</include> 11 <include>common/common_styles.xml</include> 12 13 <include>civselect/styles.xml</include> 14 <include>civselect/sprites.xml</include> 15 <include>civselect/civselect.xml</include> 16 <!-- for some reason, the setup file has to be after in 17 order to get transparency to work properly for the tooltip... --> 18 <!-- <include>civselect/setup.xml</include>--> 19 </page> -
binaries/data/mods/public/simulation/data/civs/athen.json
1 1 { 2 2 "Code":"athen", 3 "Culture":"hele", 3 "Culture":["helle"], 4 "Region":["medit", "europe"], 4 5 "Name":"Athenians", 5 6 "Emblem":"session/portraits/emblems/emblem_athenians.png", 6 7 "History":"As the cradle of Western civilization and the birthplace of democracy, Athens was famed as a center for the arts, learning and philosophy. The Athenians were also powerful warriors, particularly at sea. At its peak, Athens dominated a large part of the Hellenic world for several decades.", -
binaries/data/mods/public/simulation/data/civs/brit.json
1 1 { 2 2 "Code": "brit", 3 "Culture": "celt", 3 "Culture":["celt"], 4 "Region":["europe"], 4 5 "Name": "Britons", 5 6 "Emblem": "session/portraits/emblems/emblem_britons.png", 6 7 "History": "The Britons were the Celtic tribes of the British Isles. Using chariots, longswordsmen and powerful melee soldiers, they staged fearesome revolts against Rome to protect their customs and interests. Also, they built thousands of unique structures such as hill forts, crannogs and brochs.", -
binaries/data/mods/public/simulation/data/civs/cart.json
1 1 { 2 2 "Code": "cart", 3 "Culture": "cart", 3 "Culture":["cart"], 4 "Region":["africa", "medit"], 4 5 "Name": "Carthaginians", 5 6 "Emblem": "session/portraits/emblems/emblem_carthaginians.png", 6 7 "History": "Carthage, a city-state in modern-day Tunisia, was a formidable force in the western Mediterranean, eventually taking over much of North Africa and modern-day Spain in the third century B.C. The sailors of Carthage were among the fiercest contenders on the high seas, and masters of naval trade. They deployed towered War Elephants on the battlefield to fearsome effect, and had defensive walls so strong, they were never breached.", -
binaries/data/mods/public/simulation/data/civs/cultures/cart.json
1 { 2 "Name" : "The Carthaginians", 3 "Code" : "cart", 4 "History" : "-", 5 "Singular" : "Carthaginian" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/celt.json
1 { 2 "Name" : "Celtic Tribes", 3 "Code" : "celt", 4 "History" : "At its peak (around 200 B.C.), the massive Celtic Empire spanned from Spain to Romania and Northern Italy to Scotland; although it wasn't a true empire because the Celtic people were not united by any form of government, but only in language and various social aspects. Their lack of any cohesion was probably the largest contributing factor to their ultimate submission to Rome by 100 A.D. The other contributing factors were their lack of armor and their inability to counter the mighty legions and siege weapons of Rome.", 5 "Singular" : "Celtic" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/helle.json
1 { 2 "Name" : "The Hellenes", 3 "Code" : "helle", 4 "History" : "The Hellenes were a people famous today for their architecture, fighting ability, and culture. The Hellenic peoples of the Dorian, Ionian, and Aeolian tribes swept into modern day Greece from 3000 B.C. to around 1100 B.C. in successive waves that eventually supplanted the previously established cultures of Mycenae and Minoan Crete. They were most active during the period of colonization that took place in the 7th and 6th centuries B.C., the Greco-Persian Wars (499-449 B.C.), the Peloponnesian War (431-404 B.C.), and the conquests of Alexander the Great (4th Century B.C.). Their civilization would endure until their final absorption by Rome in 146 B.C.", 5 "Singular" : "Hellenic" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/iber.json
1 { 2 "Name" : "The Iberians", 3 "Code" : "iber", 4 "History" : "-", 5 "Singular" : "Iberian" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/maur.json
1 { 2 "Name" : "The Mauryan Empire", 3 "Code" : "indian", 4 "History" : "-", 5 "Singular" : "Indian" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/pers.json
1 { 2 "Name" : "The Persian Empire", 3 "Code" : "pers", 4 "History" : "-", 5 "Singular" : "Persian" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/ptol.json
1 { 2 "Name" : "The Ptolemies", 3 "Code" : "ptol", 4 "History" : "-", 5 "Singular" : "Ptolemaic" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/rome.json
1 { 2 "Name" : "The Romans", 3 "Code" : "rome", 4 "History" : "-", 5 "Singular" : "Roman" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/succe.json
1 { 2 "Name" : "The Successors", 3 "Code" : "succe", 4 "History" : "The Successor kingdoms were carved out from the short-lived Macedonian Empire built by Philip of Macedon and his son, Alexander the Great. The chief three kingdoms were Ptolomaic Egypt, the Seleucid Empire, and the Kingdom of Macedon. Together, they helped propel the Eastern Mediterranean and Middle East into the Hellenistic Age - a time of internecine warfare and technological and cultural advancement.", 5 "Singular" : "Successor" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/iber.json
1 { 2 "Name" : "The Iberians", 3 "Code" : "iber", 4 "History" : "-", 5 "Singular" : "Iberian" 6 } -
binaries/data/mods/public/simulation/data/civs/gaul.json
1 1 { 2 2 "Code": "gaul", 3 "Culture": "celt", 3 "Culture":["celt"], 4 "Region":["europe"], 4 5 "Name": "Gauls", 5 6 "Emblem": "session/portraits/emblems/emblem_celts.png", 6 7 "History": "The Gauls were the Celtic tribes of continental Europe. Dominated by a priestly class of Druids, they featured a sophisticated culture of advanced metalworking, agriculture, trade and even road engineering. With heavy infantry and cavalry, Gallic warriors valiantly resisted Caesar's campaign of conquest and Rome's authoritarian rule.", -
binaries/data/mods/public/simulation/data/civs/grouping/culture.json
1 { 2 "Code": "culture", 3 "CivAttribute": "Culture", 4 "ListEntry": "By Culture", 5 "Folder": "cultures" 6 } -
binaries/data/mods/public/simulation/data/civs/grouping/region.json
1 { 2 "Code": "region", 3 "CivAttribute": "Region", 4 "ListEntry": "By Geographic Region", 5 "Folder": "regions" 6 } -
binaries/data/mods/public/simulation/data/civs/iber.json
1 1 { 2 2 "Code": "iber", 3 "Culture": "iber", 3 "Culture":["iber"], 4 "Region":["europe"], 4 5 "Name": "Iberians", 5 6 "Emblem": "session/portraits/emblems/emblem_iberians.png", 6 7 "History": "The Iberians were a people of mysterious origins and language, with a strong tradition of horsemanship and metalworking. A relatively peaceful culture, they usually fought in other's battles only as mercenaries. However, they proved tenacious when Rome sought to take their land and freedom from them, and employed pioneering guerrilla tactics and flaming javelins as they fought back.", -
binaries/data/mods/public/simulation/data/civs/mace.json
1 1 { 2 2 "Code":"mace", 3 "Culture":"hele", 3 "Culture":["helle", "succe"], 4 "Region":["medit", "europe"], 4 5 "Name":"Macedonians", 5 6 "Emblem":"session/portraits/emblems/emblem_macedonians.png", 6 7 "History":"Macedonia was an ancient Greek kingdom, centered in the northeastern part of the Greek peninsula. Under the leadership of Alexander the Great, Macedonian forces and allies took over most of the world they knew, including Egypt, Persia and parts of the Indian subcontinent, allowing a diffusion of Hellenic and eastern cultures for years to come.", -
binaries/data/mods/public/simulation/data/civs/maur.json
1 1 { 2 2 "Code": "maur", 3 "Culture": "maur", 3 "Culture":["maur"], 4 "Region":["asia"], 4 5 "Name": "Mauryans", 5 6 "Emblem": "session/portraits/emblems/emblem_mauryans.png", 6 7 "History": "Founded in 322 B.C. by Chandragupta Maurya, the Mauryan Empire was the first to rule most of the Indian subcontinent, and was one of the largest and most populous empires of antiquity. Its military featured bowmen who used the long-range bamboo longbow, fierce female warriors, chariots, and thousands of armored war elephants. Its philosophers, especially the famous Acharya Chanakya, contributed to such varied fields such as economics, religion, diplomacy, warfare, and good governance. Under the rule of Ashoka the Great, the empire saw 40 years of peace, harmony, and prosperity.", -
binaries/data/mods/public/simulation/data/civs/pers.json
1 1 { 2 2 "Code": "pers", 3 "Culture": "pers", 3 "Culture":["pers"], 4 "Region":["medit"], 4 5 "Name": "Persians", 5 6 "Emblem": "session/portraits/emblems/emblem_persians.png", 6 7 "History": "The Persian Empire, when ruled by the Achaemenid dynasty, was one of the greatest empires of antiquity, stretching at its zenith from the Indus Valley in the east to Greece in the west. The Persians were the pioneers of empire-building of the ancient world, successfully imposing a centralized rule over various peoples with different customs, laws, religions and languages, and building a cosmopolitan army made up of contingents from each of these nations.", -
binaries/data/mods/public/simulation/data/civs/ptol.json
1 1 { 2 2 "Code":"ptol", 3 "Culture":"ptol", 3 "Culture":["ptol"], 4 "Region":["africa"], 4 5 "Name":"Ptolemies", 5 6 "Emblem":"session/portraits/emblems/emblem_ptolemies.png", 6 7 "History":"The Ptolemaic dynasty was a Macedonian Greek royal family which ruled the Ptolemaic Empire in Egypt during the Hellenistic period. Their rule lasted for 275 years, from 305 BC to 30 BC. They were the last dynasty of ancient Egypt.", -
binaries/data/mods/public/simulation/data/civs/regions/africa.json
1 { 2 "Name" : "Africa", 3 "Code" : "africa", 4 "History" : "-", 5 "Singular" : "African", 6 "Emblem" : "session/portraits/emblems/grouping/region_africa.png" 7 } -
binaries/data/mods/public/simulation/data/civs/regions/asia.json
1 { 2 "Name" : "Asia", 3 "Code" : "asia", 4 "History" : "-", 5 "Singular" : "Asian", 6 "Emblem" : "session/portraits/emblems/grouping/region_asia.png" 7 } -
binaries/data/mods/public/simulation/data/civs/regions/europe.json
1 { 2 "Name" : "Europe", 3 "Code" : "europe", 4 "History" : "-", 5 "Singular" : "European", 6 "Emblem" : "session/portraits/emblems/grouping/region_europe.png" 7 } -
binaries/data/mods/public/simulation/data/civs/regions/medit.json
1 { 2 "Name" : "The Mediterranean", 3 "Code" : "medit", 4 "History" : "-", 5 "Singular" : "Mediterranean", 6 "Emblem" : "session/portraits/emblems/grouping/region_medi.png" 7 } -
binaries/data/mods/public/simulation/data/civs/rome.json
1 1 { 2 2 "Code": "rome", 3 "Culture": "rome", 3 "Culture":["rome"], 4 "Region":["medit", "europe"], 4 5 "Name": "Romans", 5 6 "Emblem": "session/portraits/emblems/emblem_romans.png", 6 7 "History": "The Romans controlled one of the largest empires of the ancient world, stretching at its peak from southern Scotland to the Sahara Desert, and containing between 60 million and 80 million inhabitants, one quarter of the Earth's population at that time. Rome also remained one of the strongest nations on earth for almost 800 years. The Romans were the supreme builders of the ancient world, excelled at siege warfare and had an exquisite infantry and navy.", -
binaries/data/mods/public/simulation/data/civs/sele.json
1 1 { 2 2 "Code":"sele", 3 "Culture":"sele", 3 "Culture":["succe"], 4 "Region":["medit"], 4 5 "Name":"Seleucids", 5 6 "Emblem":"session/portraits/emblems/emblem_seleucids.png", 6 7 "History":"The Macedonian-Greek dynasty that ruled most of Alexander's former empire.", -
binaries/data/mods/public/simulation/data/civs/spart.json
1 1 { 2 2 "Code":"spart", 3 "Culture":"hele", 3 "Culture":["helle"], 4 "Region":["medit", "europe"], 4 5 "Name":"Spartans", 5 6 "Emblem":"session/portraits/emblems/emblem_spartans.png", 6 7 "History":"Sparta was a prominent city-state in ancient Greece, and its dominant military power on land from circa 650 B.C. Spartan culture was obsessed with military training and excellence, with rigorous training for boys beginning at age seven. Thanks to its military might, Sparta led a coalition of Greek forces during the Greco-Persian Wars, and won over Athens in the Peloponnesian Wars, though at great cost.",