Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
gg.directive('army', function() {
return {
restrict: 'E',
template: JST['angular/templates/army'](),
transclude: true,
replace: true,
scope: {
match: '=',
entity: '=',
frame: '='
},
controller: ['$scope', function($scope) {
armyUpdate = function(v) {
if(v) { $scope.army = $scope.match.entityArmyAt($scope.entity, v); }
};
$scope.$watch('frame', armyUpdate);
}]
}
});
function updateObserverUI() {
youtube_seconds = window.theGGYTplayer.getCurrentTime();
s2_seconds = compute_s2_time(youtube_seconds);
// starcraft frames are 16ths of a second.
s2_frames = Math.floor(s2_seconds * 16.0);
// tell the angular widgets what starcraft time it is.
matchScope = angular.element($('#match')).scope();
matchScope.$apply(function() {
matchScope.current_frame = s2_frames;
});
}
function onPlayerReady(event) {
event.target.playVideo();
window.setInterval(updateObserverUI, 250);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment