Minispiel ausgegliedert

This commit is contained in:
Hilmer, Carsten 2016-11-18 13:47:30 +01:00
parent 7f029d490b
commit ec1a308629
49 changed files with 245 additions and 121 deletions

View File

@ -289,55 +289,6 @@ to {background-position: -2000px 0;}
} }
.teddy {
position: fixed;
top: 50%;
left: 50%;
width: 256px;
height: 256px;
margin-left: -128px;
margin-top: -128px;
overflow: hidden;
}
.teddybackground {
background: url('../img/Teddybear/Teddy_klein/Teddybackgound.png');
}
.teddyani1 {
width: 256px;
height: 1024px;
background: url('../img/Teddybear/Teddy_klein/Teddybear_ani1.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
.teddyani2 {
width: 256px;
height: 1024px;
background: url('../img/Teddybear/Teddy_klein/Teddybear_ani2.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
.teddyani3 {
width: 256px;
height: 1024px;
background: url('../img/Teddybear/Teddy_klein/Teddybear_ani3.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
.teddyani4 {
width: 256px;
height: 1024px;
background: url('../img/Teddybear/Teddy_klein/Teddybear_ani4.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
@-webkit-keyframes teddyspriteani {
100% { background-position: 0 -1024px; }
}
#background-wrap { #background-wrap {
bottom: 0; bottom: 0;
left: 0; left: 0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View File

@ -18,6 +18,7 @@
<link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet">
<link href="spielsets/minispielset1/css/minispiel.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet"> <link href="css/animate.css" rel="stylesheet">
<link href="css/animations.css" rel="stylesheet"> <link href="css/animations.css" rel="stylesheet">
<link href="css/magic.css" rel="stylesheet"> <link href="css/magic.css" rel="stylesheet">
@ -41,6 +42,7 @@
<script src="js/controllers.js"></script> <script src="js/controllers.js"></script>
<script src="js/home_controller.js"></script> <script src="js/home_controller.js"></script>
<script src="js/suchspiel_controller.js"></script> <script src="js/suchspiel_controller.js"></script>
<script src="js/minispiel1_controller.js"></script>
<script src="js/services.js"></script> <script src="js/services.js"></script>
</head> </head>
<body ng-app="kinderspiel"> <body ng-app="kinderspiel">

View File

@ -105,7 +105,11 @@ angular.module('kinderspiel', ['ionic', 'ngCordova','ngAnimate', 'ngDraggable',
templateUrl: 'templates/suchspiel.html', templateUrl: 'templates/suchspiel.html',
controller: 'Suchspiel' controller: 'Suchspiel'
}) })
.state('minispiel1', {
url: '/minispiel1',
templateUrl: 'templates/minispiel1.html',
controller: 'Minispiel1'
})
/* /*
* Standard-Route setzen * Standard-Route setzen

View File

@ -0,0 +1,174 @@
appControllers.controller('Minispiel1', function($scope, $ionicPlatform, $cordovaMedia, backgroundsounds_mediahandler, $state, $timeout,$q, $http) {
/*
* Initialisierung
*/
//Minispiel
$scope.showteddybear=false;
$scope.teddyback=false;
$ionicPlatform.ready(function() {
/*
* Sounds definieren
*/
//Globale MediaVariable fure Soundeffekte
var gamesound='';
var lachensound='';
$scope.lachensounds=[];
$scope.gamesounds=[];
/*
* 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/minispielset1/systemsounds.json').success(function(data) {
for(var i = 0; i < data.length; i++) {
if (data[i].type=='lachensound'){
$scope.lachensounds.push(data[i].sound);
}
else if (data[i].type=='gamesound'){
$scope.gamesounds.push(data[i].sound);
}
else if (data[i].type=='backgroundmusic'){
backgroundsounds_mediahandler.setbackgroundsoundfile(data[i].sound);
backgroundsounds_mediahandler.playbackgroundmusic();
}
}//for-Schleife
});//$http
playsound('gamesound', $scope.gamesounds[0], minispielstart,'1.0');
});
/*
* 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=='lachensound'){
try{
//versuchen Soundfile freizugeben
lachensound.release();
}
catch(e){
//Soundfile Objekt gabs nicht oder Freigabefehler
console.log("Sounddatei nicht da");
}
lachensound = new Media(soundfile, callbackfunction ,null);
lachensound.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();
}
});
}
function minispielstart(){
$timeout(function () {
$scope.showteddybear=true;
$scope.teddyback=true;
}, 10);
$timeout(function () {
$scope.showteddybear=false;
$state.go('home');
}, 30000);
}
/*
* MiniSpiel kitzel den Teddy
*/
$scope.teddyaction = function() {
$scope.teddyanimation=getRandomInt(1,4);
$scope.teddyback=false;
$scope.teddyani1=false;
$scope.teddyani2=false;
$scope.teddyani3=false;
$scope.teddyani4=false;
if ($scope.teddyanimation==1){
$scope.teddyani1=true;
playsound('lachensound', $scope.lachensounds[getRandomInt(0, $scope.lachensounds.length - 1)], null,'1.0');
}
if ($scope.teddyanimation==2){
$scope.teddyani2=true;
playsound('lachensound', $scope.lachensounds[getRandomInt(0, $scope.lachensounds.length - 1)], null,'1.0');
}
if ($scope.teddyanimation==3){
$scope.teddyani3=true;
playsound('lachensound', $scope.lachensounds[getRandomInt(0, $scope.lachensounds.length - 1)], null,'1.0');
}
if ($scope.teddyanimation==4){
$scope.teddyani4=true;
playsound('lachensound', $scope.lachensounds[getRandomInt(0, $scope.lachensounds.length - 1)], null,'1.0');
}
}
/*
* Zufallsgenerator um per Zufall neue Aufgabe definieren
*/
function getRandomInt(min, max) {
var tmpInt=0;
min = Math.ceil(min);
max = Math.floor(max);
tmpInt = Math.floor(Math.random() * (max - min + 1)) + min;
if (tmpInt > max){
tmpInt=max;
}
if (tmpInt < min){
tmpInt=min;
}
return tmpInt;
}
});

View File

@ -30,7 +30,7 @@ $scope.CSSFalscheAntwort = false;
$scope.CCSInittimer = false; $scope.CCSInittimer = false;
//SpieleTimer //SpieleTimer
$scope.Spielzeit = 90; $scope.Spielzeit = 10;
$scope.showgametimer = false; $scope.showgametimer = false;
//Spielzeit vorbei //Spielzeit vorbei
@ -51,11 +51,6 @@ $scope.gamelock=true;
$scope.rundenstart = ''; $scope.rundenstart = '';
$scope.rundenende = ''; $scope.rundenende = '';
//Minispiel
$scope.showteddybear=false;
$scope.teddyback=false;
$ionicPlatform.ready(function() { $ionicPlatform.ready(function() {
/* /*
@ -117,20 +112,6 @@ $ionicPlatform.ready(function() {
});//$http });//$http
/*
* Minispiel
*/
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);
/*
* Sounds in $Scope referenzieren
*/
$scope.minispielsound=minispielsound;
$scope.minispielsound1=minispielsound1;
$scope.minispielsound2=minispielsound2;
}); });
@ -435,28 +416,14 @@ function spielende(){
playsound('gamesound', $scope.spielendesound, minispielintro,'1.0'); playsound('gamesound', $scope.spielendesound, minispielintro,'1.0');
}, 10); }, 10);
//$scope.showteddybear=true
} }
function minispielintro(){ function minispielintro(){
$scope.minispielsound.play(); $state.go('minispiel1');
} }
function minispielstart(){
$timeout(function () {
$scope.showmentorbravo=false;
$scope.showteddybear=true;
$scope.teddyback=true;
}, 10);
$timeout(function () {
$scope.showteddybear=false;
$state.go('home');
}, 30000);
}
/* /*
* SpieleTimer Funktion * SpieleTimer Funktion
@ -600,36 +567,4 @@ function inittimer(){
} }
/*
* MiniSpiel kitzel den Teddy
*/
$scope.teddyaction = function() {
$scope.teddyanimation=getRandomInt(1,4);
$scope.teddyback=false;
$scope.teddyani1=false;
$scope.teddyani2=false;
$scope.teddyani3=false;
$scope.teddyani4=false;
if ($scope.teddyanimation==1){
$scope.teddyani1=true;
$scope.minispielsound1.play();
}
if ($scope.teddyanimation==2){
$scope.teddyani2=true;
$scope.minispielsound2.play();
}
if ($scope.teddyanimation==3){
$scope.teddyani3=true;
$scope.minispielsound1.play();
}
if ($scope.teddyanimation==4){
$scope.teddyani4=true;
$scope.minispielsound2.play();
}
}
}); });

View File

@ -0,0 +1,47 @@
.teddy {
position: fixed;
top: 50%;
left: 50%;
width: 256px;
height: 256px;
margin-left: -128px;
margin-top: -128px;
overflow: hidden;
}
.teddybackground {
background: url('../images/Teddybackgound.png');
}
.teddyani1 {
width: 256px;
height: 1024px;
background: url('../images/Teddybear_ani1.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
.teddyani2 {
width: 256px;
height: 1024px;
background: url('../images/Teddybear_ani2.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
.teddyani3 {
width: 256px;
height: 1024px;
background: url('../images/Teddybear_ani3.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
.teddyani4 {
width: 256px;
height: 1024px;
background: url('../images/Teddybear_ani4.png') left center;
-webkit-animation: teddyspriteani 1.4s steps(4) infinite;
}
@-webkit-keyframes teddyspriteani {
100% { background-position: 0 -1024px; }
}

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -0,0 +1,5 @@
[
{"id": 0, "type": "gamesound", "sound": "/android_asset/www/spielsets/minispielset1/sound/kitzeldenbaeren.mp3"},
{"id": 1, "type": "lachensound", "sound": "/android_asset/www/spielsets/minispielset1/sound/lachen1.mp3"},
{"id": 2, "type": "lachensound", "sound": "/android_asset/www/spielsets/minispielset1/sound/lachen2.mp3"}
]

View File

@ -11,6 +11,6 @@
{"id": 9, "type": "failuresound", "sound": "/android_asset/www/sounds/niederlage_5.mp3"}, {"id": 9, "type": "failuresound", "sound": "/android_asset/www/sounds/niederlage_5.mp3"},
{"id": 10, "type": "cardsound", "sound": "/android_asset/www/sounds/karte.mp3"}, {"id": 10, "type": "cardsound", "sound": "/android_asset/www/sounds/karte.mp3"},
{"id": 11, "type": "solutionsound", "sound": "/android_asset/www/sounds/aufloesung.mp3"}, {"id": 11, "type": "solutionsound", "sound": "/android_asset/www/sounds/aufloesung.mp3"},
{"id": 12, "type": "gameoversound", "sound": "/android_asset/www/sounds/minispiel/geschafft.mp3"}, {"id": 12, "type": "gameoversound", "sound": "/android_asset/www/sounds/geschafft.mp3"},
{"id": 13, "type": "backgroundmusic", "sound": "/android_asset/www/sounds/background/background4.mid"} {"id": 13, "type": "backgroundmusic", "sound": "/android_asset/www/sounds/background/background4.mid"}
] ]

View File

@ -0,0 +1,9 @@
<ion-view view-title="Minispiel">
<ion-content class="padding">
<div class="teddy" ng-class="{'teddybackground': teddyback}" ng-show="showteddybear" ng-click="teddyaction()">
<div ng-class="{'teddyani1': teddyani1, 'teddyani2': teddyani2, 'teddyani3': teddyani3, 'teddyani4': teddyani4}"></div>
</div>
</ion-content>
</ion-view>

View File

@ -37,9 +37,6 @@
<div class="mentorbravo"></div> <div class="mentorbravo"></div>
</div> </div>
<div class="teddy" ng-class="{'teddybackground': teddyback}" ng-show="showteddybear" ng-click="teddyaction()">
<div ng-class="{'teddyani1': teddyani1, 'teddyani2': teddyani2, 'teddyani3': teddyani3, 'teddyani4': teddyani4}"></div>
</div>
</ion-content> </ion-content>
</ion-view> </ion-view>