croupier: Restore checked mode and keep passing cards
checked mode was lost but can be restored with the appropriate flags
to run_mojo.
The passing cards in the HeartsGameComponent is used to track the
3 cards that the player is passing to others. This needs to be cleared
out at some point. It's slightly too early to do so during the
_makeGamePassCallback (since it sorta flickers). It's nicer to do so
later on, like when taking cards.
Change-Id: Ia75f246ecf35075142d4f288cf9e9650504a9b77
diff --git a/Makefile b/Makefile
index c656876..606b2f7 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,8 @@
croupier.flx: packages
pub run sky_tools -v build --manifest manifest.yaml --output-file $@
+# TODO(alexfandrianto): Switch from --args-for to --checked once
+# sky_tools v 16 is released. (https://github.com/flutter/tools/issues/53)
.PHONY: start
start: croupier.flx env-check packages
pub run sky_tools -v --very-verbose run_mojo \
@@ -45,7 +47,8 @@
--app $< $(MOJO_ANDROID_FLAGS) \
-- \
--enable-multiprocess \
- --map-origin=https://mojo.v.io/=$(ETHER_BUILD_DIR)
+ --map-origin=https://mojo.v.io/=$(ETHER_BUILD_DIR) \
+ --args-for="mojo:sky_viewer --enable-checked-mode"
.PHONY: mock
mock:
@@ -56,10 +59,6 @@
unmock:
mv lib/src/syncbase/log_writer.dart.backup lib/src/syncbase/log_writer.dart
-.PHONY: install
-install: packages
- ./packages/sky/sky_tool start --install --checked
-
.PHONY: env-check
env-check:
ifndef MOJO_DIR
diff --git a/lib/components/game.dart b/lib/components/game.dart
index 7c70fe6..f360d4e 100644
--- a/lib/components/game.dart
+++ b/lib/components/game.dart
@@ -210,7 +210,6 @@
try {
HeartsGame game = config.game as HeartsGame;
game.passCards(_combinePassing());
- _clearPassing();
} catch (e) {
print("You can't do that! ${e.toString()}");
config.game.debugString = e.toString();
@@ -221,6 +220,11 @@
void _makeGameTakeCallback() {
setState(() {
try {
+ // TODO(alexfandrianto): Another way to clear these passing cards is to
+ // do so upon the transition from the pass phase to the take phase.
+ // However, since they are never seen outside of the Pass phase, it is
+ // also valid to clear them upon taking any cards.
+ _clearPassing();
HeartsGame game = config.game as HeartsGame;
game.takeCards();
} catch (e) {