Init-Timer angepasst, SpielTimer eingebaut, Klickfix eingebaut, Belohung vorbereitet

This commit is contained in:
Hilmer, Carsten 2016-11-10 15:15:02 +01:00
parent 4e5f686332
commit 3dc355bf6f
11 changed files with 156 additions and 71 deletions

View File

@ -91,13 +91,6 @@ to {background-position: -2000px 0;}
border-width: 2px;
}
.myborder:active {
background-color: #3e8e41;
box-shadow: 0 5px #666;
transform: translateY(4px);
}
.mentorhilfe {
position: absolute;

View File

@ -74,6 +74,7 @@ angular.module('kinderspiel', ['ionic', 'ngCordova','ngAnimate', 'ngDraggable',
navigator.app.exitApp();
}
else {
navigator.app.backHistory();
}
}, 100);

View File

@ -4,7 +4,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
* Mentor-Anitmation ausschalten
*/
$scope.showmentor=false;
$scope.CSSKlickSuchspiel=false;
/*
* Hintergrundmusik laden und starten
*/
@ -18,6 +18,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
* Suchspiel wurde angeklickt, Sound abspielen, Mentor-Animation starten
*/
$scope.suchspiel_intro = function(){
$scope.CSSKlickSuchspiel=true;
$scope.showmentor=true;
$scope.mediastartesuchspiel.play();
$scope.mediastartesuchspiel.setVolume('1.0');
@ -27,6 +28,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
* Suchspiel Sound ist beendet, Mentor-Animation ausschalten, Suchspiel starten
*/
function suchspiel_intro_finish() {
$scope.CSSKlickSuchspiel=false;
$scope.mediastartesuchspiel.release();
$scope.showmentor=false;
$state.go('suchspiel');

View File

@ -23,9 +23,20 @@ $scope.cardindex=0;
//CSS-Steuerung (alias für addClass)
$scope.CSSErrorCode=99;
$scope.CSSAusblendung=-1;
$scope.CSSEinblendung=-1;
$scope.CSSAusblendung='';
$scope.CSSEinblendung='';
$scope.CSSFalscheAntwort = false;
$scope.CCSInittimer = false;
//SpieleTimer
$scope.Spielzeit = 180;
$scope.showgametimer = false;
//Spielzeit vorbei
$scope.spielvorbei=false;
$scope.beantwortet=false;
$ionicPlatform.ready(function() {
@ -52,6 +63,7 @@ $ionicPlatform.ready(function() {
var kartegebensound = new Media('/android_asset/www/sounds/karte.mp3', kartegeben,null);
/*
* Sounds in $Scope referenzieren
*/
@ -190,7 +202,7 @@ $scope.hilfe = function() {
* Mentor ausblenden, nach Soundausgabe
*/
function mentorausblenden(){
$timeout(function () { $scope.showmentor=false; $scope.cardindex=-1}, 10);
$timeout(function () { $scope.showmentor=false; $scope.cardindex=0}, 10);
}
@ -199,12 +211,23 @@ function mentorausblenden(){
* Antwort prüfen
*/
$scope.PlayerAnswer = function(src) {
/*
* Einblende-effekte zurücksetzen
*/
$scope.CSSEinblendung='';
if ($scope.beantwortet==false){
/*
* Antwort ist richtig
*/
$scope.beantwortet=true;
if (src==$scope.randomid){
$timeout(function () { $scope.showmentorbravo=true;$scope.cardindex=0; }, 0);
$timeout(function () {
$scope.showmentorbravo=true;
$scope.cardindex=0;
}, 0);
$scope.bravosound.play();
}
else{
@ -213,15 +236,20 @@ $scope.PlayerAnswer = function(src) {
* Antwort war dreimal falsch
*/
if ($scope.falscheantwort==2){
/*
* Richtige Karte pulsieren lassen
*/
$scope.CSSErrorCode=$scope.randomid;
$scope.CSSFalscheAntwort= false;
/*
* Nach 3 sekunden Fehler zurücksetzen und Karten neu vergeben
*/
$timeout(function () {
$scope.CSSErrorCode=99;
$timeout(function () {
$scope.CSSErrorCode=$scope.randomid;
$timeout(function () { $scope.cardindex=0;karteausblenden(); }, 2400);
}, 1400);
}, 700);
$scope.cardindex=0;
karteausblenden();
}, 3000);
}
else {
@ -232,10 +260,13 @@ $scope.PlayerAnswer = function(src) {
$scope.CSSFalscheAntwort = true;
$timeout(function () {
$scope.CSSFalscheAntwort = false;
$scope.beantwortet=false;
$scope.falscheantwort=$scope.falscheantwort + 1
}, 1000);
}
}
}
}
@ -245,12 +276,13 @@ $scope.PlayerAnswer = function(src) {
function goto_newspiel(){
$scope.CSSErrorCode=99;
$scope.falscheantwort=0;
$scope.CSSEinblendung=0;
$scope.cardindex=-1;
$scope.CSSEinblendung='';
$scope.cardindex=0;
kartenmischen();
$timeout(function () { $scope.kartegebensound.play(); }, 2000);
//$timeout(function () { $scope.kartegebensound.play(); }, 2000);
kartegeben();
}
@ -259,31 +291,41 @@ function goto_newspiel(){
*/
function kartegeben(){
$timeout(function () {
$scope.cardindex=$scope.cardindex + 1;
$scope.spielelistensort[$scope.cardindex].display=true;
for(var i = 0; i < $scope.spiele.length; i++) {
var data= $scope.spiele[i];
if (data.id==$scope.spielelistensort[$scope.cardindex].id){
$scope.CSSEinblendung=data.einblendecssid;
console.log("Einblende Schleife ID: " + $scope.CSSEinblendung);
}
}
$scope.cardindex=$scope.cardindex + 1;
}, 0);
/*
* Interner Zähler bis alle Karten gegeben wurden
*/
if ($scope.cardindex < 6 ){
if ($scope.cardindex < 7 ){
$scope.kartegebensound.play();
}
else{
$scope.CSSEinblendung='';
/*
* Zufallszahl 3x mal generieren lassen, zufälliger
*/
$scope.randomid=getRandomInt(0, 7);
$scope.randomid=getRandomInt(0, 7);
$scope.randomid=getRandomInt(0, 7);
/*
* Mentor anzeigen und Sound wiedergeben
*/
$scope.showmentor=true;
$scope.sounds[$scope.randomid].play();
console.log("ELSE-Zweig Einblende -ID: " + $scope.CSSEinblendung);
console.log("CardIndex: " + $scope.cardindex);
}
console.log("Einblende funktion ID: " + $scope.CSSEinblendung);
}
/*
@ -292,6 +334,8 @@ function kartegeben(){
function karteausblenden(){
$timeout(function () { $scope.showmentorbravo=false; }, 0);
if ($scope.spielvorbei==false){
if ($scope.cardindex < 8 ){
for(var i = 0; i < $scope.spiele.length; i++) {
@ -308,14 +352,40 @@ function karteausblenden(){
}, 500);
}
else{
$scope.beantwortet=false;
$scope.CSSAusblendung='';
goto_newspiel();
}
}
else{
//Belohnung hier rein
$state.go('home');
}
}
/*
* SpieleTimer Funktion
*/
function SpieleTimer(){
if ($scope.Spielzeit > 0){
$scope.Spielzeit=$scope.Spielzeit - 1;
$timeout(function () {
SpieleTimer();
}, 1000);
}
else{
$scope.spielvorbei=true;
}
}
/*
* Drei mal mischen :)
*/
@ -391,20 +461,34 @@ function chunk(arr, size) {
*/
$scope.inittimercounter=3;
$scope.showinittimer=true;
$timeout(function () { inittimer(); }, 1000);
$scope.CCSInittimer=true;
$timeout(function () {
$scope.CCSInittimer=false;
inittimer();
}, 1500);
function inittimer(){
$scope.CCSInittimer=true;
if ($scope.inittimercounter > 0){
$scope.inittimercounter=$scope.inittimercounter - 1;
$timeout(function () {
$scope.inittimercounter=$scope.inittimercounter - 1;
$scope.CCSInittimer=false;
inittimer();
}, 1000);
}
else{
$scope.inittimercounter='Los gehts!';
$timeout(function () {
$scope.showinittimer=false;
$scope.showgametimer = true;
SpieleTimer();
goto_newspiel();
}, 1500);
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@
<div class="row">
<div style="width: 100%; text-align: center;" class="col">
<img class="myborder" src="img/elefant.jpg" height="128" width="128" ng-click="suchspiel_intro()">
<img ng-class="{'expandOpen': CSSKlickSuchspiel}" class="myborder" src="img/elefant.jpg" height="128" width="128" ng-click="suchspiel_intro()">
</div>
</div>
<div class="baumhaus">

View File

@ -3,13 +3,15 @@
<div class="row" style="font-size: 12px;padding-top:55px;" ng-show="showinittimer">
<div style="width: 100%; text-align: center;" class="col">
<div ng-class="{'slideUp': CCSInittimer}">
<span class="neon">{{inittimercounter}}</span>
</div>
</div>
</div>
<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, 'rubberBand': CSSErrorCode == '{{item.id}}', 'bounceOut': CSSAusblendung == '{{item.ausblendecssid}}', 'tada': CSSEinblendung == '{{item.einblendecssid}}'}" class="myborder animated" src="img/{{ item.bild }}"width="96" height="96" alig="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}}'}" class="myborder animated" src="img/{{ item.bild }}"width="96" height="96" alig="center" ng-click="PlayerAnswer(item.id)" ng-show="item.display">
<br>
</div>
</div>
@ -20,6 +22,9 @@
<div class="mentor"></div>
</div>
</div>
<div ng-show="showgametimer">
<span class="neon pulse">{{ Spielzeit }}</span>
</div>
<div>