@Override public void onNextTurn() { switch (game.getState()) { case OnGoing: showCurrentPlayer(); if (game.getCurrentPlayer().getAi()) { bots[game.getCurrentColor().ordinal()].play(); grid.invalidate(); } break; case Review: showCurrentPlayer(); break; } }
@Override public void onStateChange(Game.State oldState, Game.State newState) { barsView[oldState.ordinal()].setVisibility(View.GONE); barsView[newState.ordinal()].setVisibility(View.VISIBLE); switch (newState) { case OnGoing: showCurrentPlayer(); break; case Territories: game.goban.comptuteTerritories(); toolBar.setSubtitle("Select dead stones"); break; case Review: showCurrentPlayer(); updateReviewButtons(); break; case Over: toolBar.setSubtitle(game.getResult()); break; } grid.invalidate(); }
void showCurrentPlayer() { SColor color = game.getCurrentColor(); toolBar.setLogo(color.equals(SColor.BLACK) ? R.drawable.stone_black : R.drawable.stone_white); toolBar.setLogoDescription(color.toString()); toolBar.setSubtitle(game.getCurrentPlayer().getName() + " to play"); }
@Click void playAgainButtonClicked() { sgfHandler.initFileName(); game.clear(); }
@Click void reviewButtonClicked() { game.setState(Game.State.Review); }
@Click void proceedButtonClicked() { game.setEndOfGame(Game.EndOfGame.Standard); }
@Click void cancelButtonClicked() { game.setState(Game.State.OnGoing); }
@Click void giveUpButtonClicked() { game.setEndOfGame(Game.EndOfGame.GiveUp); }
@Click public void passButtonClicked() { game.pass(); grid.invalidate(); }