コード例 #1
0
  private void gameStart() {

    // this game needs the binary value of the game mod
    // this game continuously monitor the small buttons and return the equivalent binary value
    // when this values match  each other, then the game is over
    // time shall be given for every game mode
    String binaryGameModeValue = Integer.toBinaryString(Integer.parseInt(gameModeText));

    // now lets begin coding
    // since i have an array of the image view, i need to get all the tags and arrange it and
    // then compare
    // this helper function will always return a string representing the tags in binary format
    String imagesBinaryMode = Utility.getBinaryStringFromImageView(images);
    // compare the two

    // pad up with zeros
    binaryGameModeValue = Utility.padUpZeros(binaryGameModeValue);

    // show me what is happening inside the coder, but commented out now
    // Toast.makeText(getActivity(),"Binary Mode: "+ binaryGameModeValue+"Image Mode:
    // "+String.valueOf(imagesBinaryMode),Toast.LENGTH_LONG).show();

    if (binaryGameModeValue.equals(String.valueOf(imagesBinaryMode))) {
      // do the animation
      animateBulbs(binaryGameModeValue);
      // animateBulbs(binaryGameModeValue);

      // then game over show the game over dialog
      //            GameOverDialog gameOver = new GameOverDialog();
      //            gameOver.setCancelable(false);
      //            gameOver.show(getFragmentManager().beginTransaction(),"GAME_OVER");

    }
  }
コード例 #2
0
  private void displayBinaryValue() {
    String imagesBinaryMode = Utility.getBinaryStringFromImageView(images);
    // here i will write a function that will convert a binary to decimal Integer

    count = Utility.getDecimalFromBinary(imagesBinaryMode);
    updateCounterStatus();
    gameModeStatusTextView.setText(
        String.format(
            getActivity().getResources().getString(R.string.game_mode_text_format),
            count,
            String.valueOf(imagesBinaryMode)));
  }