Soundeffekte in Homescreen eingebaut Boingsound
This commit is contained in:
parent
51cf274b29
commit
84b593fad2
@ -113,7 +113,8 @@ angular.module('kinderspiel', ['ionic', 'ngCordova','ngAnimate', 'ngDraggable',
|
|||||||
url: '/home',
|
url: '/home',
|
||||||
abstract: false,
|
abstract: false,
|
||||||
templateUrl: 'templates/home.html',
|
templateUrl: 'templates/home.html',
|
||||||
controller: 'home'
|
controller: 'home',
|
||||||
|
reload: true
|
||||||
})
|
})
|
||||||
.state('suchspiel', {
|
.state('suchspiel', {
|
||||||
url: '/suchspiel',
|
url: '/suchspiel',
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia, $state, backgroundsounds_mediahandler, $timeout, $http ) {
|
appControllers.controller('home', function($scope, $rootScope, $ionicPlatform, $cordovaMedia, $state, backgroundsounds_mediahandler, $timeout, $http ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mentor-Anitmation ausschalten
|
* Mentor-Anitmation ausschalten
|
||||||
@ -10,15 +10,30 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
$scope.CSSKornspeicher=false;
|
$scope.CSSKornspeicher=false;
|
||||||
$scope.baumhauszufallaction=99;
|
$scope.baumhauszufallaction=99;
|
||||||
|
|
||||||
|
|
||||||
|
//Globale-Sounddatei
|
||||||
|
var mentorsound='';
|
||||||
|
var boingsound='';
|
||||||
|
|
||||||
|
var mentor_is_speakting=false;
|
||||||
|
var boing_is_sounding=false;
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||||
|
/*
|
||||||
|
* Hintergrundbild setzen
|
||||||
|
*/
|
||||||
|
$rootScope.backgroundimage = "img/Background/background.svg";
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hintergrundmusik laden und starten
|
* Hintergrundmusik laden und starten
|
||||||
*/
|
*/
|
||||||
$ionicPlatform.ready(function() {
|
$ionicPlatform.ready(function() {
|
||||||
|
|
||||||
//Globale-Sounddatei
|
|
||||||
var gamesound='';
|
|
||||||
$scope.baumhaus_action=[];
|
$scope.baumhaus_action=[];
|
||||||
$scope.mediastartesuchspiel='';
|
$scope.mediastartesuchspiel='';
|
||||||
|
$scope.boingsound_action=[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Spiele IntroSounds laden
|
* Spiele IntroSounds laden
|
||||||
@ -30,6 +45,9 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
if (data[i].type=='baumhaus'){
|
if (data[i].type=='baumhaus'){
|
||||||
$scope.baumhaus_action.push(data[i].sound);
|
$scope.baumhaus_action.push(data[i].sound);
|
||||||
}
|
}
|
||||||
|
else if (data[i].type=='boingsound'){
|
||||||
|
$scope.boingsound_action.push(data[i].sound);
|
||||||
|
}
|
||||||
else if (data[i].type=='startgamesuchspiel'){
|
else if (data[i].type=='startgamesuchspiel'){
|
||||||
$scope.mediastartesuchspiel=data[i].sound;
|
$scope.mediastartesuchspiel=data[i].sound;
|
||||||
}
|
}
|
||||||
@ -51,7 +69,8 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
$scope.suchspiel_intro = function(){
|
$scope.suchspiel_intro = function(){
|
||||||
$scope.CSSKlickSuchspiel=true;
|
$scope.CSSKlickSuchspiel=true;
|
||||||
$scope.showmentor=true;
|
$scope.showmentor=true;
|
||||||
playsound($scope.mediastartesuchspiel, suchspiel_intro_finish,'1.0');
|
mentor_is_speakting=false;
|
||||||
|
playsound('mentorsound', $scope.mediastartesuchspiel, suchspiel_intro_finish,'1.0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -60,7 +79,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
function suchspiel_intro_finish() {
|
function suchspiel_intro_finish() {
|
||||||
|
|
||||||
//Soundfile freigeben
|
//Soundfile freigeben
|
||||||
gamesound.release();
|
mentorsound.release();
|
||||||
|
|
||||||
$scope.CSSKlickSuchspiel=false;
|
$scope.CSSKlickSuchspiel=false;
|
||||||
$scope.showmentor=false;
|
$scope.showmentor=false;
|
||||||
@ -69,6 +88,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
|
|
||||||
$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');
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
$scope.CSSFarmhaus=false;
|
$scope.CSSFarmhaus=false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
@ -77,6 +97,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
|
|
||||||
$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');
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
$scope.CSSWindrad=false;
|
$scope.CSSWindrad=false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
@ -87,6 +108,7 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
//SetBackgroundpic
|
//SetBackgroundpic
|
||||||
//$rootScope.backgroundimage = "img/ufo.png";
|
//$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');
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
$scope.CSSKornspeicher=false;
|
$scope.CSSKornspeicher=false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
@ -97,27 +119,78 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
|
|||||||
$scope.baumhauszufallaction=getRandomInt(1,2);
|
$scope.baumhauszufallaction=getRandomInt(1,2);
|
||||||
if ($scope.baumhauszufallaction==2){
|
if ($scope.baumhauszufallaction==2){
|
||||||
$scope.showmentor=true;
|
$scope.showmentor=true;
|
||||||
playsound($scope.baumhaus_action[getRandomInt(0, $scope.baumhaus_action.length - 1)], baumhaus_mentor,'1.0');
|
playsound('mentorsound', $scope.baumhaus_action[getRandomInt(0, $scope.baumhaus_action.length - 1)], baumhaus_mentor,'1.0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Play-Sound
|
* Play-Sound
|
||||||
*/
|
*/
|
||||||
function playsound(soundfile, callbackfunction, volume){
|
function playsound(playtype, soundfile, callbackfunction, volume){
|
||||||
|
|
||||||
$ionicPlatform.ready(function() {
|
$ionicPlatform.ready(function() {
|
||||||
gamesound = new Media(soundfile, callbackfunction ,null);
|
|
||||||
gamesound.play();
|
|
||||||
gamesound.setVolume(volume);
|
if (playtype=='boingsound'){
|
||||||
|
|
||||||
|
|
||||||
|
if (boing_is_sounding==false){
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
//versuchen Soundfile freizugeben
|
||||||
|
boingsound.release();
|
||||||
|
}
|
||||||
|
catch(e){
|
||||||
|
|
||||||
|
//Soundfile Objekt gabs nicht oder Freigabefehler
|
||||||
|
console.log("Sounddatei nicht da");
|
||||||
|
}
|
||||||
|
|
||||||
|
boingsound = new Media(soundfile, callbackfunction ,null);
|
||||||
|
boingsound.play();
|
||||||
|
boingsound.setVolume(volume);
|
||||||
|
boing_is_sounding=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (playtype=='mentorsound'){
|
||||||
|
|
||||||
|
if (mentor_is_speakting==false){
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
//versuchen Soundfile freizugeben
|
||||||
|
mentorsound.release();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(e){
|
||||||
|
|
||||||
|
//Soundfile Objekt gabs nicht oder Freigabefehler
|
||||||
|
console.log("Sounddatei nicht da");
|
||||||
|
}
|
||||||
|
|
||||||
|
mentorsound = new Media(soundfile, callbackfunction ,null);
|
||||||
|
mentorsound.play();
|
||||||
|
mentorsound.setVolume(volume);
|
||||||
|
mentor_is_speakting=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function boingsound_stop(){
|
||||||
|
//Soundfile freigeben
|
||||||
|
boingsound.release();
|
||||||
|
boing_is_sounding=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function baumhaus_mentor(){
|
function baumhaus_mentor(){
|
||||||
//Soundfile freigeben
|
//Soundfile freigeben
|
||||||
gamesound.release();
|
mentorsound.release();
|
||||||
|
mentor_is_speakting=false;
|
||||||
//Baumhausmentor ausblenden
|
//Baumhausmentor ausblenden
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
$scope.showmentor=false;
|
$scope.showmentor=false;
|
||||||
|
|||||||
@ -14,6 +14,14 @@ $scope.bin_am_lachen=false;
|
|||||||
var gamesound='';
|
var gamesound='';
|
||||||
var lachensound='';
|
var lachensound='';
|
||||||
|
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||||
|
/*
|
||||||
|
* Hintergrundbild setzen
|
||||||
|
*/
|
||||||
|
$rootScope.backgroundimage = "spielsets/minispielset1/images/background.png";
|
||||||
|
});
|
||||||
|
|
||||||
$ionicPlatform.ready(function() {
|
$ionicPlatform.ready(function() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -24,11 +32,6 @@ $ionicPlatform.ready(function() {
|
|||||||
$scope.gamesounds=[];
|
$scope.gamesounds=[];
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Hintergrundbild setzen
|
|
||||||
*/
|
|
||||||
$rootScope.backgroundimage = "spielsets/minispielset1/images/background.png";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Spiele IntroSounds laden
|
* Spiele IntroSounds laden
|
||||||
* Typen: successsound -> Bravo, super, tollgemacht Sounds
|
* Typen: successsound -> Bravo, super, tollgemacht Sounds
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
appControllers.controller('Suchspiel', function($scope, $ionicPlatform, $cordovaMedia, backgroundsounds_mediahandler, $state, $timeout,$q, $http) {
|
appControllers.controller('Suchspiel', function($scope, $rootScope, $ionicPlatform, $cordovaMedia, backgroundsounds_mediahandler, $state, $timeout,$q, $http) {
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -51,6 +51,13 @@ $scope.gamelock=true;
|
|||||||
$scope.rundenstart = '';
|
$scope.rundenstart = '';
|
||||||
$scope.rundenende = '';
|
$scope.rundenende = '';
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||||
|
/*
|
||||||
|
* Hintergrundbild setzen
|
||||||
|
*/
|
||||||
|
$rootScope.backgroundimage = "img/Background/background.svg";
|
||||||
|
});
|
||||||
|
|
||||||
$ionicPlatform.ready(function() {
|
$ionicPlatform.ready(function() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
BIN
www/sounds/homescreen_boing1.mp3
Normal file
BIN
www/sounds/homescreen_boing1.mp3
Normal file
Binary file not shown.
BIN
www/sounds/homescreen_boing2.mp3
Normal file
BIN
www/sounds/homescreen_boing2.mp3
Normal file
Binary file not shown.
BIN
www/sounds/homescreen_boing3.mp3
Normal file
BIN
www/sounds/homescreen_boing3.mp3
Normal file
Binary file not shown.
@ -4,5 +4,8 @@
|
|||||||
{"id": 2, "type": "baumhaus", "sound": "/android_asset/www/sounds/baumhaus_action_3.mp3"},
|
{"id": 2, "type": "baumhaus", "sound": "/android_asset/www/sounds/baumhaus_action_3.mp3"},
|
||||||
{"id": 3, "type": "baumhaus", "sound": "/android_asset/www/sounds/baumhaus_action_4.mp3"},
|
{"id": 3, "type": "baumhaus", "sound": "/android_asset/www/sounds/baumhaus_action_4.mp3"},
|
||||||
{"id": 4, "type": "startgamesuchspiel", "sound": "/android_asset/www/sounds/spiel_intro.mp3"},
|
{"id": 4, "type": "startgamesuchspiel", "sound": "/android_asset/www/sounds/spiel_intro.mp3"},
|
||||||
{"id": 5, "type": "backgroundmusic", "sound": "/android_asset/www/sounds/background/background4.mid"}
|
{"id": 5, "type": "backgroundmusic", "sound": "/android_asset/www/sounds/background/background4.mid"},
|
||||||
|
{"id": 6, "type": "boingsound", "sound": "/android_asset/www/sounds/homescreen_boing1.mp3"},
|
||||||
|
{"id": 7, "type": "boingsound", "sound": "/android_asset/www/sounds/homescreen_boing2.mp3"},
|
||||||
|
{"id": 8, "type": "boingsound", "sound": "/android_asset/www/sounds/homescreen_boing3.mp3"}
|
||||||
]
|
]
|
||||||
Loading…
x
Reference in New Issue
Block a user