Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f16cf9
commit 2c83b69
Showing
11 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### 0 A.D. Civ Choices Mod | ||
|
||
Adds the civ choices dialog allowing to select one of mutually exclusive technologies at the start of the match. | ||
|
||
Example technologies are included for Athenians: either Hoplite or Slinger Militia are unlocked in CC via the civ choices dialog. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function initCivChoicesDialog() | ||
{ | ||
let currentPlayer = g_Players[Engine.GetPlayerID()]; | ||
let civChoices = g_CivData[currentPlayer.civ].CivChoices; | ||
if (civChoices) | ||
{ | ||
for (let i = 0; i < civChoices.length; ++i) | ||
{ | ||
let civChoiceButton = Engine.GetGUIObjectByName("civChoice[" + i + "]"); | ||
civChoiceButton.caption = GetTechnologyData(civChoices[i]).name.generic; | ||
|
||
let size = civChoiceButton.size; | ||
size.top = 20 * i; | ||
size.bottom = 20 * (i + 1); | ||
civChoiceButton.size = size; | ||
|
||
civChoiceButton.onPress = (function(tech) { return function() { | ||
Engine.PostNetworkCommand({ "type": "civ-choice", "template": tech }); | ||
Engine.GetGUIObjectByName("civChoicesDialogPanel").hidden = true; | ||
}})(civChoices[i]); | ||
|
||
civChoiceButton.hidden = false; | ||
} | ||
Engine.GetGUIObjectByName("civChoicesDialogPanel").hidden = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<object name="civChoicesDialogPanel" | ||
size="50%-280 50%-200 50%+280 50%+150" | ||
type="image" | ||
hidden="true" | ||
sprite="ModernDialog" | ||
> | ||
<object type="text" style="TitleText" size="50%-96 -16 50%+96 16"> | ||
<translatableAttribute id="caption">Civ choices</translatableAttribute> | ||
</object> | ||
|
||
<object size="32 64 100%-32 100%-64"> | ||
<repeat count="4" var="n"> | ||
<object name="civChoice[n]" size="0 0 100% 20" type="button" style="StoneButton" hidden="true"/> | ||
</repeat> | ||
</object> | ||
</object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "Civ choices", | ||
"version": "0.0.22", | ||
"label": "Civ choices", | ||
"description": "Adds the civ choices dialog allowing to select one of mutually exclusive technologies at the start of the match.", | ||
"dependencies": ["0ad=0.0.22"], | ||
"type": "Feature" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"genericName": "Hoplites" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"genericName": "Militia" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
g_Commands["civ-choice"] = function(player, cmd, data) | ||
{ | ||
var cmpTechnologyManager = QueryPlayerIDInterface(player, IID_TechnologyManager); | ||
cmpTechnologyManager.ResearchTechnology(cmd.template); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters