Skip to content

Commit 61bba8e

Browse files
committed
Adding supply cap information
I have added a graphic showing the supply. I need to improve variable names in javascript and sperate the graphic for both player. For each player I still have to remove the engagement highlight and put one for supply block.
1 parent ace84f5 commit 61bba8e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/assets/javascripts/angular/resources/match.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
518518
replayminerals: {teams: [], entities: []},
519519
replaygas: {teams: [], entities: []},
520520
replayworkers: {teams: [], entities: []},
521+
replayworkerscap: {teams: [], entities: []},
521522
};
522523

523524
// Generate army chart series from armies?
@@ -568,6 +569,14 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
568569
// console.log("statarray", result);
569570
return result;
570571
}
572+
573+
supply = function(supplyusage){
574+
var currentSupply = [];
575+
for (var frame=0; frame<supplyusage.length; frame++) {
576+
currentSupply.push(supplyusage[frame][0]);
577+
}
578+
return currentSupply;
579+
}
571580

572581
// console.log("in series getter, this.armies = ", this.armies);
573582

@@ -602,6 +611,8 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
602611
this._series.replayminerals.entities[_entity] = $.extend({data: statx(this.MineralsCurrent[entity.identity.id])}, base_series);
603612
this._series.replaygas.entities[_entity] = $.extend({data: statx(this.VespeneCurrent[entity.identity.id])}, base_series);
604613
this._series.replayworkers.entities[_entity] = $.extend({data: statx(this.WorkersActiveCount[entity.identity.id])}, base_series);
614+
this._series.replayworkerscap.entities[_entity] = $.extend({data: statx(supply(this.SupplyUsage[entity.identity.id]))}, base_series);
615+
console.log(this._series.replayworkerscap.entities[_entity] );
605616

606617
if (entity.identity.id in this.MineralsCollectionRate) {
607618
zippedIncome = _.zip(this.MineralsCollectionRate[entity.identity.id], this.VespeneCollectionRate[entity.identity.id]);
@@ -681,7 +692,7 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
681692
// Add the team series
682693
for(var _team in this.teams) {
683694

684-
_keys = ['summary_army', 'summary_income', 'summary_workersactive', 'summary_upgradespending', 'apm', 'wpm', 'creep_spread', 'replayincome', 'replaygasincome', 'replaylost', 'replayminerals', 'replaygas', 'replayworkers', 'replaytotalincome'];
695+
_keys = ['summary_army', 'summary_income', 'summary_workersactive', 'summary_upgradespending', 'apm', 'wpm', 'creep_spread', 'replayincome', 'replaygasincome', 'replaylost', 'replayminerals', 'replaygas', 'replayworkers', 'replayworkerscap', 'replaytotalincome'];
685696
for(var _stype in _keys) {
686697
_stype = _keys[_stype];
687698

app/views/matches/show.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ completed to when 3x640 = 1920 minerals per minute income is achieved." data-gra
241241
<chart id="replayworkers" class="grid_1 djcloak" ng-show="$parent.match.MineralsCurrent" data-series="match.series.replayworkers.combined" data-condensed="condensed" data-replaystats="true">
242242
<span class="title">workers active</span>
243243
</chart>
244+
<chart id="replaysupply" class="grid_1 djcloak" ng-show="$parent.match.MineralsCurrent" data-series="match.series.replayworkerscap.combined" data-condensed="condensed" data-replaystats="true">
245+
<span class="title">Supply</span>
246+
</chart>
244247

245248
<% if @match.summaries? %>
246249
<chart id="income" class="grid_1" ng-hide="$parent.match.ended_at > '2013-05-06'" data-series="match.series.summary_income.combined" data-condensed="condensed">

0 commit comments

Comments
 (0)