mirror of
https://github.com/wassname/cardsforscience.git
synced 2026-07-31 12:10:07 +08:00
achievement board init
This commit is contained in:
committed by
Tadej Novak
parent
ea679e2e68
commit
2f359c7da1
+17
@@ -138,6 +138,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="Achievements" role="dialog" tabindex="-1" ng-controller="AchievementsController as ac">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<p>Yo! You Have A New Achievement!</p>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul>
|
||||
<li ng-repeat="acc in ac.achievements">
|
||||
<p ng-show="!(!acc.completed || acc.displayed)">{{acc.description}}</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
|
||||
<script src="//d3js.org/d3.v3.min.js"></script>
|
||||
|
||||
@@ -50,6 +50,15 @@ var achievements =
|
||||
achievements.list[i].completed = true;
|
||||
}
|
||||
}
|
||||
|
||||
$('#Achievements').scope().displayAchievements();
|
||||
},
|
||||
|
||||
// i'm a bit sleepy now, so not thinking about relation between add** functions and update
|
||||
// so this function might not be necessary
|
||||
pureUpdate: function()
|
||||
{
|
||||
$('#Achievements').scope().displayAchievements();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+13
-2
@@ -227,7 +227,18 @@
|
||||
this.upgrades = upgrades;
|
||||
});
|
||||
|
||||
app.controller('AchievementsController', function () {
|
||||
this.achievements = achievements.list;
|
||||
app.controller('AchievementsController', function ($scope) {
|
||||
$scope.achievements = achievements.list;
|
||||
|
||||
$scope.displayAchievements = function(){
|
||||
// newachievements = [ac for (ac in this.achievements) if (ac.completed == true && ac.displayed == false)];
|
||||
for (var i=0;i<$scope.achievements.length;i++){
|
||||
if ($scope.achievements[i].completed == true && $scope.achievements[i].displayed == false){
|
||||
alert("Yo!");
|
||||
alert($scope.achievements[i].description);
|
||||
$scope.achievements[i].displayed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
+15
-2
@@ -6,6 +6,7 @@
|
||||
"type": "research",
|
||||
"target": "Z-Boson",
|
||||
"threshold": 1,
|
||||
"displayed": false,
|
||||
"image": "assets/Z.png"
|
||||
},
|
||||
{
|
||||
@@ -15,15 +16,27 @@
|
||||
"type": "research",
|
||||
"target": "top-Quark",
|
||||
"threshold": 1,
|
||||
"displayed": false,
|
||||
"image": "assets/t.png"
|
||||
},
|
||||
{
|
||||
"name": "Hired First Nobel Prize Winner",
|
||||
"description": "Achievement: Yo! You have hired your first nobel prize winner!",
|
||||
"name": "Hired First PhD",
|
||||
"description": "Achievement: Yo! You have hired your first PhD!",
|
||||
"difficulty": "5",
|
||||
"type": "workers",
|
||||
"target": "PhD Students",
|
||||
"threshold": 1,
|
||||
"displayed": false,
|
||||
"image": "assets/W.png"
|
||||
},
|
||||
{
|
||||
"name": "Hired First Posdoc",
|
||||
"description": "Achievement: Yo! You have hired your first POST DOC!",
|
||||
"difficulty": "5",
|
||||
"type": "workers",
|
||||
"target": "Postdocs",
|
||||
"threshold": 1,
|
||||
"displayed": false,
|
||||
"image": "assets/W.png"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user