Spieletimer wartet bis karten gegeben sind
This commit is contained in:
parent
84b593fad2
commit
9dec447be8
@ -13,10 +13,14 @@ appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $
|
||||
|
||||
//Globale-Sounddatei
|
||||
var mentorsound='';
|
||||
var boingsound='';
|
||||
var farmhaussound='';
|
||||
var windradsound='';
|
||||
var kornspeichersound='';
|
||||
|
||||
var mentor_is_speakting=false;
|
||||
var boing_is_sounding=false;
|
||||
var farmhaus_is_sounding=false;
|
||||
var windrad_is_sounding=false;
|
||||
var kornspeicher_is_sounding=false;
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
/*
|
||||
@ -80,7 +84,7 @@ appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $
|
||||
|
||||
//Soundfile freigeben
|
||||
mentorsound.release();
|
||||
|
||||
mentor_is_speakting=false;
|
||||
$scope.CSSKlickSuchspiel=false;
|
||||
$scope.showmentor=false;
|
||||
$state.go('suchspiel');
|
||||
@ -88,30 +92,19 @@ appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $
|
||||
|
||||
$scope.animate_farmhaus=function(){
|
||||
$scope.CSSFarmhaus=true;
|
||||
playsound('boingsound', $scope.boingsound_action[getRandomInt(0, $scope.boingsound_action.length - 1)], boingsound_stop,'1.0');
|
||||
$timeout(function () {
|
||||
$scope.CSSFarmhaus=false;
|
||||
}, 2000);
|
||||
playsound('farmhaussound', $scope.boingsound_action[getRandomInt(0, $scope.boingsound_action.length - 1)], farmhaussound_stop,'1.0');
|
||||
}
|
||||
|
||||
|
||||
$scope.animate_windrad=function(){
|
||||
$scope.CSSWindrad=true;
|
||||
playsound('boingsound', $scope.boingsound_action[getRandomInt(0, $scope.boingsound_action.length - 1)], boingsound_stop,'1.0');
|
||||
$timeout(function () {
|
||||
$scope.CSSWindrad=false;
|
||||
}, 2000);
|
||||
playsound('windradsound', $scope.boingsound_action[getRandomInt(0, $scope.boingsound_action.length - 1)], windradsound_stop,'1.0');
|
||||
}
|
||||
|
||||
|
||||
$scope.animate_kornspeicher=function(){
|
||||
//SetBackgroundpic
|
||||
//$rootScope.backgroundimage = "img/ufo.png";
|
||||
$scope.CSSKornspeicher=true;
|
||||
playsound('boingsound', $scope.boingsound_action[getRandomInt(0, $scope.boingsound_action.length - 1)], boingsound_stop,'1.0');
|
||||
$timeout(function () {
|
||||
$scope.CSSKornspeicher=false;
|
||||
}, 2000);
|
||||
playsound('kornspeichersound', $scope.boingsound_action[getRandomInt(0, $scope.boingsound_action.length - 1)], kornspeichersound_stop,'1.0');
|
||||
}
|
||||
|
||||
$scope.baumhaus_actiondo=function(){
|
||||
@ -131,15 +124,15 @@ appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $
|
||||
$ionicPlatform.ready(function() {
|
||||
|
||||
|
||||
if (playtype=='boingsound'){
|
||||
if (playtype=='farmhaussound'){
|
||||
|
||||
|
||||
if (boing_is_sounding==false){
|
||||
if (farmhaus_is_sounding==false){
|
||||
|
||||
try{
|
||||
|
||||
//versuchen Soundfile freizugeben
|
||||
boingsound.release();
|
||||
farmhaussound.release();
|
||||
}
|
||||
catch(e){
|
||||
|
||||
@ -147,10 +140,54 @@ appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $
|
||||
console.log("Sounddatei nicht da");
|
||||
}
|
||||
|
||||
boingsound = new Media(soundfile, callbackfunction ,null);
|
||||
boingsound.play();
|
||||
boingsound.setVolume(volume);
|
||||
boing_is_sounding=true;
|
||||
farmhaussound = new Media(soundfile, callbackfunction ,null);
|
||||
farmhaussound.play();
|
||||
farmhaussound.setVolume(volume);
|
||||
farmhaus_is_sounding=true;
|
||||
}
|
||||
}
|
||||
else if (playtype=='windradsound'){
|
||||
|
||||
|
||||
if (windrad_is_sounding==false){
|
||||
|
||||
try{
|
||||
|
||||
//versuchen Soundfile freizugeben
|
||||
windradsound.release();
|
||||
}
|
||||
catch(e){
|
||||
|
||||
//Soundfile Objekt gabs nicht oder Freigabefehler
|
||||
console.log("Sounddatei nicht da");
|
||||
}
|
||||
|
||||
windradsound = new Media(soundfile, callbackfunction ,null);
|
||||
windradsound.play();
|
||||
windradsound.setVolume(volume);
|
||||
windrad_is_sounding=true;
|
||||
}
|
||||
}
|
||||
else if (playtype=='kornspeichersound'){
|
||||
|
||||
|
||||
if (kornspeicher_is_sounding==false){
|
||||
|
||||
try{
|
||||
|
||||
//versuchen Soundfile freizugeben
|
||||
kornspeichersound.release();
|
||||
}
|
||||
catch(e){
|
||||
|
||||
//Soundfile Objekt gabs nicht oder Freigabefehler
|
||||
console.log("Sounddatei nicht da");
|
||||
}
|
||||
|
||||
kornspeichersound = new Media(soundfile, callbackfunction ,null);
|
||||
kornspeichersound.play();
|
||||
kornspeichersound.setVolume(volume);
|
||||
kornspeicher_is_sounding=true;
|
||||
}
|
||||
}
|
||||
else if (playtype=='mentorsound'){
|
||||
@ -180,10 +217,28 @@ appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $
|
||||
|
||||
}
|
||||
|
||||
function boingsound_stop(){
|
||||
//Soundfile freigeben
|
||||
boingsound.release();
|
||||
boing_is_sounding=false;
|
||||
function windradsound_stop(){
|
||||
|
||||
$timeout(function () { $scope.CSSWindrad=false; }, 0);
|
||||
windradsound.release();
|
||||
windrad_is_sounding=false;
|
||||
|
||||
}
|
||||
|
||||
function kornspeichersound_stop(){
|
||||
|
||||
$timeout(function () { $scope.CSSKornspeicher=false; }, 0);
|
||||
kornspeichersound.release();
|
||||
kornspeicher_is_sounding=false;
|
||||
|
||||
}
|
||||
|
||||
function farmhaussound_stop(){
|
||||
|
||||
$timeout(function () { $scope.CSSFarmhaus=false; }, 0);
|
||||
farmhaussound.release();
|
||||
farmhaus_is_sounding=false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,9 +28,11 @@ $scope.CSSAusblendung='';
|
||||
$scope.CSSEinblendung='';
|
||||
$scope.CSSFalscheAntwort = false;
|
||||
$scope.CCSInittimer = false;
|
||||
$scope.CSSKlickedItem = 99;
|
||||
|
||||
//SpieleTimer
|
||||
$scope.Spielzeit = 10;
|
||||
$scope.Spielzeit = 90;
|
||||
$scope.SpielzeitTimerWait=false;
|
||||
$scope.showgametimer = false;
|
||||
|
||||
//Spielzeit vorbei
|
||||
@ -217,14 +219,27 @@ function mentorausblenden(){
|
||||
*/
|
||||
$scope.PlayerAnswer = function(src) {
|
||||
|
||||
|
||||
if ($scope.gamelock==false){
|
||||
|
||||
/*
|
||||
* Item wurde geklickt, hüpfen lassen
|
||||
*/
|
||||
$scope.CSSKlickedItem = src;
|
||||
|
||||
/*
|
||||
* Item wurde geklickt, zurücksetzen
|
||||
*/
|
||||
$timeout(function () {
|
||||
$scope.CSSKlickedItem = 99;
|
||||
}, 1000);
|
||||
|
||||
/*
|
||||
* Einblende-effekte zurücksetzen
|
||||
*/
|
||||
$scope.CSSEinblendung='';
|
||||
|
||||
|
||||
/*
|
||||
* Prüfen ob schon einmal geklickt wurde
|
||||
*/
|
||||
@ -341,10 +356,13 @@ function kartegeben(){
|
||||
}
|
||||
$scope.cardindex=$scope.cardindex + 1;
|
||||
}, 0);
|
||||
|
||||
/*
|
||||
* Interner Zähler bis alle Karten gegeben wurden
|
||||
*/
|
||||
if ($scope.cardindex < 7 ){
|
||||
//Spielzeit anhalten
|
||||
$timeout(function () { $scope.SpielzeitTimerWait = true; }, 0);
|
||||
playsound('gamesound', $scope.kartegebensound, kartegeben,'1.0');
|
||||
}
|
||||
else{
|
||||
@ -358,15 +376,23 @@ function kartegeben(){
|
||||
$scope.gamelock=false;
|
||||
//Zeit messen
|
||||
$scope.rundenstart = new Date().getTime();
|
||||
|
||||
//Spielzeit laufen lassen
|
||||
$timeout(function () { $scope.SpielzeitTimerWait=false; }, 0);
|
||||
|
||||
/*
|
||||
* Mentor anzeigen und Sound wiedergeben
|
||||
*/
|
||||
$scope.showmentor=true;
|
||||
|
||||
playsound('gamesound', $scope.spiele[$scope.randomid].sound, mentorausblenden,'1.0');
|
||||
|
||||
console.log("ELSE-Zweig Einblende -ID: " + $scope.CSSEinblendung);
|
||||
console.log("CardIndex: " + $scope.cardindex);
|
||||
console.log("Zufallsid: " + $scope.randomid);
|
||||
console.log("Tiersuchen: " + $scope.spiele[$scope.randomid].bild);
|
||||
console.log("SpieleTimerWait: " + $scope.SpielzeitTimerWait)
|
||||
|
||||
}
|
||||
console.log("Einblende funktion ID: " + $scope.CSSEinblendung);
|
||||
}
|
||||
@ -378,6 +404,9 @@ function karteausblenden(){
|
||||
|
||||
$timeout(function () { $scope.showmentorbravo=false; $scope.showmentor=false;}, 0);
|
||||
|
||||
//Spielzeit anhalten
|
||||
$scope.SpielzeitTimerWait=true;
|
||||
|
||||
if ($scope.spielvorbei==false){
|
||||
|
||||
if ($scope.cardindex < 8 ){
|
||||
@ -438,11 +467,18 @@ function minispielintro(){
|
||||
function SpieleTimer(){
|
||||
if ($scope.Spielzeit > 0){
|
||||
|
||||
|
||||
if ($scope.SpielzeitTimerWait == false){
|
||||
|
||||
$scope.Spielzeit=$scope.Spielzeit - 1;
|
||||
|
||||
}
|
||||
$timeout(function () {
|
||||
SpieleTimer();
|
||||
}, 1000);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
$scope.spielvorbei=true;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
<div class="row" style="font-size: 12px;padding-top:35px;" ng-repeat="rows in chunkedData">
|
||||
<div style="width: 100%; text-align: center;" class="col" ng-repeat="item in rows">
|
||||
<img ng-class="{'shake': CSSFalscheAntwort, 'pulse': CSSErrorCode == '{{item.id}}', 'bounceOut': CSSAusblendung == '{{item.ausblendecssid}}', 'tada': CSSEinblendung == '{{item.einblendecssid}}'}" class="myborder animated imagesizemedium" src="{{ item.bild }}" align="center" ng-click="PlayerAnswer(item.id)" ng-show="item.display">
|
||||
<img ng-class="{'shake': CSSFalscheAntwort, 'pulse': CSSErrorCode == '{{item.id}}', 'bounceOut': CSSAusblendung == '{{item.ausblendecssid}}', 'tada': CSSEinblendung == '{{item.einblendecssid}}', 'expandOpen': CSSKlickedItem == '{{item.id}}'}" class="myborder animated imagesizemedium" src="{{ item.bild }}" align="center" ng-click="PlayerAnswer(item.id)" ng-show="item.display">
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user