Аналитический обзор игровых приложений

Автор работы: Пользователь скрыл имя, 16 Мая 2013 в 09:07, курсовая работа

Краткое описание

Аргументы против игр просты: они отнимают у человека время, развивают в нем агрессивные инстинкты, притупляют воображение, служат причиной сотен болезней, начиная от близорукости и кончая воспалением мозга... И вообще — плохо это и все! А немногочисленные либералы относятся к играм как к возрастной болезни — мол, со временем пройдет... И действительно, у некоторых проходит.

Содержание работы

Введение………………………………………………………………………...4
Актуальность и значение темы………………………………………………..4
Формулировка целей курсового проекта…..…………………………………6
Аналитический обзор игровых приложений…….…………………………...7
Описание процесса разработки………………………………………………..9
Руководство пользователя……………………………………………………15
Заключение……………………………………………………………………20
Список использованных источников………………………………………..21
Приложения…………………………………………………………………...22
Приложение 1…………………………………………………………………22

Содержимое работы - 1 файл

Ilkhom.docx

— 37.82 Кб (Скачать файл)

                        //if (marked[i] && guess.Text[i] == words[wordIndex][i])

                        //{

                        //    break;

                        //}

                        if (!marked[j])

                        {

                            marked[j] = true;

                            labelPosition = currentAttempt * WordLength + i;

                            MyFadeLabel fl = layout.Controls[labelPosition] as MyFadeLabel;

                            fl.FadeToBackColor = Color.OrangeRed;

                            fl.FadeToForeColor = Color.WhiteSmoke;

                            fl.FadeFromForeColor = Label.DefaultBackColor;

                            fl.FadeFromBackColor = Label.DefaultBackColor;

                            fl.Fade();

                            layout.Controls[labelPosition].Font = bold;

                            SetLetterToolTip(layout.Controls[labelPosition], false);

                            break;

                        }

                        else if (CurrentPuzzleWord.Substring(j + 1).IndexOf(guess.Text[i]) >= 0)

                        {

                            continue;

                        }

                        else

                            break;

                    }

                }

            }

        }

 

        /// <summary>

        /// Display the letters in the guess that are in the same

        /// position as that of the word to guess

        /// Also display the correct solved letters so far in the

        /// next grid line

        /// </summary>

        private void DisplayCorrectLetters()

        {

            // First scan all the letters and determine all that have been solved

            int labelPosition = 0;

            lock (solved)

            {

                for (int i = 0; i < WordLength; i++)

                {

                    labelPosition = currentAttempt * WordLength + i;

 

                    // Display the word guessed at the correct place in the grid

                    layout.Controls[labelPosition].Text = guess.Text[i] + "";

 

                    // If the letter matches

                    if (guess.Text[i] == CurrentPuzzleWord[i])

                    {

                        // Mark that letter has been solved

                        solved[i] = true;

 

                        // Show the solved letter in green

                        MyFadeLabel fl = layout.Controls[labelPosition] as MyFadeLabel;

                        fl.FadeFromForeColor = Label.DefaultBackColor;

                        fl.FadeFromBackColor = Label.DefaultBackColor;

                        fl.FadeToBackColor = Color.GreenYellow;

                        fl.FadeFromForeColor = Label.DefaultForeColor;

                        fl.Fade();

                        layout.Controls[labelPosition].Font = bold;

                        SetLetterToolTip(layout.Controls[labelPosition], true);

                    }

 

                    // Now display the letter that were solved so

                    // far in the next line

                    if (currentAttempt < GameState.LastAttempt && solved[i])

                    {

                        layout.Controls[labelPosition + WordLength].Text = CurrentPuzzleWord[i] + "";

                        SetLetterToolTip(layout.Controls[labelPosition + WordLength], true);

                    }

 

                    // Mark only if the letters are the same

                    // It may be solved, but not marked

                    marked[i] = (guess.Text[i] == CurrentPuzzleWord[i]);

                }

            }

        }

 

        #endregion

 

        #region UI routines

 

        /// <summary>

        /// Sets the letter tooltip specifying if a letter is in the

        /// correct or misplaced position in the grid

        /// </summary>

        private void SetLetterToolTip(Control control, bool? isPositionCorrect)

        {

            if (null == isPositionCorrect)

            {

                letterTip.SetToolTip(control, null);

                return;

            }

 

            string message;

            if (isPositionCorrect.Value)

            {

                message = string.Format("'{0}' is in the right position", control.Text);

            }

            else

            {

                message = string.Format("'{0}' appears elsewhere", control.Text);

            }

            letterTip.SetToolTip(control, message);

        }

 

        /// <summary>

        /// Initializes the main form

        /// </summary>

        private void InitiailizeForm()

        {

            ComponentResourceManager resources = new ComponentResourceManager(typeof(WordGuess));

            layout.Controls.Clear();

           

            // Set up the grid

            for (int x = 0; x < WordLength * WordLength; x++)

            {

                MyFadeLabel l = new MyFadeLabel();

                l.Width = 27;

                l.Text = "";

                l.FadeDuration = 50;

                l.TextAlign = ContentAlignment.MiddleCenter;

                l.BackColor = ControlPaint.LightLight(Label.DefaultBackColor);

                l.Margin = new Padding(0);

                l.Padding = new Padding(0);

                l.FadeFromBackColor = Label.DefaultBackColor;

                l.FadeFromForeColor = Label.DefaultBackColor;

                l.Font = regular;

                layout.Controls.Add(l);

            }

 

            // Set up the top container

            for (int x = 0; x < WordLength; x++)

            {

                MyFadeLabel l = new MyFadeLabel();

                l.Width = 26;

                l.Text = "";

                l.TextAlign = ContentAlignment.MiddleCenter;

                l.BackColor = ControlPaint.LightLight(Label.DefaultBackColor);

                l.Margin = new Padding(1, 0, 1, 0);

                l.Font = regular;

                initLayout.Controls.Add(l);

            }

 

            // Assign the context menu

            ContextMenuStrip = contextMenuStrip;

 

            // Hook up a bonus timer handler

            bonusTimer.Elapsed += new ElapsedEventHandler(ReduceBonusScore);

            bonusTimer.Interval = BonusTimerInterval;

 

            // Hook up the help timer handler

            helpLetterTimer.Elapsed += new ElapsedEventHandler(DisplayHelpLetter);

            helpLetterTimer.Interval = HelpTimerInterval;

 

            // Create the color map

            int ColorMapFactor = (int)(255F / (float)ColorMap.Length);

            for (int i = 0; i < ColorMap.Length; i++)

            {

                ColorMap[i] = Color.FromArgb(

                    255 - i * ColorMapFactor,

                    20 + i * ColorMapFactor,

                    0);

            }

        }

 

        void DisplayHelpLetter(object sender, ElapsedEventArgs e)

        {

            // Display a help letter in thread safe manner

            if (helpGiven || currentAttempt == GameState.FirstAttempt || currentAttempt >= GameState.MaximumAttemptsOver) return;

            try

            {

                if (this.InvokeRequired)

                {

                    PerformActivityCallback d = new PerformActivityCallback(DisplayLetter);

                    this.Invoke(d);

                }

                else

                {

                    DisplayLetter();

                }

            }

            // bad way to handle, but when closing the form, its thrown

            catch (ObjectDisposedException) { }

        }

 

        /// <summary>

        /// Display a help letter

        /// </summary>

        private void DisplayLetter()

        {

            if (helpGiven) return;

            // Determine which letter to display

            Random r = new Random(DateTime.Now.Millisecond);

            int solvedLetters = 0;

            lock (solved)

            {

                for (int i = 0; i < WordLength; i++)

                    if (solved[i]) solvedLetters++;

                if (solvedLetters < 4)

                {

                    int checkIndex = r.Next(0, WordLength);

                    for (int i = 0; i < WordLength; i++)

                    {

                        if (!solved[checkIndex])

                        {

                            solved[checkIndex] = true;

                            MyFadeLabel fl = initLayout.Controls[checkIndex] as MyFadeLabel;

                            initLayout.Controls[checkIndex].Text = CurrentPuzzleWord[checkIndex] + "";

                            initLayout.Controls[checkIndex].Font = bold;

                            fl.FadeFromForeColor = Label.DefaultBackColor;

                            fl.FadeFromBackColor = Label.DefaultBackColor;

                            fl.FadeToBackColor = Color.Orange;

                            fl.FadeToForeColor = Label.DefaultForeColor;

                            fl.Fade();                         

 

                            SetLetterToolTip(initLayout.Controls[checkIndex], true);

                            if (currentAttempt > GameState.FirstAttempt && currentAttempt <= GameState.LastAttempt)

                            {

                                layout.Controls[currentAttempt * WordLength + checkIndex].Text = CurrentPuzzleWord[checkIndex] + "";

                                SetLetterToolTip(layout.Controls[currentAttempt * WordLength + checkIndex], true);

                            }

                            messageLabel.Text = "Bonus letter given!";

                            errorLabel.Visible = false;

                            break;

                        }

                        checkIndex = (checkIndex + 1) % WordLength;

                    }

                }

            }

            helpGiven = true;

            helpLetterTimer.Stop();

        }

 

        /// <summary>

        /// Resets the grid

        /// </summary>

        private void ResetGrid()

        {

            ComponentResourceManager resources = new ComponentResourceManager(typeof(WordGuess));

            for (int x = 0; x < WordLength; x++)

            {

                // Clear off the solved and marked flags

                solved[x] = marked[x] = false;

 

                // Clear off the top labels

                MyFadeLabel fl = initLayout.Controls[x] as MyFadeLabel;

                fl.Text = "";

                fl.ForeColor = Label.DefaultBackColor;

                fl.BackColor = Label.DefaultBackColor;

                fl.FadeToBackColor = Label.DefaultBackColor;

                fl.FadeToForeColor = Label.DefaultBackColor;

                fl.Font = regular;

                fl.Fade();

 

                // Clear off the grid

                for (int y = 0; y < WordLength; y++)

                {

                    MyFadeLabel l = layout.Controls[x * WordLength + y] as MyFadeLabel;

                    l.Text = "";

                    l.ForeColor = Label.DefaultForeColor;

                    l.BackColor = Label.DefaultBackColor;

                    l.FadeToBackColor = Label.DefaultBackColor;

                    l.FadeToForeColor = Label.DefaultForeColor;

                    l.Fade();

                    l.Font = regular;

                    SetLetterToolTip(l, null);

                }

            }

        }

 

        /// <summary>

        /// Quits the game

        /// </summary>

        private void QuitGame(object sender, EventArgs e)

        {

            this.Close();

        }

 

        /// <summary>

        /// Changes the difficulty level of the game

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void ChangeDifficultyLevel(object sender, EventArgs e)

        {

            // Determine the game difficulty level that was chosen

            string option = ((ToolStripMenuItem)sender).Tag as string;

            DifficultyLevel newLevel = DifficultyLevel.Easy;

            switch (option)

            {

                case "Easy":

                    newLevel = DifficultyLevel.Easy;

                    break;

                case "Medium":

                    newLevel = DifficultyLevel.Medium;

                    break;

                case "Hard":

                    newLevel = DifficultyLevel.Hard;

                    break;

            }

 

            // If a new difficulty level was chosen,

            // we have to start a new game

            if (gameDifficulty != newLevel)

            {

                gameDifficulty = newLevel;

 

                // Check the appropriate difficulty level

                easyToolStripMenuItem.Checked = (gameDifficulty == DifficultyLevel.Easy);

                mediumToolStripMenuItem.Checked = (gameDifficulty == DifficultyLevel.Medium);

                hardToolStripMenuItem.Checked = (gameDifficulty == DifficultyLevel.Hard);

 

                StartGame();

            }

        }

 

        /// <summary>

        /// Displays an about dialog

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void DisplayAbout(object sender, EventArgs e)

        {

            AboutGuess aboutLingo = new AboutGuess();

            aboutLingo.ShowDialog(this);

        }

 

        /// <summary>

        /// Links to google for a web definition

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void definitionLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

        {

            try

            {

                if (definitionLink.Text == "What's Word Guess?")

                {

                    DisplayAbout(sender, e);

                    return;

                }

                string WordnetDefinitionUrl = @"http://wordnet.princeton.edu/wordnet/tools/search/index.xml?search_type=site&submit=search&query=" + CurrentPuzzleWord + "&submit=Search";

                string GoogleDefinitionUrl = @"http://www.google.com/search?q=define:" + CurrentPuzzleWord;

                System.Diagnostics.Process.Start(WordnetDefinitionUrl);

                //System.Diagnostics.Process.Start(GoogleDefinitionUrl);

            }

            catch { }

            finally

            {

                guess.Focus();

            }

        }

 

        /// <summary>

        /// Displays the original word

        /// </summary>

        private void DisplayOriginalWord()

        {

            guess.ForeColor = TextBox.DefaultForeColor;

            guess.Text = "Word was: " + CurrentPuzzleWord;

            definitionLink.Text = "What's " + CurrentPuzzleWord + "?";

            definitionLink.Visible = true;

            errorLabel.Visible = false;

            messageLabel.Text = null;

            currentAttempt = GameState.ViewingWord;

            bonusTimer.Stop();

        }

 

        #endregion

 

        #region Word handling related routines

 

        /// <summary>

        /// Determines if  word is valid

        /// </summary>

        /// <param name="word">The word to check</param>

        /// <returns>True if valid, false otherwise</returns>

        private bool IsValidWord(string word)

        {

            if (!words.Contains(EasyWordPrefix + word) &&

                !words.Contains(MediumWordPrefix + word) &&

                !words.Contains(HardWordPrefix + word))

            {

                return false;

            }

            return true;

        }

 

        /// <summary>

        /// Checks if a word matches with the difficulty level

        /// </summary>

        /// <param name="word">The word to check for</param>

        /// <param name="difficultyLevel">The difficulty level</param>

        /// <returns>True if the word is of the same difficulty level, false otherwise</returns>

Информация о работе Аналитический обзор игровых приложений