Exemple #1
0
        public MainForm()
        {
            var wordBank = new WordBank();

            LoadWords(wordBank);
            var puzzle = wordBank.GetPuzzle();

            LoadPlayers();
            FigureOutWhoseTurn();
            wheelofFortune = new Wheel();
            secretWord     = new SecretWord(puzzle.Answer);
            word           = new Letter[secretWord.size];
            wheelIsMoved   = false;
            wheelTimes     = 100;
            InitializeComponent();
            InitializeLabelArrays();
            drawSecretWord();
            setPlayerColors();
            lblInfo2.Text       = "";
            lblCategory.Text    = "Category: " + puzzle.Category;
            wheelTimer          = new Timer();
            wheelTimer.Interval = 10;
            wheelTimer.Tick    += wheelTimer_Tick;


            button    = new Button[30];
            vowel     = new Button[6];
            consonant = new Button[20];

            button[0]  = btnA;
            button[1]  = btnB;
            button[2]  = btnC;
            button[3]  = btnD;
            button[4]  = btnE;
            button[5]  = btnF;
            button[6]  = btnG;
            button[7]  = btnH;
            button[8]  = btnI;
            button[9]  = btnJ;
            button[10] = btnK;
            button[11] = btnL;
            button[12] = btnM;
            button[13] = btnN;
            button[14] = btnO;
            button[15] = btnP;
            button[16] = btnQ;
            button[17] = btnR;
            button[18] = btnS;
            button[19] = btnT;
            button[20] = btnU;
            button[21] = btnV;
            button[22] = btnW;
            button[23] = btnX;
            button[24] = btnY;
            button[25] = btnZ;
            button[26] = btnSpace;
            button[27] = btnApostrophe;
            button[28] = btnAmpersand;
            button[29] = btnHyphen;

            vowel[0] = btnA;
            vowel[1] = btnE;
            vowel[2] = btnI;
            vowel[3] = btnO;
            vowel[4] = btnU;
            vowel[5] = btnY;

            consonant[0]  = btnB;
            consonant[1]  = btnC;
            consonant[2]  = btnD;
            consonant[3]  = btnF;
            consonant[4]  = btnG;
            consonant[5]  = btnH;
            consonant[6]  = btnJ;
            consonant[7]  = btnK;
            consonant[8]  = btnL;
            consonant[9]  = btnM;
            consonant[10] = btnN;
            consonant[11] = btnP;
            consonant[12] = btnQ;
            consonant[13] = btnR;
            consonant[14] = btnS;
            consonant[15] = btnT;
            consonant[16] = btnV;
            consonant[17] = btnW;
            consonant[18] = btnX;
            consonant[19] = btnZ;

            for (int i = 0; i < button.Length; i++)
            {
                button[i].Enabled         = true;  //active flag
                button[i].Visible         = false; //visibility flag
                letterMap[button[i].Text] = 0;     // not guessed
            }

            game = new Game();

            gameTimer          = new Timer();
            gameTimer.Interval = 100;
            gameTimer.Tick    += gameTimer_Tick;
            Prompt();

            gameTimer.Start();
            updateLetterButtons();
        }