Komplettes refactoring, Auslagerung von Sounds und Bilder in Spielsets

This commit is contained in:
Hilmer, Carsten 2016-11-18 12:54:47 +01:00
parent 3179418b74
commit 7f029d490b
144 changed files with 330 additions and 348 deletions

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,4 +1,4 @@
appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia, $state, backgroundsounds_mediahandler, $timeout ) {
appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia, $state, backgroundsounds_mediahandler, $timeout, $http ) {
/*
* Mentor-Anitmation ausschalten
@ -9,45 +9,60 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
$scope.CSSWindrad=false;
$scope.CSSKornspeicher=false;
$scope.baumhauszufallaction=99;
/*
* Hintergrundmusik laden und starten
*/
$ionicPlatform.ready(function() {
//Globale-Sounddatei
var gamesound='';
$scope.baumhaus_action=[];
$scope.mediastartesuchspiel='';
var mediastartesuchspiel = new Media('/android_asset/www/sounds/soundsneu/spiel_intro.mp3', suchspiel_intro_finish,null);
/*
* Spiele IntroSounds laden
*/
$http.get('spielsets/introsounds.json').success(function(data) {
var baumhaus_action1 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_1.mp3', baumhaus_mentor,null);
var baumhaus_action2 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_2.mp3', baumhaus_mentor,null);
var baumhaus_action3 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_3.mp3', baumhaus_mentor,null);
var baumhaus_action4 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_4.mp3', baumhaus_mentor,null);
for(var i = 0; i < data.length; i++) {
$scope.mediastartesuchspiel=mediastartesuchspiel;
backgroundsounds_mediahandler.playbackgroundmusic();
if (data[i].type=='baumhaus'){
$scope.baumhaus_action.push(data[i].sound);
}
else if (data[i].type=='startgamesuchspiel'){
$scope.mediastartesuchspiel=data[i].sound;
}
else if (data[i].type=='backgroundmusic'){
backgroundsounds_mediahandler.setbackgroundsoundfile(data[i].sound);
backgroundsounds_mediahandler.playbackgroundmusic();
}
$scope.baumhaus_action.push(baumhaus_action1);
$scope.baumhaus_action.push(baumhaus_action2);
$scope.baumhaus_action.push(baumhaus_action3);
$scope.baumhaus_action.push(baumhaus_action4);
});
}//for-Schleife
});//$http
});//$ionicPlatform
/*
* Suchspiel wurde angeklickt, Sound abspielen, Mentor-Animation starten
*/
$scope.suchspiel_intro = function(){
$scope.CSSKlickSuchspiel=true;
$scope.CSSKlickSuchspiel=true;
$scope.showmentor=true;
$scope.mediastartesuchspiel.play();
$scope.mediastartesuchspiel.setVolume('1.0');
playsound($scope.mediastartesuchspiel, suchspiel_intro_finish,'1.0');
}
/*
* Suchspiel Sound ist beendet, Mentor-Animation ausschalten, Suchspiel starten
*/
function suchspiel_intro_finish() {
//Soundfile freigeben
gamesound.release();
$scope.CSSKlickSuchspiel=false;
$scope.mediastartesuchspiel.release();
$scope.showmentor=false;
$state.go('suchspiel');
}
@ -56,7 +71,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
$scope.CSSFarmhaus=true;
$timeout(function () {
$scope.CSSFarmhaus=false;
}, 5000);
}, 2000);
}
@ -64,7 +79,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
$scope.CSSWindrad=true;
$timeout(function () {
$scope.CSSWindrad=false;
}, 5000);
}, 2000);
}
@ -72,23 +87,38 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
$scope.CSSKornspeicher=true;
$timeout(function () {
$scope.CSSKornspeicher=false;
}, 5000);
}, 2000);
}
$scope.baumhaus_actiondo=function(){
$scope.baumhauszufallaction=getRandomInt(1,5);
if ($scope.baumhauszufallaction==3){
$scope.baumhauszufallaction=getRandomInt(1,2);
if ($scope.baumhauszufallaction==2){
$scope.showmentor=true;
$scope.baumhaus_action[getRandomInt(0,3)].play();
$scope.mediastartesuchspiel.setVolume('1.0');
playsound($scope.baumhaus_action[getRandomInt(0, $scope.baumhaus_action.length - 1)], baumhaus_mentor,'1.0');
}
}
/*
* Play-Sound
*/
function playsound(soundfile, callbackfunction, volume){
$ionicPlatform.ready(function() {
gamesound = new Media(soundfile, callbackfunction ,null);
gamesound.play();
gamesound.setVolume(volume);
});
}
function baumhaus_mentor(){
$timeout(function () {
$scope.showmentor=false;
//Soundfile freigeben
gamesound.release();
//Baumhausmentor ausblenden
$timeout(function () {
$scope.showmentor=false;
}, 0);
}

View File

@ -11,8 +11,12 @@ angular.module('kinderspiel.services', [])
* Soundfiles Variablen
*/
var backgroundmusic='';
var backgroundmusicsoundfile='';
$ionicPlatform.ready(function() {
var mybackground_music = new Media('/android_asset/www/sounds/background/backgound4.mid', loopbackgroundmusic ,null);
backgroundmusicsoundfile='/android_asset/www/sounds/background/background4.mid';
var mybackground_music = new Media(backgroundmusicsoundfile, loopbackgroundmusic ,null);
backgroundmusic=mybackground_music;
});
@ -34,6 +38,15 @@ angular.module('kinderspiel.services', [])
backgroundmusic.setVolume('0.3');
}
},
setbackgroundsoundfile: function(soundfile) {
$ionicPlatform.ready(function() {
backgroundmusicsoundfile=soundfile;
backgroundmusic.release();
var mybackground_music = new Media(backgroundmusicsoundfile, loopbackgroundmusic ,null);
backgroundmusic=mybackground_music;
mybackground_music.release();
});
},
stopbackgroundmusic: function() {
backgroundmusic.stop();
},

View File

@ -1,4 +1,4 @@
appControllers.controller('Suchspiel', function($scope, $ionicPlatform, $cordovaMedia, $state, $timeout,$q) {
appControllers.controller('Suchspiel', function($scope, $ionicPlatform, $cordovaMedia, backgroundsounds_mediahandler, $state, $timeout,$q, $http) {
/*
@ -44,6 +44,9 @@ $scope.punkte=0;
$scope.punktebonus=0;
//Spiele sperren bis alle Karten ausgegeben sind
$scope.gamelock=true;
//Zeitmessung für PunkteBonus
$scope.rundenstart = '';
$scope.rundenende = '';
@ -58,50 +61,65 @@ $ionicPlatform.ready(function() {
/*
* Sounds definieren
*/
$scope.sounds=[];
//Globale MediaVariable fure Soundeffekte
var gamesound='';
var bravosound='';
var falschsound='';
$scope.bravosounds=[];
$scope.falschsounds=[];
$scope.aufloesung='';
/*
* Sounds laden
*/
var tiersound1 = new Media('/android_asset/www/sounds/soundsneu/finde_affe.mp3', mentorausblenden,null);
var tiersound2 = new Media('/android_asset/www/sounds/soundsneu/finde_esel.mp3', mentorausblenden,null);
var tiersound3 = new Media('/android_asset/www/sounds/soundsneu/finde_hase.mp3', mentorausblenden,null);
var tiersound4 = new Media('/android_asset/www/sounds/soundsneu/finde_hund.mp3', mentorausblenden,null);
var tiersound5 = new Media('/android_asset/www/sounds/soundsneu/finde_kamel.mp3', mentorausblenden,null);
var tiersound6 = new Media('/android_asset/www/sounds/soundsneu/finde_katze.mp3', mentorausblenden,null);
var tiersound7 = new Media('/android_asset/www/sounds/soundsneu/finde_krokodil.mp3', mentorausblenden,null);
var tiersound8 = new Media('/android_asset/www/sounds/soundsneu/finde_kuh.mp3', mentorausblenden,null);
var tiersound9 = new Media('/android_asset/www/sounds/soundsneu/finde_loewe.mp3', mentorausblenden,null);
var tiersound10 = new Media('/android_asset/www/sounds/soundsneu/finde_maus.mp3', mentorausblenden,null);
var tiersound11 = new Media('/android_asset/www/sounds/soundsneu/finde_nashorn.mp3', mentorausblenden,null);
var tiersound12 = new Media('/android_asset/www/sounds/soundsneu/finde_nilpferd.mp3', mentorausblenden,null);
var tiersound13 = new Media('/android_asset/www/sounds/soundsneu/finde_schaf.mp3', mentorausblenden,null);
var tiersound14 = new Media('/android_asset/www/sounds/soundsneu/finde_schildkroete.mp3', mentorausblenden,null);
var tiersound15 = new Media('/android_asset/www/sounds/soundsneu/finde_schwein.mp3', mentorausblenden,null);
var tiersound16 = new Media('/android_asset/www/sounds/soundsneu/finde_stier.mp3', mentorausblenden,null);
var bravosound1 = new Media('/android_asset/www/sounds/soundsneu/erfolg_1.mp3', karteausblenden,null);
var bravosound2 = new Media('/android_asset/www/sounds/soundsneu/erfolg_2.mp3', karteausblenden,null);
var bravosound3 = new Media('/android_asset/www/sounds/soundsneu/erfolg_3.mp3', karteausblenden,null);
var bravosound4 = new Media('/android_asset/www/sounds/soundsneu/erfolg_4.mp3', karteausblenden,null);
var bravosound5 = new Media('/android_asset/www/sounds/soundsneu/erfolg_5.mp3', karteausblenden,null);
var falschsound1 = new Media('/android_asset/www/sounds/soundsneu/niederlage_1.mp3', mentorausblenden,null);
var falschsound2 = new Media('/android_asset/www/sounds/soundsneu/niederlage_2.mp3', mentorausblenden,null);
var falschsound3 = new Media('/android_asset/www/sounds/soundsneu/niederlage_3.mp3', mentorausblenden,null);
var falschsound4 = new Media('/android_asset/www/sounds/soundsneu/niederlage_4.mp3', mentorausblenden,null);
var falschsound5 = new Media('/android_asset/www/sounds/soundsneu/niederlage_5.mp3', mentorausblenden,null);
var kartegebensound = new Media('/android_asset/www/sounds/karte.mp3', kartegeben,null);
var aufloesungsound = new Media('/android_asset/www/sounds/soundsneu/aufloesung.mp3', aufloesung,null);
/*
* Spielende - Minispiel
* Spielset laden
*/
$http.get('spielsets/spielset1/spielset.json').success(function(data) {
//console.log(data);
$scope.spielealletiere = data;
});
/*
* Spiele IntroSounds laden
* Typen: successsound -> Bravo, super, tollgemacht Sounds
* Typen: failuresound -> Leider daneben, versuchs nochmal
* Typen: cardsound -> Kartenlegegeräusch
* Typen: solutionsound -> Auflösungsgeräusch, das wäre das Tier gewesen
* Typen: gameoversound -> Spielzu ende Zeit für minispiel etc.
* Typen: backgroundmusic -> Hintergrundmusik
*/
$http.get('spielsets/spielset1/systemsounds.json').success(function(data) {
for(var i = 0; i < data.length; i++) {
if (data[i].type=='successsound'){
$scope.bravosounds.push(data[i].sound);
}
else if (data[i].type=='failuresound'){
$scope.falschsounds.push(data[i].sound);
}
else if (data[i].type=='cardsound'){
$scope.kartegebensound=data[i].sound;
}
else if (data[i].type=='solutionsound'){
$scope.aufloesung=data[i].sound;
}
else if (data[i].type=='gameoversound'){
$scope.spielendesound=data[i].sound;
}
else if (data[i].type=='backgroundmusic'){
backgroundsounds_mediahandler.setbackgroundsoundfile(data[i].sound);
backgroundsounds_mediahandler.playbackgroundmusic();
}
}//for-Schleife
});//$http
/*
* Minispiel
*/
var spielendesound = new Media('/android_asset/www/sounds/minispiel/geschafft.mp3', minispielintro,null);
var minispielsound = new Media('/android_asset/www/sounds/minispiel/kitzeldenbaeren.mp3', minispielstart,null);
var minispielsound1 = new Media('/android_asset/www/sounds/minispiel/lachen1.mp3', null,null);
var minispielsound2 = new Media('/android_asset/www/sounds/minispiel/lachen2.mp3', null,null);
@ -110,222 +128,82 @@ $ionicPlatform.ready(function() {
/*
* Sounds in $Scope referenzieren
*/
$scope.kartegebensound=kartegebensound;
$scope.aufloesung=aufloesungsound;
$scope.spielendesound=spielendesound;
$scope.minispielsound=minispielsound;
$scope.minispielsound1=minispielsound1;
$scope.minispielsound2=minispielsound2;
$scope.bravosounds.push(bravosound1);
$scope.bravosounds.push(bravosound2);
$scope.bravosounds.push(bravosound3);
$scope.bravosounds.push(bravosound4);
$scope.bravosounds.push(bravosound5);
$scope.falschsounds.push(falschsound1);
$scope.falschsounds.push(falschsound2);
$scope.falschsounds.push(falschsound3);
$scope.falschsounds.push(falschsound4);
$scope.falschsounds.push(falschsound5);
/*
* Tiere definieren
*/
var tier = {
id: 0,
bild: 'Affe.png',
sound1: tiersound1,
display: false,
einblendecssid: 'affeein',
ausblendecssid: 'affeaus',
sortid: 0
};
$scope.spielealletiere.push(tier);
var tier1 = {
id: 1,
bild: 'Esel.png',
sound1: tiersound2,
display: false,
einblendecssid: 'eselein',
ausblendecssid: 'eselaus',
sortid: 0
};
$scope.spielealletiere.push(tier1);
var tier2 = {
id: 2,
bild: 'Hase.png',
sound1: tiersound3,
display: false,
einblendecssid: 'haseein',
ausblendecssid: 'haseaus',
sortid: 0
};
$scope.spielealletiere.push(tier2);
var tier3 = {
id: 3,
bild: 'Hund.png',
sound1: tiersound4,
display: false,
einblendecssid: 'hundein',
ausblendecssid: 'hundaus',
sortid: 0
};
$scope.spielealletiere.push(tier3);
var tier4 = {
id: 4,
bild: 'Kamel.png',
sound1: tiersound5,
display: false,
einblendecssid: 'kamelein',
ausblendecssid: 'kamelaus',
sortid: 0
};
$scope.spielealletiere.push(tier4);
var tier5 = {
id: 5,
bild: 'Katze.png',
sound1: tiersound6,
display: false,
einblendecssid: 'katzeein',
ausblendecssid: 'katzeaus',
sortid: 0
};
$scope.spielealletiere.push(tier5);
var tier6 = {
id: 6,
bild: 'Krokodil.png',
sound1: tiersound7,
display: false,
einblendecssid: 'krokodilein',
ausblendecssid: 'krokodilaus',
sortid: 0
};
$scope.spielealletiere.push(tier6);
var tier7 = {
id: 7,
bild: 'Kuh.png',
sound1: tiersound8,
display: false,
einblendecssid: 'kuhein',
ausblendecssid: 'kuhaus',
sortid: 0
};
$scope.spielealletiere.push(tier7);
var tier8 = {
id: 8,
bild: 'Loewe.png',
sound1: tiersound9,
display: false,
einblendecssid: 'loeweein',
ausblendecssid: 'loeweaus',
sortid: 0
};
$scope.spielealletiere.push(tier8);
var tier9 = {
id: 9,
bild: 'Maus.png',
sound1: tiersound10,
display: false,
einblendecssid: 'mausein',
ausblendecssid: 'mausaus',
sortid: 0
};
$scope.spielealletiere.push(tier9);
var tier10 = {
id: 10,
bild: 'Nashorn.png',
sound1: tiersound11,
display: false,
einblendecssid: 'nashornein',
ausblendecssid: 'nashornaus',
sortid: 0
};
$scope.spielealletiere.push(tier10);
var tier11 = {
id: 11,
bild: 'Nilpferd.png',
sound1: tiersound12,
display: false,
einblendecssid: 'nilpferdein',
ausblendecssid: 'nilpferdaus',
sortid: 0
};
$scope.spielealletiere.push(tier11);
var tier12 = {
id: 12,
bild: 'Schaf.png',
sound1: tiersound13,
display: false,
einblendecssid: 'schafein',
ausblendecssid: 'schafaus',
sortid: 0
};
$scope.spielealletiere.push(tier12);
var tier13 = {
id: 13,
bild: 'Schildkroete.png',
sound1: tiersound14,
display: false,
einblendecssid: 'schildkroeteein',
ausblendecssid: 'schildkroeteaus',
sortid: 0
};
$scope.spielealletiere.push(tier13);
var tier14 = {
id: 14,
bild: 'Schwein.png',
sound1: tiersound15,
display: false,
einblendecssid: 'schweinein',
ausblendecssid: 'schweinaus',
sortid: 0
};
$scope.spielealletiere.push(tier14);
var tier15 = {
id: 15,
bild: 'Stier.png',
sound1: tiersound16,
display: false,
einblendecssid: 'stierein',
ausblendecssid: 'stieraus',
sortid: 0
};
$scope.spielealletiere.push(tier15);
});
/*
* Play-Sound
* playtype-> Bravo,Falsch oder Gamesound
* soundfile-> Pfad zur sounddatei
* callbackfunction-> Funktion die nach erfolgreichem abspielen gestarte wird
* volume-> Lautstärke z.B. 1.0
*/
function playsound(playtype, soundfile, callbackfunction, volume){
$ionicPlatform.ready(function() {
if (playtype=='bravosound'){
try{
//versuchen Soundfile freizugeben
bravosound.release();
}
catch(e){
//Soundfile Objekt gabs nicht oder Freigabefehler
console.log("Sounddatei nicht da");
}
bravosound = new Media(soundfile, callbackfunction ,null);
bravosound.play();
}
else if (playtype=='falschsound'){
try{
//versuchen Soundfile freizugeben
falschsound.release();
}
catch(e){
//Soundfile Objekt gabs nicht oder Freigabefehler
console.log("Sounddatei nicht da");
}
falschsound = new Media(soundfile, callbackfunction ,null);
falschsound.play();
}
else if (playtype=='gamesound'){
try{
//versuchen Soundfile freizugeben
gamesound.release();
}
catch(e){
//Soundfile Objekt gabs nicht oder Freigabefehler
console.log("Sounddatei nicht da");
}
gamesound = new Media(soundfile, callbackfunction ,null);
gamesound.play();
}
});
}
/*
@ -334,7 +212,7 @@ $scope.spielealletiere.push(tier15);
$scope.hilfe = function() {
console.log("Hilfe geklickt");
$scope.showmentor=true;
$scope.spiele[$scope.randomid].sound1.play();
playsound('gamesound', $scope.spiele[$scope.randomid].sound, mentorausblenden,'1.0');
}
@ -343,7 +221,6 @@ $scope.hilfe = function() {
*/
function mentorausblenden(){
$timeout(function () { $scope.showmentor=false; $scope.cardindex=0}, 10);
}
@ -352,77 +229,94 @@ function mentorausblenden(){
*/
$scope.PlayerAnswer = function(src) {
/*
* Einblende-effekte zurücksetzen
*/
$scope.CSSEinblendung='';
if ($scope.gamelock==false){
/*
* Prüfen ob schon einmal geklickt wurde
*/
if ($scope.beantwortet==false){
/*
* Antwort ist richtig
* Einblende-effekte zurücksetzen
*/
$scope.beantwortet=true;
if (src==$scope.randomid){
$timeout(function () {
$scope.punkte=$scope.punkte + 1000;
$scope.rundenende = new Date().getTime();
//Zeitbonus
$scope.punktebonus=1000 / (($scope.rundenende - $scope.rundenstart)/1000);
console.log($scope.rundenende - $scope.rundenstart + " Start:" + $scope.rundenstart + " Ende:" + $scope.rundenende);
$scope.punktebonus=Math.round($scope.punktebonus);
$scope.CSSEinblendung='';
$scope.punkte = $scope.punkte + $scope.punktebonus;
$scope.randomMentor=getRandomInt(1, 2);
if ($scope.randomMentor==2){
$scope.showmentorbravo=true;
}
else{
$scope.showmentor=true;
}
$scope.cardindex=0;
}, 0);
$scope.bravosounds[getRandomInt(0, 4)].play();
}
else{
/*
* Prüfen ob schon einmal geklickt wurde
*/
if ($scope.beantwortet==false){
/*
* Antwort war dreimal falsch
* Antwort ist richtig
*/
if ($scope.falscheantwort==2){
$scope.beantwortet=true;
if (src==$scope.randomid){
/*
* Richtige Karte pulsieren lassen
*/
$scope.CSSErrorCode=$scope.randomid;
$scope.CSSFalscheAntwort= false;
/*
* Nach 3 sekunden Fehler zurücksetzen und Karten neu vergeben
*/
$scope.showmentor=true;
$scope.aufloesung.play();
}
else {
/*
* Antwort ist falsch
*/
$scope.showmentor=true;
$scope.falschsounds[getRandomInt(0, 4)].play();
$scope.CSSFalscheAntwort = true;
$timeout(function () {
$scope.CSSFalscheAntwort = false;
$scope.beantwortet=false;
$scope.falscheantwort=$scope.falscheantwort + 1
}, 1000);
}
}
$timeout(function () {
$scope.punkte=$scope.punkte + 1000;
$scope.rundenende = new Date().getTime();
}
//Zeitbonus
$scope.punktebonus=1000 / (($scope.rundenende - $scope.rundenstart)/1000);
console.log($scope.rundenende - $scope.rundenstart + " Start:" + $scope.rundenstart + " Ende:" + $scope.rundenende);
$scope.punktebonus=Math.round($scope.punktebonus);
$scope.punkte = $scope.punkte + $scope.punktebonus;
$scope.randomMentor=getRandomInt(1, 2);
if ($scope.randomMentor==2){
$scope.showmentorbravo=true;
}
else{
$scope.showmentor=true;
}
$scope.cardindex=0;
}, 0);//$timeoutfunction
/*
* Zufällig einen Bravosound wiedergeben lassen aus Bravosound-Array
*/
playsound('bravosound', $scope.bravosounds[getRandomInt(0, $scope.bravosounds.length - 1)], karteausblenden,'1.0');
}//If Abfrage ob antowrt richtig
else{
/*
* Antwort war dreimal falsch
*/
if ($scope.falscheantwort==2){
/*
* Richtige Karte pulsieren lassen
*/
$scope.CSSErrorCode=$scope.randomid;
$scope.CSSFalscheAntwort= false;
$scope.showmentor=true;
//Auflösungssound wiedergeben
playsound('gamesound', $scope.aufloesung, aufloesung, '1.0');
}//If Abfrage ob antowrt 3x falsch war
else {
/*
* Antwort ist falsch
*/
$scope.showmentor=true;
/*
* Zufällig einen Falschsound wiedergeben lassen aus Falschsound-Array
*/
playsound('falschsound', $scope.falschsounds[getRandomInt(0, $scope.falschsounds.length - 1)], mentorausblenden,'1.0');
$scope.CSSFalscheAntwort = true;
$timeout(function () {
$scope.CSSFalscheAntwort = false;
$scope.beantwortet=false;
$scope.falscheantwort=$scope.falscheantwort + 1
}, 1000); //$timeoutfunction
}//Else Abfrage ob antowrt 3x falsch war
}//Else Abfrage ob antowrt richtig
}//IFAbfrage ob Frage beantwortet wurde
}//Ifabfrage obSpielsperre aktiv ist
}
@ -430,6 +324,7 @@ $scope.PlayerAnswer = function(src) {
* Neues Spiel starten
*/
function goto_newspiel(){
$scope.gamelock=true;
$scope.CSSErrorCode=99;
$scope.falscheantwort=0;
$scope.CSSEinblendung='';
@ -437,7 +332,6 @@ function goto_newspiel(){
kartenmischen();
//$timeout(function () { $scope.kartegebensound.play(); }, 2000);
kartegeben();
}
@ -446,6 +340,7 @@ function goto_newspiel(){
* Karten austeilen
*/
function kartegeben(){
$timeout(function () {
$scope.spielelistensort[$scope.cardindex].display=true;
@ -462,24 +357,24 @@ function kartegeben(){
* Interner Zähler bis alle Karten gegeben wurden
*/
if ($scope.cardindex < 7 ){
$scope.kartegebensound.play();
playsound('gamesound', $scope.kartegebensound, kartegeben,'1.0');
}
else{
$scope.CSSEinblendung='';
/*
* Zufallszahl 3x mal generieren lassen, zufälliger
* Zufallszahl generieren lassen
*/
$scope.randomid=getRandomInt(0, 7);
$scope.randomid=getRandomInt(0, 7);
$scope.randomid=getRandomInt(0, 7);
//Spiel-Eingabesperre entfernen
$scope.gamelock=false;
//Zeit messen
$scope.rundenstart = new Date().getTime();
/*
* Mentor anzeigen und Sound wiedergeben
*/
$scope.showmentor=true;
$scope.spiele[$scope.randomid].sound1.play();
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);
@ -492,6 +387,7 @@ function kartegeben(){
* Karten wieder einsammeln, runde beendet
*/
function karteausblenden(){
$timeout(function () { $scope.showmentorbravo=false; $scope.showmentor=false;}, 0);
if ($scope.spielvorbei==false){
@ -535,7 +431,8 @@ function spielende(){
$timeout(function () {
$scope.showmentorbravo=true;
$scope.spielendesound.play();
//$scope.spielendesound.play();
playsound('gamesound', $scope.spielendesound, minispielintro,'1.0');
}, 10);
//$scope.showteddybear=true

Some files were not shown because too many files have changed in this diff Show More