Skip to content

Commit

Permalink
Add card operation
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed May 9, 2023
1 parent eb62723 commit 1c03334
Show file tree
Hide file tree
Showing 11 changed files with 1,668 additions and 121 deletions.
9 changes: 8 additions & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,12 @@
"addDeck": "Add deck",
"addSeat": "Add seat",
"visibility": "Visibility",
"ownVisibility": "Own visibility"
"ownVisibility": "Own visibility",
"cardsOperation": "Cards operation",
"moveToDeck": "Move to deck",
"moveToSeatDeck": "Move to seat deck",
"remove": "Remove",
"move": "Move",
"deck": "Deck",
"moveCards": "Move cards"
}
8 changes: 8 additions & 0 deletions app/lib/logic/connection/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,12 @@ class ClientGameConnection with GameConnection, ConnectedGameConnection {
void addDeck(GameDeck deck, int? seatIndex) {
send(ServerConnectionMessage.addDeck(deck, seatIndex));
}

void addCards(List<CardIndex> cards, int deckIndex, [int? seatIndex]) {
send(ServerConnectionMessage.addCards(cards, deckIndex, seatIndex));
}

void removeCards(List<CardIndex> cards) {
send(ServerConnectionMessage.removeCards(cards));
}
}
11 changes: 11 additions & 0 deletions app/lib/logic/connection/logic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,14 @@ mixin GameConnection {

Future<void> close();
}

@freezed
class CardIndex with _$CardIndex {
const factory CardIndex.custom(GameCard card) = AvailableCardIndex;
const factory CardIndex.deck(int cardIndex, int deckIndex) = DeckCardIndex;
const factory CardIndex.seat(int cardIndex, int deckIndex, int seatIndex) =
SeatCardIndex;

factory CardIndex.fromJson(Map<String, dynamic> json) =>
_$CardIndexFromJson(json);
}
Loading

0 comments on commit 1c03334

Please sign in to comment.