Ticket #3216: 3216.5.patch

File 3216.5.patch, 7.8 KB (added by maveric, 9 years ago)
  • binaries/data/mods/public/gui/summary/counters.js

     
    2727function calculateMilitaryScore(playerState, position)
    2828{
    2929    return Math.round((playerState.statistics.enemyUnitsKilledValue +
    30         playerState.statistics.enemyBuildingsDestroyedValue) / 10);
     30        playerState.statistics.enemyBuildingsDestroyedValue +
     31        playerState.statistics.buildingsCapturedValue) / 10);
    3132}
    3233
    3334function calculateExplorationScore(playerState, position)
     
    6364function calculateBuildings(playerState, position)
    6465{
    6566    var type = BUILDINGS_TYPES[position];
    66     return TRAINED_COLOR + playerState.statistics.buildingsConstructed[type] + '[/color] / ' +
    67     LOST_COLOR + playerState.statistics.buildingsLost[type] + '[/color] / ' +
    68     KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]';
     67    return '   ' + TRAINED_COLOR + playerState.statistics.buildingsConstructed[type] + '[/color] / ' +
     68    KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]\n' +
     69    CAPTURED_COLOR + playerState.statistics.buildingsCaptured[type] + '[/color] / ' +
     70    LOST_COLOR + playerState.statistics.buildingsLost[type] + '[/color]';
    6971}
    7072
    7173function calculateColorsTeam(counters)
  • binaries/data/mods/public/gui/summary/layout.js

     
    2929            { "caption": translate("Wonders"), "yStart": 34, "width": 85 }
    3030        ],
    3131        "titleHeadings": [
    32             { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) },   // width = 735
     32            { "caption": translate("Buildings Statistics") + ' (' +
     33                                            '[color="201 255 200"]' + translate("Constructed") + '[/color]' +
     34                                    ' / ' + '[color="196 198 255"]' + translate("Destroyed") + '[/color]' +
     35                                    ' / ' + '[color="255 255 157"]' + translate("Captured") + '[/color]' +
     36                                    ' / ' + '[color="255 213 213"]' + translate("Lost") + '[/color]' + ')',
     37              "yStart": 16, "width": (85 * 7 + 105)
     38            },  // width = 735
    3339        ],
    3440        "counters": [   // counters on buildings panel
    3541            {"width": 105, "fn": calculateBuildings},
     
    189195{
    190196    var rowPlayerObjectWidth = 0;
    191197    var left = 0;
     198   
     199    if (panelsData[1].counters == counters) //for buildings panel
     200        var verticalOffset = 3;
     201    else
     202        var verticalOffset = 12;
     203       
    192204    for (var p = 0; p < MAX_SLOTS; ++p)
    193205    {
    194206        left = 240;
     
    196208        for (var w in counters)
    197209        {
    198210            counterObject = Engine.GetGUIObjectByName("valueData[" + p + "][" + w + "]");
    199             counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%";
     211            counterObject.size = left + " " + verticalOffset + " " + (left + counters[w].width) + " 100%";
    200212            counterObject.hidden = false;
    201213            left += counters[w].width;
    202214        }
  • binaries/data/mods/public/gui/summary/summary.js

     
    66// const for filtering long collective headings
    77const LONG_HEADING_WIDTH = 250;
    88// vertical size of player box
    9 const PLAYER_BOX_Y_SIZE = 30;
     9const PLAYER_BOX_Y_SIZE = 40;
    1010// gap between players boxes
    1111const PLAYER_BOX_GAP = 2;
    1212// alpha for player box
     
    1919const TRAINED_COLOR = '[color="201 255 200"]';
    2020const LOST_COLOR = '[color="255 213 213"]';
    2121const KILLED_COLOR = '[color="196 198 255"]';
     22const CAPTURED_COLOR = '[color="255 255 157"]';
    2223
    2324const BUILDINGS_TYPES = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ];
    2425const UNITS_TYPES = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship" ];
  • binaries/data/mods/public/gui/summary/summary.xml

     
    140140            <object type="image" name="noTeamsBox" size="0 65 100% 100%-50" hidden="true">
    141141                <repeat count="8">
    142142                    <object type="image" name="playerBox[n]" size="10 0 10 30" hidden="true">
    143                         <object type="image" sprite="ForegroundBox" size="10 4 34 28">
     143                        <object type="image" sprite="ForegroundBox" size="10 9 34 33">
    144144                            <object name="playerColorBox[n]" type="image" size="2 2 22 22"/>
    145145                        </object>
    146146                        <object name="playerName[n]" type="text"  size="40 2 208 100%" style="ModernLeftLabelText"/>
    147                         <object name="civIcon[n]" type="image" size="208 0 240 32"/>
     147                        <object name="civIcon[n]" type="image" size="208 5 240 37"/>
    148148                        <repeat var="x" count="8">
    149149                            <object name="valueData[n][x]" type="text" style="ModernTabLabelText">
    150150                            </object>
  • binaries/data/mods/public/simulation/components/Capturable.js

     
    103103    for (let i in this.cp)
    104104        if (this.cp[i] >= this.cp[bestPlayer])
    105105            bestPlayer = +i;
    106 
     106   
     107    var cmpLostPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
     108    if (cmpLostPlayerStatisticsTracker)
     109    {
     110        cmpLostPlayerStatisticsTracker.LostEntity(this.entity);
     111        cmpLostPlayerStatisticsTracker.CapturedBuilding(this.entity);
     112    }
    107113    cmpOwnership.SetOwner(bestPlayer);
    108114
    109115    return takenCp;
  • binaries/data/mods/public/simulation/components/StatisticsTracker.js

     
    7676        "CivCentre": 0,
    7777        "Wonder": 0,
    7878        "total": 0
    79         };
     79    };
    8080    this.buildingsLostValue = 0;
    8181    this.enemyBuildingsDestroyed = {
    8282        "House": 0,
     
    8787        "CivCentre": 0,
    8888        "Wonder": 0,
    8989        "total": 0
    90         };
    91     this.enemyBuildingsDestroyedValue = 0;
     90    };
     91    this.enemyBuildingsDestroyedValue = 0;
     92    this.buildingsCaptured = {
     93        "House": 0,
     94        "Economic": 0,
     95        "Outpost": 0,
     96        "Military": 0,
     97        "Fortress": 0,
     98        "CivCentre": 0,
     99        "Wonder": 0,
     100        "total": 0
     101    };
     102    this.buildingsCapturedValue = 0;
    92103    // resources
    93104    this.resourcesGathered = {
    94105        "food": 0,
     
    149160        "buildingsLost": this.buildingsLost,
    150161        "buildingsLostValue": this.buildingsLostValue,
    151162        "enemyBuildingsDestroyed": this.enemyBuildingsDestroyed,
    152         "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue,
     163        "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue,
     164        "buildingsCaptured": this.buildingsCaptured,
     165        "buildingsCapturedValue": this.buildingsCapturedValue,
    153166        "resourcesGathered": this.resourcesGathered,
    154167        "resourcesUsed": this.resourcesUsed,
    155168        "resourcesSold": this.resourcesSold,
     
    292305        for each (var cost in costs)
    293306            this.buildingsLostValue += cost;
    294307    }
     308};
     309
     310StatisticsTracker.prototype.CapturedBuilding = function(capturedBuilding)
     311{
     312    var cmpCapturedBuildingIdentity = Engine.QueryInterface(capturedBuilding, IID_Identity);
     313    var cmpCost = Engine.QueryInterface(capturedBuilding, IID_Cost);
     314    var costs = cmpCost.GetResourceCosts();
     315
     316    for each (var type in this.buildingsClasses)
     317        this.CounterIncrement(cmpCapturedBuildingIdentity, "buildingsCaptured", type);
     318   
     319    this.buildingsCaptured.total++;
     320   
     321    for each (var cost in costs)
     322        this.buildingsCapturedValue += cost;
    295323};
    296324
    297325/**