Datenbank Update, detailseite angepasst, Standard Attacken eingebaut

This commit is contained in:
Carsten Hilmer
2016-09-08 02:18:36 +02:00
parent 25a5793f2f
commit 311130675f
5 changed files with 487 additions and 15 deletions

View File

@@ -67,47 +67,108 @@
<div class="card">
<div class="item item-divider">
Schwächen
Schaden durch Attacken-Typ
</div>
<md-list>
<div class="row" ng-repeat="pokemonschwaeche in pokemonschwaechenliste">
<div class="col">
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid1}}sm">
<div class="col col-center" ng-class="pokemonschwaeche.pokemontyp1 == 1 ? 'typnmittel' : pokemonschwaeche.pokemontyp1 < 0.8 ? 'typschwach' : (pokemonschwaeche.pokemontyp1 == 0.8 ? 'typnormal' : 'typstark')">
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid1}}sm" style="margin: 0 auto; width:100%">
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid1}}.png" alt="PokemonTyp" width="32" height="32">
{{ pokemonschwaeche.pokemontyptext1 }}
</div>
{{ pokemonschwaeche.pokemontyp1 }}
<h4>{{ pokemonschwaeche.pokemontyp1 }}</h4>
</div>
<div class="col">
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid2}}sm">
<div class="col col-center" ng-class="pokemonschwaeche.pokemontyp2 == 1 ? 'typnmittel' : pokemonschwaeche.pokemontyp2 < 0.8 ? 'typschwach' : (pokemonschwaeche.pokemontyp2 == 0.8 ? 'typnormal' : 'typstark')">
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid2}}sm" style="margin: 0 auto; width:100%">
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid2}}.png" alt="PokemonTyp" width="32" height="32">
{{ pokemonschwaeche.pokemontyptext2 }}
</div>
{{ pokemonschwaeche.pokemontyp2 }}
<h4>{{ pokemonschwaeche.pokemontyp2 }}</h4>
</div>
<div class="col">
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid3}}sm">
<div class="col col-center" ng-class="pokemonschwaeche.pokemontyp3 == 1 ? 'typnmittel' : pokemonschwaeche.pokemontyp3 < 0.8 ? 'typschwach' : (pokemonschwaeche.pokemontyp3 == 0.8 ? 'typnormal' : 'typstark')">
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid3}}sm" style="margin: 0 auto; width:100%">
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid3}}.png" alt="PokemonTyp" width="32" height="32">
{{ pokemonschwaeche.pokemontyptext3 }}
</div>
{{ pokemonschwaeche.pokemontyp3 }}
<h4>{{ pokemonschwaeche.pokemontyp3 }}</h4>
</div>
</div>
<div class="row" style="font-size: 10px;">
<div class="col">
Legende:
</div>
<div class="col mycenter">
Wenig <div style="height:5px;width:5px;display: inline-block;" class="typschwach"></div>
</div>
<div class="col mycenter">
Normal <div style="height:5px;width:5px;display: inline-block;" class="typnormal"></div>
</div>
<div class="col mycenter">
Mittel <div style="height:5px;width:5px;display: inline-block;" class="typnmittel"></div>
</div>
<div class="col mycenter">
Stark <div style="height:5px;width:5px;display: inline-block;" class="typstark"></div>
</div>
</div>
<div class="row" style="font-size: 10px;">
<div class="col mycenter">
Hinweis: Angriffe durch Starke Attacken (<div style="height:5px;width:5px;display: inline-block;" class="typstark"></div>) sollten vermieden werden.
</div>
</div>
</md-list>
</div>
<div class="card">
<div class="item item-divider">
Basiswerte
</div>
<div class="item item-text-wrap">
This is a basic Card with some text.
Standard Attacken
</div>
<div class="row" style="font-size: 10px;">
<div class="col-25 col-center">
<strong>Attacke</strong>
</div>
<div class="col-25 col-center">
<strong>Typ</strong>
</div>
<div class="col-10 col-center mycenter">
<strong>Stärke</strong>
</div>
<div class="col-20 col-center mycenter">
<strong>Energie</strong>
</div>
<div class="col-20 col-center mycenter">
<strong>Dauer</strong>
</div>
</div>
<md-list>
<div class="row" ng-repeat="pokemonattacke in pokemonattackenliste" style="font-size: 10px;">
<div class="col-25 col-center">
{{ pokemonattacke.pokemonattacke }}
</div>
<div class="col-25 col-center">
<div class="pokemontyp{{ pokemonattacke.pokemonattacketyp}}sx" style="margin: 0 auto; width:97%;">
<img src="img/typbilder/{{ pokemonattacke.pokemonattacketyp}}.png" alt="PokemonTyp" width="32" height="32">
{{ pokemonattacke.pokemonattacketyptext }}
</div>
</div>
<div class="col-10 col-center mycenter">
{{ pokemonattacke.pokemonattackestaerke }}
</div>
<div class="col-20 col-center mycenter">
{{ pokemonattacke.pokemonattackeenergie }}%
</div>
<div class="col-20 col-center mycenter">
{{ pokemonattacke.pokemonattackedauer }} Sek.
</div>
</div>
</md-list>
</div>
<div class="card">

View File

@@ -93,6 +93,7 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
$scope.initialForm = function () {
$scope.pokemonschwaechenliste = [];
$scope.pokemonattackenliste = [];
// $scope.pokemon is the variable that store pokemon detail data that receive form pokemon list page.
// Parameter :
// $stateParams.pokemondetail(object) = pokemon that user select from pokemon list page.
@@ -102,6 +103,7 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
// It will allow to delete data when have data in the database.
$timeout(function () {
$scope.getTypenEffekt($scope.pokemon.pokedexid);
$scope.getStandardAttacken($scope.pokemon.pokedexid);
}, 1000);
}; //End initialForm.
@@ -118,6 +120,11 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
$scope.pokemonschwaechenliste = pokedexDB.getTypenEffekte(pokedexid);
};//End getPokemonList.
// getPokemonList is for get all pokemons.
// By calling pokedexDB.all() service.
$scope.getStandardAttacken = function (pokedexid) {
$scope.pokemonattackenliste = pokedexDB.getStandardAttacken(pokedexid);
};//End getPokemonList.
// showListBottomSheet is for showing the bottom sheet.
// Parameter :
// $event(object) = position of control that user tap.

View File

@@ -39,6 +39,7 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
var pokemonList = [];
var pokemontypen = [];
var pokemoneffektlist = [];
var pokemonstandardattackenliste= [];
return {
// Select all data from sqlite
@@ -208,6 +209,35 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
return pokemoneffektlist;
},
getStandardAttacken: function (pokedexid)
{
pokemonstandardattackenliste = [];
var query = "SELECT * FROM tblPokemonStandardAttacken WHERE POKEDEXID= ?";
// Execute query statement from query variable.
$cordovaSQLite.execute(db, query,[pokedexid]).then(function (res)
{
if (res.rows.length > 0)
{
for (var i = 0; i < res.rows.length; i++)
{
var dataItem = {
pokemonattacke : res.rows.item(i).ATTACKE ,
pokemonattacketyp : res.rows.item(i).TYP ,
pokemonattacketyptext : pokemontypen[res.rows.item(i).TYP] ,
pokemonattackestaerke : res.rows.item(i).STAERKE ,
pokemonattackeenergie : res.rows.item(i).ENERGIE ,
pokemonattackedauer : res.rows.item(i).DAUER
};
pokemonstandardattackenliste.push(dataItem);
}
}
});
return pokemonstandardattackenliste;
},
// To add data to sqlite.
// It will receive newContract from controller then insert it into sqlite.
add: function (newContract)