Example #1
0
        private void LoadScores()
        {
            if (File.Exists(@"Scores\" + WordJumble.Properties.Settings.Default.Mode.Trim() + ".wjhs"))
            {
                using (StreamReader sReader = new StreamReader(@"Scores\" + WordJumble.Properties.Settings.Default.Mode.Trim() + ".wjhs"))
                {
                    while (!sReader.EndOfStream)
                    {
                        string[] _tempLst = new string[5];
                        string   line     = sReader.ReadLine();
                        int      indx     = 0;

                        foreach (string s in line.Split(','))
                        {
                            if (indx < _tempLst.Length)
                            {
                                _tempLst[indx] = s;
                                indx++;
                            }
                        }
                        if (idx < _lstScores.Length)
                        {
                            _lstScores[idx] = new HighestScores(_tempLst[0], Int32.Parse(_tempLst[1]), Int32.Parse(_tempLst[2]), Int32.Parse(_tempLst[3]), Int32.Parse(_tempLst[4]));
                            idx++;
                        }
                    }
                }
            }
        }
Example #2
0
        private void Playing_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (Missed < ModeSettings.WrongTimesLimit)
            {
                DialogResult dg = MessageBox.Show("Are you wanna save to play after (by Lastest Play mode)?", "Word Jumble", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (dg == DialogResult.Yes)
                {
                    WordJumble.Properties.Settings.Default.Mode4Resume = PlayMode;
                    ResumeSettings.SetUp(Point, Bonus, Missed, WinTimes, TotalWin, progBonus.Value, HintLimit, ChangeQuestionLimit, ReduceLimit);
                    ResumeSettings.SaveSettings();
                    WordJumble.Properties.Settings.Default.ModeLastest = true;
                    WordJumble.Properties.Settings.Default.Save();
                }
                else
                {
                    WordJumble.Properties.Settings.Default.ModeLastest = false;
                }
            }
            timeCount.Stop();

            SaveScores    scObject  = new SaveScores();
            HighestScores hscObject = new HighestScores();

            if (Point > 5 && (hscObject.IsHighestScore(Point) || hscObject.IsTopTen() || !hscObject.IsExist()))
            {
                SaveScoresSettings.SetUp(TimeLimit, Point, Bonus, Missed);
                SaveScoresSettings.SaveSettings();

                scObject.ShowDialog();
            }
        }
Example #3
0
 public int CompareTo(object obj)
 {
     if (obj is HighestScores)
     {
         HighestScores hsc = (HighestScores)obj;
         return(Point.CompareTo(hsc.Point));
     }
     return(1);
 }
Example #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Length >= 5)
     {
         HighestScores hscObject = new HighestScores(txtName.Text, SaveScoresSettings.Point, SaveScoresSettings.Bonus, SaveScoresSettings.Missed, SaveScoresSettings.Time);
         hscObject.AddScores();
         if (!hscObject.IsExist())
         {
             hscObject.CreateFile();
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("Name should be greater or equal 5", "WordJumble", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Example #5
0
 /// <summary>
 /// Add scores to array
 /// </summary>
 public void AddScores()
 {
     LoadScores();
     if (!IsNameExist())
     {
         if (idx < _lstScores.Length)
         {
             _lstScores[idx] = new HighestScores(Name, Point, Bonus, Missed, Time);
             idx++;
         }
     }
     else
     {
         if (Point > _lstScores[markPosition].Point)
         {
             _lstScores[markPosition].Point  = Point;
             _lstScores[markPosition].Bonus  = Bonus;
             _lstScores[markPosition].Missed = Missed;
             _lstScores[markPosition].Time   = Time;
         }
     }
     SortScores();
 }