80 line length correction
This commit is contained in:
@@ -52,8 +52,8 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
trailing: Row(
|
trailing: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 5),
|
SizedBox(width: 5),
|
||||||
Text(
|
Text('${widget.gameSession.playerScores[playerIndex][0]} '
|
||||||
'${widget.gameSession.playerScores[playerIndex][0]} Punkte')
|
'Punkte')
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -102,7 +102,8 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
// Erstelle eine Liste von Indizes der Spieler
|
// Erstelle eine Liste von Indizes der Spieler
|
||||||
List<int> playerIndices =
|
List<int> playerIndices =
|
||||||
List<int>.generate(widget.gameSession.players.length, (index) => index);
|
List<int>.generate(widget.gameSession.players.length, (index) => index);
|
||||||
// Sortiere die Indizes basierend auf den summierten Punkten (playerScores[i][0])
|
// Sortiere die Indizes basierend auf den summierten Punkten
|
||||||
|
// (playerScores[i][0])
|
||||||
playerIndices.sort((a, b) {
|
playerIndices.sort((a, b) {
|
||||||
int scoreA = widget.gameSession.playerScores[a][0];
|
int scoreA = widget.gameSession.playerScores[a][0];
|
||||||
int scoreB = widget.gameSession.playerScores[b][0];
|
int scoreB = widget.gameSession.playerScores[b][0];
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
builder: (context) => CupertinoAlertDialog(
|
builder: (context) => CupertinoAlertDialog(
|
||||||
title: Text('Maximale Spielerzahl erreicht'),
|
title: Text('Maximale Spielerzahl erreicht'),
|
||||||
content: Text(
|
content: Text(
|
||||||
'Es können maximal 5 Spieler hinzugefügt werden.'),
|
'Es können maximal 5 Spieler hinzugefügt '
|
||||||
|
'werden.'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text('OK'),
|
child: Text('OK'),
|
||||||
@@ -198,8 +199,9 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => CupertinoAlertDialog(
|
builder: (context) => CupertinoAlertDialog(
|
||||||
title: Text('Fehler'),
|
title: Text('Fehler'),
|
||||||
content: Text(
|
content:
|
||||||
'Es muss ein Titel für das Spiel eingegeben werden.'),
|
Text('Es muss ein Titel für das Spiel eingegeben '
|
||||||
|
'werden.'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text('OK'),
|
child: Text('OK'),
|
||||||
@@ -232,8 +234,9 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => CupertinoAlertDialog(
|
builder: (context) => CupertinoAlertDialog(
|
||||||
title: Text('Fehler'),
|
title: Text('Fehler'),
|
||||||
content: Text(
|
content:
|
||||||
'Es müssen mindestens 2 Spieler hinzugefügt werden.'),
|
Text('Es müssen mindestens 2 Spieler hinzugefügt '
|
||||||
|
'werden.'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text('OK'),
|
child: Text('OK'),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class InformationView extends StatelessWidget {
|
class InformationView extends StatelessWidget {
|
||||||
|
const InformationView({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ class ModeSelectionMenu extends StatelessWidget {
|
|||||||
child: CupertinoListTile(
|
child: CupertinoListTile(
|
||||||
title: Text('101 Punkte', style: Styles.modeTitle),
|
title: Text('101 Punkte', style: Styles.modeTitle),
|
||||||
subtitle: const Text(
|
subtitle: const Text(
|
||||||
'Es wird solange gespielt, bis einer Spieler die 101 Punkte genau erreicht oder überschreitet.',
|
'Es wird solange gespielt, bis einer Spieler die 101 Punkte '
|
||||||
|
'genau erreicht oder überschreitet.',
|
||||||
style: Styles.modeDescription,
|
style: Styles.modeDescription,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
@@ -31,7 +32,8 @@ class ModeSelectionMenu extends StatelessWidget {
|
|||||||
child: CupertinoListTile(
|
child: CupertinoListTile(
|
||||||
title: Text('Unbegrenzt', style: Styles.modeTitle),
|
title: Text('Unbegrenzt', style: Styles.modeTitle),
|
||||||
subtitle: const Text(
|
subtitle: const Text(
|
||||||
'Dem Spiel sind keine Grenzen gesetzt. Es wird so lange gespielt, bis die Spieler keine Lust mehr haben.',
|
'Dem Spiel sind keine Grenzen gesetzt. Es wird so lange '
|
||||||
|
'gespielt, bis die Spieler keine Lust mehr haben.',
|
||||||
style: Styles.modeDescription,
|
style: Styles.modeDescription,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
/// Index of the player who said CABO.
|
/// Index of the player who said CABO.
|
||||||
int _caboPlayerIndex = 0;
|
int _caboPlayerIndex = 0;
|
||||||
|
|
||||||
/// List of booleans that represent whether the kamikaze checkbox is checked for a player on that index.
|
/// List of booleans that represent whether the kamikaze checkbox is checked
|
||||||
|
/// for a player on that index.
|
||||||
late final List<bool> _isKamikazeChecked =
|
late final List<bool> _isKamikazeChecked =
|
||||||
List.filled(widget.gameSession.players.length, false);
|
List.filled(widget.gameSession.players.length, false);
|
||||||
|
|
||||||
@@ -139,7 +140,8 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'${widget.gameSession.playerScores[index][0]} Punkte',
|
'${widget.gameSession.playerScores[index][0]}'
|
||||||
|
' Punkte',
|
||||||
),
|
),
|
||||||
trailing: Row(
|
trailing: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -192,7 +194,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -255,23 +257,23 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
print('Spieler: ${gameSession.players}');
|
print('Spieler: ${gameSession.players}');
|
||||||
print('Punkte: $roundScores');
|
print('Punkte: $roundScores');
|
||||||
print('${gameSession.players[_caboPlayerIndex]} hat CABO gesagt');
|
print('${gameSession.players[_caboPlayerIndex]} hat CABO gesagt');
|
||||||
print(
|
print('${gameSession.players[_caboPlayerIndex]} hat '
|
||||||
'${gameSession.players[_caboPlayerIndex]} hat ${roundScores[_caboPlayerIndex]} Punkte');
|
'${roundScores[_caboPlayerIndex]} Punkte');
|
||||||
|
|
||||||
/// List of the index of the player(s) with the lowest score
|
/// List of the index of the player(s) with the lowest score
|
||||||
List<int> lowestScoreIndex = _getLowestScoreIndex(roundScores);
|
List<int> lowestScoreIndex = _getLowestScoreIndex(roundScores);
|
||||||
// Spieler der CABO gesagt hat, hat am wenigsten Punkte
|
// Spieler der CABO gesagt hat, hat am wenigsten Punkte
|
||||||
if (lowestScoreIndex.contains(_caboPlayerIndex)) {
|
if (lowestScoreIndex.contains(_caboPlayerIndex)) {
|
||||||
print(
|
print('${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt '
|
||||||
'${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt und bekommt 0 Punkte');
|
'und bekommt 0 Punkte');
|
||||||
print('Alle anderen Spieler bekommen ihre Punkte');
|
print('Alle anderen Spieler bekommen ihre Punkte');
|
||||||
|
|
||||||
///
|
///
|
||||||
_assignPoints([_caboPlayerIndex], -1, roundScores);
|
_assignPoints([_caboPlayerIndex], -1, roundScores);
|
||||||
} else {
|
} else {
|
||||||
// Ein anderer Spieler hat weniger Punkte
|
// Ein anderer Spieler hat weniger Punkte
|
||||||
print(
|
print('${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt, '
|
||||||
'${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt, jedoch nicht die wenigsten Punkte.');
|
'jedoch nicht die wenigsten Punkte.');
|
||||||
|
|
||||||
print('Folgende:r Spieler haben die wenigsten Punkte:');
|
print('Folgende:r Spieler haben die wenigsten Punkte:');
|
||||||
for (int i in lowestScoreIndex) {
|
for (int i in lowestScoreIndex) {
|
||||||
@@ -284,7 +286,8 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
/// Assigns points to the players based on the scores of the current round.
|
/// Assigns points to the players based on the scores of the current round.
|
||||||
/// [winnerIndex] is the index of the player(s) who receive 0 points
|
/// [winnerIndex] is the index of the player(s) who receive 0 points
|
||||||
/// [loserIndex] is the index of the player who receives 5 extra points
|
/// [loserIndex] is the index of the player who receives 5 extra points
|
||||||
/// [roundScores] is the raw list of the scores of all players in the current round.
|
/// [roundScores] is the raw list of the scores of all players in the
|
||||||
|
/// current round.
|
||||||
void _assignPoints(
|
void _assignPoints(
|
||||||
List<int> winnnerIndex, int loserIndex, List<int> roundScores) {
|
List<int> winnnerIndex, int loserIndex, List<int> roundScores) {
|
||||||
print('Punkte der Spieler');
|
print('Punkte der Spieler');
|
||||||
@@ -312,17 +315,17 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
List<int> _getLowestScoreIndex(List<int> roundScores) {
|
List<int> _getLowestScoreIndex(List<int> roundScores) {
|
||||||
int lowestScore = roundScores[0];
|
int lowestScore = roundScores[0];
|
||||||
List<int> lowestScoreIndex = [0];
|
List<int> lowestScoreIndex = [0];
|
||||||
print(
|
print('Niedrigster Score: ${gameSession.players[lowestScoreIndex[0]]} '
|
||||||
'Niedrigster Score: ${gameSession.players[lowestScoreIndex[0]]} ($lowestScore Punkte)');
|
'($lowestScore Punkte)');
|
||||||
for (int i = 1; i < roundScores.length; i++) {
|
for (int i = 1; i < roundScores.length; i++) {
|
||||||
if (roundScores[i] < lowestScore) {
|
if (roundScores[i] < lowestScore) {
|
||||||
print(
|
print('Neuer niedrigster Score: ${gameSession.players[i]} '
|
||||||
'Neuer niedrigster Score: ${gameSession.players[i]} (${roundScores[i]} Punkte)');
|
'(${roundScores[i]} Punkte)');
|
||||||
lowestScore = roundScores[i];
|
lowestScore = roundScores[i];
|
||||||
lowestScoreIndex = [i];
|
lowestScoreIndex = [i];
|
||||||
} else if (roundScores[i] == lowestScore) {
|
} else if (roundScores[i] == lowestScore) {
|
||||||
print(
|
print('${gameSession.players[i]} hat ebenfalls am wenigsten Punkte '
|
||||||
'${gameSession.players[i]} hat ebenfalls am wenigsten Punkte (${roundScores[i]} Punkte)');
|
'(${roundScores[i]} Punkte)');
|
||||||
lowestScoreIndex.add(i);
|
lowestScoreIndex.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user