Skip to content

Commit dbfbde2

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

File tree

2 files changed

+552
-0
lines changed

2 files changed

+552
-0
lines changed

api/lib/src/models/cell.dart

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

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

0 commit comments

Comments
 (0)