Beispiel #1
0
 private void loadGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     name         = Records.LoadForUser();
     timer1.Tick -= new EventHandler(Update);
     Drawings.Clear();
     InitializeLoaded();
 }
Beispiel #2
0
 private void OnAgainButtonClick(object sender, EventArgs graph)
 {
     timer1.Tick -= new EventHandler(Update);
     timer1.Stop();
     Drawings.Clear();
     Initialize();
 }
Beispiel #3
0
        public virtual bool LoadNumbers(ToolStripProgressBar tspb)
        {
            List <string> numbers = FileHandler.LoadLines(FilePath);

            if (numbers.Count == 0)
            {
                return(false);
            }
            int i     = 0;
            int total = numbers.Count;

            foreach (var n in numbers)
            {
                tspb.Value = (int)((double)i / total * 100);

                var num = BuildNumbers(n);
                if (num == null)
                {
                    Drawings.Clear();
                    break;
                }
                Drawings.Add(num);
                i++;
            }
            Drawings.Reverse();
            return(Drawings.Count > 0);
        }
Beispiel #4
0
        private void Update(object sender, EventArgs graph)
        {
            Drawings.Reset();
            if (!Drawings.Collide1())
            {
                Drawings.shape.Down();
            }
            else
            {
                Drawings.Share();
                Drawings.Cut(label1, label2);
                timer1.Interval = Drawings.interval;
                Drawings.shape.ResetBoxes(3, 0);
                if (Drawings.Collide1())
                {
                    Drawings.Clear();
                    timer1.Tick -= new EventHandler(Update);
                    timer1.Stop();
                    DialogResult result = MessageBox.Show($"Game Over \n Score: {Drawings.totScore} \n Do you want to play Again?"
                                                          , "Game Over", MessageBoxButtons.YesNo);
                    if (result == DialogResult.No)
                    {
                        Application.Exit();
                    }
                    Records.SaveForHighScores(name);

                    Initialize();
                }
            }
            Drawings.Share();
            Invalidate();
        }
Beispiel #5
0
 protected override void DisposeManagedResources()
 {
     base.DisposeManagedResources();
     Miniature?.Dispose();
     foreach (var drawing in Drawings)
     {
         drawing.Dispose();
     }
     Drawings.Clear();
     foreach (var tag in Tags)
     {
         tag.Dispose();
     }
     Tags.Clear();
     Players.Clear();
     Teams.Clear();
     Project   = null;
     Storage   = null;
     EventType = null;
 }