예제 #1
0
 @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;
   }
 }
예제 #2
0
 @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();
 }
예제 #3
0
 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");
 }
예제 #4
0
 @Click
 void playAgainButtonClicked() {
   sgfHandler.initFileName();
   game.clear();
 }
예제 #5
0
 @Click
 void reviewButtonClicked() {
   game.setState(Game.State.Review);
 }
예제 #6
0
 @Click
 void proceedButtonClicked() {
   game.setEndOfGame(Game.EndOfGame.Standard);
 }
예제 #7
0
 @Click
 void cancelButtonClicked() {
   game.setState(Game.State.OnGoing);
 }
예제 #8
0
 @Click
 void giveUpButtonClicked() {
   game.setEndOfGame(Game.EndOfGame.GiveUp);
 }
예제 #9
0
 @Click
 public void passButtonClicked() {
   game.pass();
   grid.invalidate();
 }