Exemple #1
0
    void refreshTab()
    {
        int counter        = 1;
        int continousScore = 0;

        const ScoreDisplayer.SPECIAL NONE   = ScoreDisplayer.SPECIAL.NONE;
        const ScoreDisplayer.SPECIAL SPAR   = ScoreDisplayer.SPECIAL.SPAR;
        const ScoreDisplayer.SPECIAL STRIKE = ScoreDisplayer.SPECIAL.STRIKE;

        const ScoreDisplayer.DISPLAYER FIRST    = ScoreDisplayer.DISPLAYER.FIRST_SHOT;
        const ScoreDisplayer.DISPLAYER SECOND   = ScoreDisplayer.DISPLAYER.SECOND_SHOT;
        const ScoreDisplayer.DISPLAYER THIRD    = ScoreDisplayer.DISPLAYER.THIRD_SHOT;
        const ScoreDisplayer.DISPLAYER SUBTOTAL = ScoreDisplayer.DISPLAYER.SUBTOTAL;

        foreach (LevelScore i_score in levelScore)
        {
//                string toPrint = "Level " + counter + ":\n";
//                toPrint += "first shot: ";

//                     if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)            toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)         toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)        toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)    toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)         toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)   toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)        toPrint += STRIKE + "\n";
//
//                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)   toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)   toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)          toPrint += i_score.firstScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)    toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)    toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)          toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)          toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)          toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)    toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)            toPrint += STRIKE + "\n";

            if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)
            {
                scoreDisplay.setScore(counter, NONE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }

            else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)
            {
                scoreDisplay.setScore(counter, i_score.firstScore, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)
            {
                scoreDisplay.setScore(counter, STRIKE, FIRST);
            }

//                toPrint += "second shot: ";
//
//                     if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)            toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)         toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)        toPrint += i_score.secondScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)    toPrint += SPAR + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)         toPrint += SPAR + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)   toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)        toPrint += NONE + "\n";
//
//                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)   toPrint += SPAR + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)   toPrint += SPAR + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)          toPrint += SPAR + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)    toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)    toPrint += i_score.secondScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)          toPrint += i_score.secondScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)          toPrint += i_score.secondScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)          toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)    toPrint += STRIKE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)            toPrint += STRIKE + "\n";

            if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)
            {
                scoreDisplay.setScore(counter, NONE, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)
            {
                scoreDisplay.setScore(counter, NONE, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)
            {
                scoreDisplay.setScore(counter, i_score.secondScore, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)
            {
                scoreDisplay.setScore(counter, SPAR, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)
            {
                scoreDisplay.setScore(counter, SPAR, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)
            {
                scoreDisplay.setScore(counter, NONE, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)
            {
                scoreDisplay.setScore(counter, NONE, SECOND);
            }

            else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)
            {
                scoreDisplay.setScore(counter, SPAR, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)
            {
                scoreDisplay.setScore(counter, SPAR, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)
            {
                scoreDisplay.setScore(counter, SPAR, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)
            {
                scoreDisplay.setScore(counter, NONE, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)
            {
                scoreDisplay.setScore(counter, i_score.secondScore, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)
            {
                scoreDisplay.setScore(counter, i_score.secondScore, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)
            {
                scoreDisplay.setScore(counter, i_score.secondScore, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)
            {
                scoreDisplay.setScore(counter, STRIKE, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)
            {
                scoreDisplay.setScore(counter, STRIKE, SECOND);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)
            {
                scoreDisplay.setScore(counter, STRIKE, SECOND);
            }

            if (counter == 10) // printing last level
            {
//                    toPrint += "third shot: ";
//
//                         if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)            toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)         toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)        toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)    toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)         toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)   toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)        toPrint += NONE + "\n";
//
//                    else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)   toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)   toPrint += i_score.thirdScore + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)          toPrint += STRIKE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)    toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)    toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)          toPrint += i_score.thirdScore + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)          toPrint += SPAR + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)          toPrint += NONE + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)    toPrint += i_score.thirdScore + "\n";
//                    else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)            toPrint += STRIKE + "\n";

                if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }

                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)
                {
                    scoreDisplay.setScore(counter, i_score.thirdScore, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)
                {
                    scoreDisplay.setScore(counter, STRIKE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)
                {
                    scoreDisplay.setScore(counter, i_score.thirdScore, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)
                {
                    scoreDisplay.setScore(counter, SPAR, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)
                {
                    scoreDisplay.setScore(counter, NONE, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)
                {
                    scoreDisplay.setScore(counter, i_score.thirdScore, THIRD);
                }
                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)
                {
                    scoreDisplay.setScore(counter, STRIKE, THIRD);
                }
            }

//                toPrint += "subtotal score: ";
            continousScore += i_score.totalScore;
//
//                     if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)            toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)         toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)        toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)    toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)         toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)   toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)        toPrint += continousScore + "\n";
//
//                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)   toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)   toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)          toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)    toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)    toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)          toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)          toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)          toPrint += NONE + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)    toPrint += continousScore + "\n";
//                else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)            toPrint += continousScore + "\n";

            if (i_score.state == LevelScore.ScoreDisplay.NO_DISPLAY)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.FIRST_DISPLAY)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.SECOND_DISPLAY)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_FIRST)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.WAITING_NEXT_SECOND)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_STRIKE)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }

            else if (i_score.state == LevelScore.ScoreDisplay.SPARE_WAITING_THIRD)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.DISPLAY_SPARE_THIRD)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.SPARE_STRIKE)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_TWO)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_WAITING_ONE)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_THIRD)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_SPARE)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE)
            {
                scoreDisplay.setScore(counter, NONE, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_TWICE_THIRD)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }
            else if (i_score.state == LevelScore.ScoreDisplay.STRIKE_XXX)
            {
                scoreDisplay.setScore(counter, continousScore, SUBTOTAL);
            }

//                toPrint += "\n";
//                print(toPrint);
            counter++;
        }

//            print("Very total score: " + continousScore);
        scoreDisplay.setScore(1 /* dont care about level for total score */, continousScore, ScoreDisplayer.DISPLAYER.TOTAL);
    }