Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • android/org.benoitharrault.jeweled
1 result
Select Git revision
Loading items
Show changes

Commits on Source 4

org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.15 app.versionName=0.0.17
app.versionCode=15 app.versionCode=17
Reduce cells overlapping.
Fix delete cells on top line.
Réduction du chevauchement des cellules.
Correction sur la suppression de cellules sur la première ligne.
...@@ -30,4 +30,6 @@ class DefaultGameSettings { ...@@ -30,4 +30,6 @@ class DefaultGameSettings {
return []; return [];
} }
static int blockMinimumCellsCount = 3;
} }
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:jeweled/config/default_game_settings.dart';
import 'package:jeweled/models/game.dart'; import 'package:jeweled/models/game.dart';
import 'package:jeweled/models/cell_location.dart'; import 'package:jeweled/models/cell_location.dart';
...@@ -109,7 +110,7 @@ class GameCubit extends HydratedCubit<GameState> { ...@@ -109,7 +110,7 @@ class GameCubit extends HydratedCubit<GameState> {
if (cellValue != null) { if (cellValue != null) {
List<CellLocation> blockCells = currentGame.getSiblingCells(tappedCellLocation, []); List<CellLocation> blockCells = currentGame.getSiblingCells(tappedCellLocation, []);
if (blockCells.length >= 3) { if (blockCells.length >= DefaultGameSettings.blockMinimumCellsCount) {
this.deleteBlock(blockCells); this.deleteBlock(blockCells);
this.increaseMovesCount(); this.increaseMovesCount();
this.increaseScore(getScoreFromBlock(blockCells.length)); this.increaseScore(getScoreFromBlock(blockCells.length));
......
...@@ -42,8 +42,8 @@ class GameBoardPainter extends CustomPainter { ...@@ -42,8 +42,8 @@ class GameBoardPainter extends CustomPainter {
cellPaintBackground.color = Color(colorCode); cellPaintBackground.color = Color(colorCode);
cellPaintBackground.style = PaintingStyle.fill; cellPaintBackground.style = PaintingStyle.fill;
final Rect cellBackground = Rect.fromPoints(Offset(x - overlapping, y - overlapping), final Rect cellBackground = Rect.fromPoints(
Offset(x + cellSize + overlapping, y + cellSize + overlapping)); Offset(x, y), Offset(x + cellSize + overlapping, y + cellSize + overlapping));
canvas.drawRect(cellBackground, cellPaintBackground); canvas.drawRect(cellBackground, cellPaintBackground);
} }
......
...@@ -79,14 +79,20 @@ class _GameBoard extends State<GameBoard> with TickerProviderStateMixin { ...@@ -79,14 +79,20 @@ class _GameBoard extends State<GameBoard> with TickerProviderStateMixin {
}); });
// Build animation for each cell to move // Build animation for each cell to move
bool needAnimation = false;
cellsToRemove.forEach((cellToRemove) { cellsToRemove.forEach((cellToRemove) {
for (int i = 0; i < cellToRemove.row; i++) { for (int i = 0; i < cellToRemove.row; i++) {
final int stepsCount = stepsDownCounts[(cellToRemove.row - i) - 1][cellToRemove.col]; final int stepsCount = stepsDownCounts[(cellToRemove.row - i) - 1][cellToRemove.col];
this.animations[(cellToRemove.row - i) - 1][cellToRemove.col] = animation(stepsCount); this.animations[(cellToRemove.row - i) - 1][cellToRemove.col] = animation(stepsCount);
needAnimation = true;
} }
}); });
controller.forward().orCancel; controller.forward().orCancel;
if (!needAnimation) {
gameCubit.postAnimate();
}
} }
@override @override
...@@ -104,16 +110,16 @@ class _GameBoard extends State<GameBoard> with TickerProviderStateMixin { ...@@ -104,16 +110,16 @@ class _GameBoard extends State<GameBoard> with TickerProviderStateMixin {
return GestureDetector( return GestureDetector(
onTapUp: (details) { onTapUp: (details) {
bool canRemoveCell = true; bool animationInProgress = false;
animations.forEach((row) { animations.forEach((row) {
row.forEach((cell) { row.forEach((cell) {
if (cell != null) { if (cell != null) {
canRemoveCell = false; animationInProgress = true;
} }
}); });
}); });
if (canRemoveCell) { if (!animationInProgress) {
final double xTap = details.localPosition.dx; final double xTap = details.localPosition.dx;
final double yTap = details.localPosition.dy; final double yTap = details.localPosition.dy;
final int col = xTap ~/ (displayWidth / currentGame.settings.boardSize); final int col = xTap ~/ (displayWidth / currentGame.settings.boardSize);
......
...@@ -3,7 +3,7 @@ description: Jeweled Game ...@@ -3,7 +3,7 @@ description: Jeweled Game
publish_to: 'none' publish_to: 'none'
version: 0.0.15+15 version: 0.0.17+17
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
......