@@ -1,238 +1,22 @@
<div ng-app="gameCompare" ng-controller="gameCtrl">
<game-directive></game-directive>
</div>

<div ng-if="isLoggedIn">
<h1>Just checkin to see if you're logged in</h1>
<button class="btn btn-danger name" ng-click="startBattle()" ng-if="gameOne && gameTwo"> BATTLE BEGIN!</button>
</div>
<label for="game1">Game 1</label>
<select ng-model="game1">
<option ng-repeat="games in dbGames | orderBy:'name'" value="{{games.name}}">
{{games.name}}
</option>
</select>
<label for="game2">Game 2</label>
<select ng-model="game2">
<option ng-repeat="games in dbGames | orderBy:'name'" value="{{games.name}}">
{{games.name}}
</option>
</select>
<button class="btn btn-primary" ng-click="compare(game1, game2)">Compare</button>
<br>
<!-- <div id="game1" ng-if="gameOne">
<a href="{{gameOne.url}}">
<h1 class="title">
{{gameOne.name}}
</h1>
</a>
<hr>
<img src="https:{{gameOne.cover}}" class="thumb">
<div class="reviews">
<div class="review radar" ng-if="gameOne.gamesRadarCriticScore > 0 || gameOne.gamesRadarUserScore > 0">
<a href="{{gameOne.gamesRadarUrl}}">
<p>
Gamesradar:
</p>
<p ng-class="comparing(gameOne.gamesRadarCriticScore, gameTwo.gamesRadarCriticScore)" ng-if="gameOne.gamesRadarCriticScore > 0">
Critc Score: {{gameOne.gamesRadarCriticScore}}/5
</p>
<p ng-class="comparing(gameOne.gamesRadarUserScore, gameTwo.gamesRadarUserScore)" ng-if="gameOne.gamesRadarUserScore > 0">
User Score: {{gameOne.gamesRadarUserScore}}/5
</p>
</a>
</div>
<div class="review ign" ng-if="gameOne.ignCriticScore > 0 || gameOne.ignUserScore > 0">
<a href="{{gameOne.ignUrl}}">
<p>
IGN:
</p>
<p ng-class="comparing(gameOne.ignCriticScore, gameTwo.ignCriticScore)" ng-if="gameOne.ignCriticScore > 0">
Critic Score: {{gameOneIgn.ignCriticScore}}/10
</p>
<p ng-class="comparing(gameOneIgnUser, gameTwo.ignUserScore)" ng-if="gameOne.ignUserScore > 0">
User Score: {{gameOne.ignUserScore}}/10
</p>
</a>
</div>
<div class="review metacritic" ng-if="gameOneMetaCritic > 0 || gameOneMetaUser > 0">
<a href="{{gameOneMetaUrl}}" >
<p>
Metacritic:
</p>
<p ng-class="comparing(gameOneMetaCritic, gameTwoMetaCritic)" ng-if="gameOneMetaCritic > 0">
Critic Score: {{gameOneMetaCritic}}/100
</p>
<p ng-class="comparing(gameOneMetaUser, gameTwoMetaUser)" ng-if="gameOneMetaUser > 0">
User Score: {{gameOneMetaUser}}/10
</p>
</a>
</div>
<div class="review gamespot" ng-if="gameOneSpotCritic > 0 || gameOneSpotUser > 0">
<a href="{{gameOneSpotUrl}}">
<p>
Gamespot:
</p>
<p ng-class="comparing(gameOneSpotCritic, gameTwoSpotCritic)" ng-if="gameOneSpotCritic > 0">
Critic Score: {{gameOneSpotCritic}}/10
</p>
<p ng-class="comparing(gameOneSpotUser, gameTwoSpotUser)" ng-if="gameOneSpotUser > 0">
User Score: {{gameOneSpotUser}}/10
</p>
</a>
</div>
<div class="total" ng-if="gameOneCriticTotal > 0 || gameOneUserTotal > 0">
<p>
Total:
</p>
<p ng-class="comparing(gameOneCriticTotal, gameTwoCriticTotal)">
Critic Total: {{gameOneCriticTotal}}/125
</p>
<p ng-class="comparing(gameOneUserTotal, gameTwoUserTotal)">
User Total: {{gameOneUserTotal}}/35
</p>
</div>
</div>
<div class="stats">
<div ng-repeat="company in gameOne.companies">
<p ng-if="company.developer">
Developed by: {{company.name}}
</p>
<p ng-if="company.publisher">
Published by: {{company.name}}
</p>
</div>
Release(s):
<div ng-repeat="release in gameOne.releases">
<p>
{{release.release_date}} for {{release.platform_name}}
</p>
</div>
Genre(s):
<div ng-repeat="genre in gameOne.genres">
{{genre.name}}
</div>
<br>
Themes(s):
<div ng-repeat="theme in gameOne.themes">
{{theme.name}}
</div>
<p>
Summary: {{gameOne.summary}}
</p>
<p ng-if="!gameOne.summary">
This title is awaiting a description.
<a href="{{gameOne.url}}">
Why not add one?
</a>
</p>
</div>


<div ng-app="gameCompare" ng-controller="gameCtrl">
<game-directive game-one="gameOne" game-two="gameTwo"></game-directive>
<game-directive game-one="gameTwo" game-two="gameOne"></game-directive>
</div>
<div id="game2" ng-if="gameOne">
<a href="{{gameTwo.url}}">
<h1 class="title">
{{gameTwo.name}}
</h1>
</a>
<hr>
<img src="https:{{gameTwo.cover}}" class="thumb">
<div class="reviews">
<div class="review radar" ng-if="gameTwoRadarCritic > 0 || gameTwoRadarUser > 0">
<a href="{{gameTwoRadarUrl}}">
<p>
Gamesradar:
</p>
<p ng-class="comparing(gameTwoRadarCritic, gameOneRadarCritic)" ng-if="gameTwoRadarCritic > 0">
Critc Score: {{gameTwoRadarCritic}}/5
</p>
<p ng-class="comparing(gameTwoRadarUser, gameOneRadarUser)" ng-if="gameTwoRadarUser > 0">
User Score: {{gameTwoRadarUser}}/5
</p>
</a>
</div>
<div class="review ign" ng-if="gameTwoIgnCritic > 0 || gameTwoIgnUser > 0">
<a href="{{gameTwoIgnUrl}}">
<p>
IGN:
</p>
<p ng-class="comparing(gameTwoIgnCritic, gameOneIgnCritic)" ng-if="gameTwoIgnCritic > 0">
Critic Score: {{gameTwoIgnCritic}}/10
</p>
<p ng-class="comparing(gameTwoIgnUser, gameOneIgnUser)" ng-if="gameTwoIgnUser > 0">
User Score: {{gameTwoIgnUser}}/10
</p>
</a>
</div>
<div class="review metacritic" ng-if="gameTwoMetaCritic > 0 || gameTwoMetaUser > 0">
<a href="{{gameTwoMetaUrl}}">
<p>
Metacritic:
</p>
<p ng-class="comparing(gameTwoMetaCritic, gameOneMetaCritic)" ng-if="gameTwoMetaCritic > 0">
Critic Score: {{gameTwoMetaCritic}}/100
</p>
<p ng-class="comparing(gameTwoMetaUser, gameOneMetaUser)" ng-if="gameTwoMetaUser > 0" >
User Score: {{gameTwoMetaUser}}/10
</p>
</a>
</div>
<div class="review gamespot" ng-if="gameTwoSpotCritic > 0 || gameTwoSpotUser > 0">
<a href="{{gameTwoSpotUrl}}">
<p>
Gamespot:
</p>
<p ng-class="comparing(gameTwoSpotCritic, gameOneSpotCritic)" ng-if="gameTwoSpotCritic > 0">
Critic Score: {{gameTwoSpotCritic}}/10
</p>
<p ng-class="comparing(gameTwoSpotUser, gameOneSpotUser)" ng-if="gameTwoSpotUser > 0">
User Score: {{gameTwoSpotCritic}}/10
</p>
</a>
</div>
<div class="total" ng-if="gameTwoCriticTotal > 0 || gameTwoUserTotal > 0">
<p>
Total:
</p>
<p ng-class="comparing(gameTwoCriticTotal, gameOneCriticTotal)">
Critic Total: {{gameTwoCriticTotal}}/125
</p>
<p ng-class="comparing(gameTwoUserTotal, gameOneUserTotal)">
User Total: {{gameTwoUserTotal}}/35
</p>
</div>
</div>
<div class="stats">
<div ng-repeat="company in gameTwo.companies">
<p ng-if="company.developer">
Developed by: {{company.name}}
</p>
<p ng-if="company.publisher">
Published by: {{company.name}}
</p>
</div>
Release(s):
<div ng-repeat="release in gameTwo.releases">
<p>
{{release.release_date}} for {{release.platform_name}}
</p>
</div>
Genre(s):
<div ng-repeat="genre in gameTwo.genres">
{{genre.name}}
</div>
<br>
Themes(s):
<div ng-repeat="theme in gameTwo.themes">
{{theme.name}}
</div>
<p>
Summary: {{gameTwo.summary}}
</p>
<p ng-if="!gameTwo.summary">
This title is awaiting a description.
<a href="{{gameTwo.url}}">
Why not add one?
</a>
</p>
</div>
</div> -->
@@ -3,7 +3,7 @@
angular.module('gameCompare')

.controller('gameCtrl', function($scope, $http, ENV, UserService, GameService, $cookies, jwtHelper, $location, ScopeMaster){
$scope.grape = "on The ground"
console.log("STARTING GAME ONE SCOPE", $scope.gameOne);
GameService.load()
.then( function victory(resp) {
console.log("INFO:", resp.data);
@@ -23,6 +23,7 @@ angular.module('gameCompare')
{$scope.isLoggedIn = true;}
})
$scope.comparing = function(score1, score2){
console.log("COMPARISON TOTALED UP!");
return GameService.compareGames(score1, score2)
}
$scope.startBattle = function(){
@@ -44,17 +45,32 @@ angular.module('gameCompare')
games.game2 = game2;
GameService.startBattle(games).then(function victory(resp){
$scope.gameOne = ScopeMaster.setScopes(resp.data[0][0])
console.log("WHOAH THERE BOY", typeof $scope.gameOne);
console.log("GAME ONE SCOPE", $scope.gameOne);
$scope.gameTwo = ScopeMaster.setScopes(resp.data[1][0])
console.log("GAME TWO SCOPE", $scope.gameTwo);
}, function failure(err){
console.log(err);
})
}
})
.directive("gameDirective", function() {
return {
restrict: 'E',
templateUrl: "views/game-view.html"
};
return {
restrict: 'AE',
scope: {
gameOne: "=",
gameTwo: "=",
},
templateUrl: "views/game-view.html"
// ,
// link: function(scope, element, attr){
// scope.gameOne = attr.gameOne
// scope.$watch(function(){return attr.gameOne}, function(n,o){
// console.log("NO", n,o);
// })
// console.log("THIS IS THING", attr.gameOne);
// }
};
})