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