Пример #1
0
 //when new word is picked
 public void ResetGame()
 {
     TheWordText.Text     = "The Word Being Guessed:";
     PossibleText.Text    = "# of Possible Words Left:";
     LettersLeftText.Text = "Letters Left:";
     BadGuessesText.Text  = "Bad Guesses:";
     GoodGuessesText.Text = "Good Guesses:";
     GuessesLeftText.Text = "Guesses Left:";
     GoodGuessesText.Hide();
     GuessCount           = 9;
     GameStarted          = true;
     GuessCountLabel.Text = GuessCount.ToString();
     GuessCountLabel.Show();
     WinningGif.Hide();
     RightButton.Show();
     WrongButton.Show();
     GuessText.Show();
     GoodGuesses     = "";
     BadGuesses      = "";
     PossibleLetters = "etainoshrdlucmfwygpbvkqjxz"; //most popular letters based on https://en.oxforddictionaries.com/explore/which-letters-are-used-most
     GuessesSoFar    = "";
     label1.Text     = "";
     label2.Text     = "";
     test.Text       = "";
     TheWord         = "";
     Guess           = PossibleLetters[0].ToString();
     label2.Text     = Guess;
     IndexButton.Hide();
     IndexInfo.Hide();
     TipText.Hide();
 }
Пример #2
0
        private void MakeGuess(bool correct)
        {
            //if game has started
            if (GameStarted && GuessCount > 0)
            {
                try
                {
                    //letter is a good guess
                    if (correct)
                    {
                        IndexButton.Show();
                        IndexInfo.Show();
                        TipText.Show();
                        WrongButton.Hide();
                        RightButton.Hide();
                    }//letter is a bad guess
                    else
                    {
                        BadGuesses     += Guess;
                        PossibleLetters = PossibleLetters.Replace(Guess, "");
                        Guess           = PossibleLetters[0].ToString();
                        label2.Text     = TheWord;
                        GuessText.Text  = Guess;


                        label1.Text = BadGuesses;
                        GuessCount--;
                        GuessCountLabel.Text = GuessCount.ToString();
                        //remove words from list containing bad guessed letter
                        PossibleWordSet = new SortedSet <string>(from p in PossibleWordSet
                                                                 where !p.Contains(Guess)
                                                                 select p);
                        possible.Text          = PossibleLetters;
                        possiblewordcount.Text = PossibleWordSet.Count.ToString();
                    }



                    if (GuessCount == 0)
                    {
                        WinningGif.Show();
                        RightButton.Hide();
                        WrongButton.Hide();
                        GuessText.Hide();
                    }



                    //if (label2.Text == TheWord)
                    //{
                    //    RightButton.Hide();
                    //    WrongButton.Hide();
                    //}
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Creates a button for selecting the specified color
        /// </summary>
        /// <param name="location">The location for the button</param>
        /// <param name="index">The index that this button is for</param>
        /// <param name="isSelected">Whether the button is the selected one by default</param>
        /// <returns></returns>
        private TextureButton CreateIndexButton(Location location, int index, bool isSelected)
        {
            TextureButton indexButton = new IndexButton(location, index);

            if (isSelected)
            {
                selectedButton       = indexButton;
                indexButton.Selected = true;
            }
            indexButton.Click += OnIndexSelected;
            return(indexButton);
        }
Пример #4
0
 public Form1()
 {
     InitializeComponent();
     PlayButton.Hide();
     numericUpDown1.Hide();
     GuessCountLabel.Hide();
     WinningGif.Hide();
     WrongButton.Hide();
     RightButton.Hide();
     IndexInfo.Hide();
     IndexButton.Hide();
     guessRightLabel.Hide();
 }
        void ReleaseDesignerOutlets()
        {
            if (AnnotationButton != null)
            {
                AnnotationButton.Dispose();
                AnnotationButton = null;
            }

            if (AnnotationView != null)
            {
                AnnotationView.Dispose();
                AnnotationView = null;
            }

            if (BackgroudView != null)
            {
                BackgroudView.Dispose();
                BackgroudView = null;
            }

            if (BookContentView != null)
            {
                BookContentView.Dispose();
                BookContentView = null;
            }

            if (ContentButton != null)
            {
                ContentButton.Dispose();
                ContentButton = null;
            }

            if (FunctionButtonView != null)
            {
                FunctionButtonView.Dispose();
                FunctionButtonView = null;
            }

            if (GotoButton != null)
            {
                GotoButton.Dispose();
                GotoButton = null;
            }

            if (IndexButton != null)
            {
                IndexButton.Dispose();
                IndexButton = null;
            }

            if (IndexCustomView != null)
            {
                IndexCustomView.Dispose();
                IndexCustomView = null;
            }

            if (IndexViewController != null)
            {
                IndexViewController.Dispose();
                IndexViewController = null;
            }

            if (LeftButton != null)
            {
                LeftButton.Dispose();
                LeftButton = null;
            }

            if (PageNumber != null)
            {
                PageNumber.Dispose();
                PageNumber = null;
            }

            if (PageViewController != null)
            {
                PageViewController.Dispose();
                PageViewController = null;
            }

            if (RightButton != null)
            {
                RightButton.Dispose();
                RightButton = null;
            }

            if (TocCustomView != null)
            {
                TocCustomView.Dispose();
                TocCustomView = null;
            }

            if (TOCViewController != null)
            {
                TOCViewController.Dispose();
                TOCViewController = null;
            }

            if (AnnotationsVC != null)
            {
                AnnotationsVC.Dispose();
                AnnotationsVC = null;
            }
        }
Пример #6
0
        private void IndexButton_Click(object sender, EventArgs e)
        {
            //index will be user
            //change word string
            //IndexButton.Hide();
            //IndexInfo.Hide();
            //WrongButton.Show();
            //RightButton.Show();

            GuessText.Text = Guess;
            string temp = IndexInfo.Text;

            IndexInfo.Hide();
            IndexButton.Hide();
            TipText.Hide();
            List <int> indexList = temp.Split(',').Select(int.Parse).ToList();


            foreach (int i in indexList)
            {
                StringBuilder sb = new StringBuilder(TheWord);
                sb[i]   = char.Parse(Guess);
                TheWord = sb.ToString();

                //might need to do a temp set = to possibleWordSet and run the query on that
                PossibleWordSet = new SortedSet <string>(from p in PossibleWordSet
                                                         where p[i] == TheWord[i] //the guess
                                                         select p);
            }
            label2.Text   = TheWord;
            GuessesSoFar += Guess;

            possible.Text          = PossibleLetters;
            possiblewordcount.Text = PossibleWordSet.Count.ToString();



            //new guess
            var count = TheWord.Count(x => x == '_'); //count of _

            if (count == 1)
            {
                PossibleWordSet = new SortedSet <string>(from p in PossibleWordSet
                                                         where PossibleLetters.Contains(p[TheWord.IndexOf('_')]) //the guess
                                                         select p);
            }

            PossibleLetters = PossibleLetters.Replace(Guess, "");

            Guess = PossibleLetters[0].ToString();

            GuessText.Text = Guess;

            WrongButton.Show();
            RightButton.Show();
            IndexInfo.Clear();

            if (!TheWord.Contains("_"))
            {
                guessRightLabel.Text = "We Guessed Right!";
                guessRightLabel.Show();
                RightButton.Hide();
                WrongButton.Hide();
                IndexButton.Hide();
                IndexInfo.Hide();
                GuessText.Hide();
            }
        }
Пример #7
0
        void ReleaseDesignerOutlets()
        {
            if (AnnotationButton != null)
            {
                AnnotationButton.Dispose();
                AnnotationButton = null;
            }

            if (AnnotationView != null)
            {
                AnnotationView.Dispose();
                AnnotationView = null;
            }

            if (BackgroudView != null)
            {
                BackgroudView.Dispose();
                BackgroudView = null;
            }

            if (BookContentView != null)
            {
                BookContentView.Dispose();
                BookContentView = null;
            }

            if (ContentButton != null)
            {
                ContentButton.Dispose();
                ContentButton = null;
            }

            if (FunctionButtonView != null)
            {
                FunctionButtonView.Dispose();
                FunctionButtonView = null;
            }

            if (HistoryButton != null)
            {
                HistoryButton.Dispose();
                HistoryButton = null;
            }

            if (IndexButton != null)
            {
                IndexButton.Dispose();
                IndexButton = null;
            }

            if (IndexCustomView != null)
            {
                IndexCustomView.Dispose();
                IndexCustomView = null;
            }

            if (IndexViewController != null)
            {
                IndexViewController.Dispose();
                IndexViewController = null;
            }

            if (InfoButton != null)
            {
                InfoButton.Dispose();
                InfoButton = null;
            }

            if (LeftButton != null)
            {
                LeftButton.Dispose();
                LeftButton = null;
            }

            if (PageNumber != null)
            {
                PageNumber.Dispose();
                PageNumber = null;
            }

            if (PageViewController != null)
            {
                PageViewController.Dispose();
                PageViewController = null;
            }

            if (RightButton != null)
            {
                RightButton.Dispose();
                RightButton = null;
            }

            if (SearchField != null)
            {
                SearchField.Dispose();
                SearchField = null;
            }

            if (SegmentContol != null)
            {
                SegmentContol.Dispose();
                SegmentContol = null;
            }

            if (ShareButton != null)
            {
                ShareButton.Dispose();
                ShareButton = null;
            }

            if (SplitSwithButton != null)
            {
                SplitSwithButton.Dispose();
                SplitSwithButton = null;
            }

            if (TitleTField != null)
            {
                TitleTField.Dispose();
                TitleTField = null;
            }

            if (TocCustomView != null)
            {
                TocCustomView.Dispose();
                TocCustomView = null;
            }

            if (TOCViewController != null)
            {
                TOCViewController.Dispose();
                TOCViewController = null;
            }

            if (GotoButton != null)
            {
                GotoButton.Dispose();
                GotoButton = null;
            }
        }