-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic hand deck and figure support
- Loading branch information
1 parent
85307a7
commit 1663f9d
Showing
23 changed files
with
869 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import 'package:flame/components.dart'; | ||
import 'package:quokka/game/board/game.dart'; | ||
import 'package:quokka/game/board/hand/item.dart'; | ||
import 'package:quokka/game/board/hand/view.dart'; | ||
import 'package:quokka/models/definitions/deck.dart'; | ||
import 'package:quokka/models/definitions/pack.dart'; | ||
|
||
class DeckDefinitionHandItem extends HandItem<PackItem<DeckDefinition>> { | ||
class DeckDefinitionHandItem extends HandItem<PackItem<DeckDefinition>> | ||
with HasGameRef<BoardGame> { | ||
DeckDefinitionHandItem({required super.item}); | ||
|
||
@override | ||
String get label => item.id; | ||
|
||
@override | ||
void onTapUp(event) { | ||
final hand = parent; | ||
if (hand is GameHand) { | ||
hand.selectDeck(item); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import 'package:flame/components.dart'; | ||
import 'package:flame/events.dart'; | ||
|
||
abstract class HandItem<T> extends PositionComponent { | ||
abstract class HandItem<T> extends PositionComponent with TapCallbacks { | ||
final T item; | ||
|
||
HandItem({required this.item}); | ||
HandItem({required this.item}) : super(size: Vector2(100, 0)); | ||
|
||
String get label; | ||
|
||
@override | ||
void onLoad() { | ||
add(TextComponent(text: label)); | ||
} | ||
|
||
@override | ||
void onParentResize(Vector2 maxSize) { | ||
height = maxSize.y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.