コード例 #1
0
        @Override
        public void onClick(View v) {
          if (currentState == FIRST_ROUND_BETTING || currentState == SECOND_ROUND_BETTING) {
            if (currentState == SECOND_ROUND_BETTING && trumpSuit == cardLead.getSuit()) {
              trumpSuit = -1;
              updateTrumpSuit();
              // TODO tell player they can't choose the suit that was offered to bet on in the first
              // round
            }
            if (trumpSuit == -1) {
              ScaleAnimation scale =
                  new ScaleAnimation((float) 1.1, (float) 1.1, (float) 1.2, (float) 1.2);
              scale.scaleCurrentDuration(5);
              chooseSuit.startAnimation(scale);
              return;
            }
            EuchreBet bet = new EuchreBet(trumpSuit, true, true);

            connection.write(currentState, bet.toString());

            isBettingNow = false;

            playingView();
            setButtonsEnabled(false);
            isTurn = false;
            cardSuggestedId = -1;
          }
        }
コード例 #2
0
    @Override
    public void onClick(View v) {
      // Show an animation indicating the card was selected
      ScaleAnimation scale = new ScaleAnimation((float) 1.2, (float) 1.2, (float) 1.2, (float) 1.2);
      scale.scaleCurrentDuration(5);
      v.startAnimation(scale);

      // Let the UI know which card was selected
      playerContext.setSelected(v.getId(), cardSuggestedId);

      for (int i = 0; i < cardHand.size(); i++) {
        if (cardHand.get(i).getIdNum() == v.getId()) {
          cardSelected = cardHand.get(i);
        }
      }
    }