Skip to content

Commit dbe5a5d

Browse files
committed
Start adding merge strategy, closes #57
1 parent 5063c1c commit dbe5a5d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

api/lib/src/models/cell.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,41 @@ class BoardTile with BoardTileMappable {
3030

3131
BoardTile(this.asset, this.tile);
3232
}
33+
34+
@MappableClass()
35+
sealed class CellMergeStrategy {
36+
const CellMergeStrategy();
37+
}
38+
39+
@MappableClass()
40+
final class StackedCellMergeStrategy extends CellMergeStrategy {
41+
final int visiblePercentage;
42+
final bool reverse;
43+
44+
const StackedCellMergeStrategy({
45+
this.visiblePercentage = 10,
46+
this.reverse = false,
47+
});
48+
}
49+
50+
@MappableClass()
51+
final class DistributeCellMergeStrategy extends CellMergeStrategy {
52+
final int maxCards;
53+
final bool reverse;
54+
final bool fillVariableSpace;
55+
56+
const DistributeCellMergeStrategy({
57+
this.maxCards = 5,
58+
this.reverse = false,
59+
this.fillVariableSpace = true,
60+
});
61+
}
62+
63+
@MappableClass()
64+
enum CellMergeDirection { horizontal, vertical }
65+
66+
@MappableClass()
67+
final class DirectionalCellMerge extends CellMergeStrategy {
68+
final CellMergeDirection direction;
69+
const DirectionalCellMerge(this.direction);
70+
}

0 commit comments

Comments
 (0)