コード例 #1
0
  public void checkResult() {
    int maxScore;
    if (nummovecount == GetOptimalValue()) {
      maxScore = numscore + colWidth * 100;
      showDialog(
          "Congo You Do It !\n Total Move " + nummovecount + "\nYour Score : " + maxScore, true);

    } else {
      maxScore = numscore;
      showDialog(
          "Ohh You miss it.\n Total Move by you "
              + nummovecount
              + "\n Required : "
              + GetOptimalValue()
              + "\nYour Score : "
              + numscore,
          false);
    }
    Cursor rs = mydb.getMyData(1);
    rs.moveToFirst();
    if (maxScore > rs.getInt(rs.getColumnIndex(DBHelper.MSCORE))) {
      mydb.updateScore(1, maxScore, "");
    }
    if (!rs.isClosed()) rs.close();
  }
コード例 #2
0
 public void resetVar() {
   numSelected = 0;
   numscore = 0;
   nummovecount = 0;
   movesCount.setText("0");
   mscore.setText("0");
   selectedP[0] = -1;
   selectedP[1] = -1;
   selectedView[0] = null;
   selectedView[1] = null;
   initgameState(boardSize);
   time = colWidth * 20;
   Cursor rs = mydb.getMyData(1);
   rs.moveToFirst();
   maxScoreText.setText(String.format("%d", rs.getInt(rs.getColumnIndex(DBHelper.MSCORE))));
   if (!rs.isClosed()) rs.close();
 }
コード例 #3
0
  public void init() {
    mdelete = (Button) getActivity().findViewById(R.id.button_delete);
    mscore = (Button) getActivity().findViewById(R.id.button_score);
    movesCount = (Button) getActivity().findViewById(R.id.button_move);
    mclock = (TextView) getActivity().findViewById(R.id.timer);
    maxScoreText = (TextView) getActivity().findViewById(R.id.maxscore);
    strRow = new String[boardSize];
    gameState = new boolean[boardSize];
    String str = "";
    Cursor rs = mydb.getMyData(1);
    rs.moveToFirst();
    str = rs.getString(rs.getColumnIndex(DBHelper.GAMEBOARD));
    maxScoreText.setText(String.format("%d", rs.getInt(rs.getColumnIndex(DBHelper.MSCORE))));
    if (!rs.isClosed()) rs.close();
    selectedView[0] = null;
    selectedView[1] = null;
    GameBoxValue = new int[boardSize];
    setSelectedP();
    setArray(boardSize, str);
    initgameState(boardSize);
    // colWidth = 7;

  }