Summary screen: separate barter info for each resource
This was SVN commit r12393.
This commit is contained in:
parent
3acc855a2d
commit
3b704b12a9
@ -104,14 +104,16 @@ function init(data)
|
||||
getGUIObjectByName("foodGatheredHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("vegetarianRatioHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("woodGatheredHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("metalGatheredHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("stoneGatheredHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("metalGatheredHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("treasuresCollectedHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
|
||||
left = 50;
|
||||
getGUIObjectByName("playerName3Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
|
||||
getGUIObjectByName("resourcesSoldHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("resourcesBoughtHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("exchangedFoodHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("exchangedWoodHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("exchangedStoneHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("exchangedMetalHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("barterEfficiencyHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
getGUIObjectByName("tradeIncomeHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
|
||||
|
||||
@ -157,12 +159,14 @@ function init(data)
|
||||
var foodGathered = getGUIObjectByName("foodGathered["+i+"]");
|
||||
var vegetarianRatio = getGUIObjectByName("vegetarianRatio["+i+"]");
|
||||
var woodGathered = getGUIObjectByName("woodGathered["+i+"]");
|
||||
var metalGathered = getGUIObjectByName("metalGathered["+i+"]");
|
||||
var stoneGathered = getGUIObjectByName("stoneGathered["+i+"]");
|
||||
var metalGathered = getGUIObjectByName("metalGathered["+i+"]");
|
||||
var treasuresCollected = getGUIObjectByName("treasuresCollected["+i+"]");
|
||||
|
||||
var resourcesSold = getGUIObjectByName("resourcesSold["+i+"]");
|
||||
var resourcesBought = getGUIObjectByName("resourcesBought["+i+"]");
|
||||
var exchangedFood = getGUIObjectByName("exchangedFood["+i+"]");
|
||||
var exchangedWood = getGUIObjectByName("exchangedWood["+i+"]");
|
||||
var exchangedStone = getGUIObjectByName("exchangedStone["+i+"]");
|
||||
var exchangedMetal = getGUIObjectByName("exchangedMetal["+i+"]");
|
||||
var barterEfficiency = getGUIObjectByName("barterEfficiency["+i+"]");
|
||||
var tradeIncome = getGUIObjectByName("tradeIncome["+i+"]");
|
||||
|
||||
@ -192,16 +196,18 @@ function init(data)
|
||||
foodGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
vegetarianRatio.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
woodGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
metalGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
stoneGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
metalGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
treasuresCollected.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
size = getGUIObjectByName("playerBox2["+i+"]").size;
|
||||
size.right = left + 10;
|
||||
getGUIObjectByName("playerBox2["+i+"]").size = size;
|
||||
|
||||
left = 240;
|
||||
resourcesSold.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
resourcesBought.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
exchangedFood.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
exchangedWood.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
exchangedStone.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
exchangedMetal.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
barterEfficiency.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
tradeIncome.size = left + " 2 " + (left + width) + " 100%"; left += width;
|
||||
size = getGUIObjectByName("playerBox3["+i+"]").size;
|
||||
@ -224,14 +230,27 @@ function init(data)
|
||||
vegetarianRatio.caption = Math.floor(playerState.statistics.resourcesGathered.food > 0 ?
|
||||
(playerState.statistics.resourcesGathered.vegetarianFood / playerState.statistics.resourcesGathered.food) * 100 : 0) + "%";
|
||||
woodGathered.caption = playerState.statistics.resourcesGathered.wood;
|
||||
metalGathered.caption = playerState.statistics.resourcesGathered.metal;
|
||||
stoneGathered.caption = playerState.statistics.resourcesGathered.stone;
|
||||
metalGathered.caption = playerState.statistics.resourcesGathered.metal;
|
||||
treasuresCollected.caption = playerState.statistics.treasuresCollected;
|
||||
|
||||
resourcesSold.caption = playerState.statistics.resourcesSold;
|
||||
resourcesBought.caption = playerState.statistics.resourcesBought;
|
||||
barterEfficiency.caption = Math.floor(playerState.statistics.resourcesSold > 0 ?
|
||||
(playerState.statistics.resourcesBought / playerState.statistics.resourcesSold) * 100 : 0) + "%";
|
||||
const SOLD_COLOR = "201 255 200";
|
||||
const BOUGHT_COLOR = "255 213 213"
|
||||
exchangedFood.caption = '[color="' + SOLD_COLOR + '"]+' + playerState.statistics.resourcesBought.food
|
||||
+ '[/color] [color="' + BOUGHT_COLOR + '"]-' + playerState.statistics.resourcesSold.food + '[/color]';
|
||||
exchangedWood.caption = '[color="' + SOLD_COLOR + '"]+' + playerState.statistics.resourcesBought.wood
|
||||
+ '[/color] [color="' + BOUGHT_COLOR + '"]-' + playerState.statistics.resourcesSold.wood + '[/color]';
|
||||
exchangedStone.caption = '[color="' + SOLD_COLOR + '"]+' + playerState.statistics.resourcesBought.stone
|
||||
+ '[/color] [color="' + BOUGHT_COLOR + '"]-' + playerState.statistics.resourcesSold.stone + '[/color]';
|
||||
exchangedMetal.caption = '[color="' + SOLD_COLOR + '"]+' + playerState.statistics.resourcesBought.metal
|
||||
+ '[/color] [color="' + BOUGHT_COLOR + '"]-' + playerState.statistics.resourcesSold.metal + '[/color]';
|
||||
var totalBought = 0;
|
||||
for each (var boughtAmount in playerState.statistics.resourcesBought)
|
||||
totalBought += boughtAmount;
|
||||
var totalSold = 0;
|
||||
for each (var soldAmount in playerState.statistics.resourcesSold)
|
||||
totalSold += soldAmount;
|
||||
barterEfficiency.caption = Math.floor(totalSold > 0 ? (totalBought / totalSold) * 100 : 0) + "%";
|
||||
tradeIncome.caption = playerState.statistics.tradeIncome;
|
||||
}
|
||||
else
|
||||
|
@ -167,12 +167,12 @@
|
||||
<object name="woodGatheredHeading" type="text" style="CenteredTabLabelText">
|
||||
Wood gathered
|
||||
</object>
|
||||
<object name="metalGatheredHeading" type="text" style="CenteredTabLabelText">
|
||||
Metal gathered
|
||||
</object>
|
||||
<object name="stoneGatheredHeading" type="text" style="CenteredTabLabelText">
|
||||
Stone gathered
|
||||
</object>
|
||||
<object name="metalGatheredHeading" type="text" style="CenteredTabLabelText">
|
||||
Metal gathered
|
||||
</object>
|
||||
<object name="treasuresCollectedHeading" type="text" style="CenteredTabLabelText">
|
||||
Treasures collected
|
||||
</object>
|
||||
@ -187,8 +187,8 @@
|
||||
<object name="foodGathered[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="vegetarianRatio[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="woodGathered[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="metalGathered[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="stoneGathered[n]" type="text" style="CenteredLabelText" />
|
||||
<object name="metalGathered[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="treasuresCollected[n]" type="text" style="CenteredLabelText"/>
|
||||
</object>
|
||||
</repeat>
|
||||
@ -201,11 +201,17 @@
|
||||
<object name="playerName3Heading" type="text" style="LeftTabLabelText">
|
||||
Player name
|
||||
</object>
|
||||
<object name="resourcesSoldHeading" type="text" style="CenteredTabLabelText">
|
||||
Resources sold
|
||||
<object name="exchangedFoodHeading" type="text" style="CenteredTabLabelText">
|
||||
Food exchanged
|
||||
</object>
|
||||
<object name="resourcesBoughtHeading" type="text" style="CenteredTabLabelText">
|
||||
Resources bought
|
||||
<object name="exchangedWoodHeading" type="text" style="CenteredTabLabelText">
|
||||
Wood exchanged
|
||||
</object>
|
||||
<object name="exchangedStoneHeading" type="text" style="CenteredTabLabelText">
|
||||
Stone exchanged
|
||||
</object>
|
||||
<object name="exchangedMetalHeading" type="text" style="CenteredTabLabelText">
|
||||
Metal exchanged
|
||||
</object>
|
||||
<object name="barterEfficiencyHeading" type="text" style="CenteredTabLabelText">
|
||||
Barter efficiency
|
||||
@ -221,8 +227,10 @@
|
||||
<object name="playerColourBox3[n]" type="image" size="10 4 30 24" />
|
||||
<object name="playerName3[n]" type="text" style="LeftLabelText" size="40 2 208 100%" />
|
||||
<object name="civIcon3[n]" type="image" size="208 0 240 32"/>
|
||||
<object name="resourcesSold[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="resourcesBought[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="exchangedFood[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="exchangedWood[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="exchangedStone[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="exchangedMetal[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="barterEfficiency[n]" type="text" style="CenteredLabelText"/>
|
||||
<object name="tradeIncome[n]" type="text" style="CenteredLabelText"/>
|
||||
</object>
|
||||
|
@ -100,8 +100,8 @@ Barter.prototype.ExchangeResources = function(playerEntity, resourceToSell, reso
|
||||
var cmpStatisticsTracker = Engine.QueryInterface(playerEntity, IID_StatisticsTracker);
|
||||
if (cmpStatisticsTracker)
|
||||
{
|
||||
cmpStatisticsTracker.IncreaseResourcesSoldCounter(amount);
|
||||
cmpStatisticsTracker.IncreaseResourcesBoughtCounter(amountToAdd);
|
||||
cmpStatisticsTracker.IncreaseResourcesSoldCounter(resourceToSell, amount);
|
||||
cmpStatisticsTracker.IncreaseResourcesBoughtCounter(resourceToBuy, amountToAdd);
|
||||
}
|
||||
|
||||
// Increase price difference for both exchange resources.
|
||||
|
@ -24,8 +24,18 @@ StatisticsTracker.prototype.Init = function()
|
||||
"stone": 0,
|
||||
"vegetarianFood": 0
|
||||
};
|
||||
this.resourcesSold = 0;
|
||||
this.resourcesBought = 0;
|
||||
this.resourcesSold = {
|
||||
"food": 0,
|
||||
"wood": 0,
|
||||
"metal": 0,
|
||||
"stone": 0
|
||||
};
|
||||
this.resourcesBought = {
|
||||
"food": 0,
|
||||
"wood": 0,
|
||||
"metal": 0,
|
||||
"stone": 0
|
||||
};
|
||||
this.tradeIncome = 0;
|
||||
this.treasuresCollected = 0;
|
||||
};
|
||||
@ -130,14 +140,14 @@ StatisticsTracker.prototype.IncreaseTreasuresCollectedCounter = function()
|
||||
return this.treasuresCollected++;
|
||||
};
|
||||
|
||||
StatisticsTracker.prototype.IncreaseResourcesSoldCounter = function(amount)
|
||||
StatisticsTracker.prototype.IncreaseResourcesSoldCounter = function(type, amount)
|
||||
{
|
||||
this.resourcesSold += amount;
|
||||
this.resourcesSold[type] += amount;
|
||||
}
|
||||
|
||||
StatisticsTracker.prototype.IncreaseResourcesBoughtCounter = function(amount)
|
||||
StatisticsTracker.prototype.IncreaseResourcesBoughtCounter = function(type, amount)
|
||||
{
|
||||
this.resourcesBought += amount;
|
||||
this.resourcesBought[type] += amount;
|
||||
}
|
||||
|
||||
StatisticsTracker.prototype.IncreaseTradeIncomeCounter = function(amount)
|
||||
|
Loading…
Reference in New Issue
Block a user