Ejemplo n.º 1
0
        public void ShowScene()
        {
            brush1.Color = Color.Black;
            DBgrfx.FillRectangle(brush1, new Rectangle(0, 0, this.Width, this.Height));

            maze.DrawMaze(DBgrfx);

            RGhost.DrawItem(DBgrfx);
            YGhost.DrawItem(DBgrfx);
            BGhost.DrawItem(DBgrfx);
            PGhost.DrawItem(DBgrfx);
            Pman.DrawItem(DBgrfx);

            DBgrfx.DrawString("Score:" + Pman.GetScore(), text, new SolidBrush(Color.White), 0, 650);
            DBgrfx.DrawString("Ammo:" + Pman.GetAmmo(), text, new SolidBrush(Color.White), 500, 650);
            DBgrfx.DrawString("Tries:" + Pman.GetTries(), text, new SolidBrush(Color.White), 265, 650);

            if (ShootOnce)
            {
                bullet.DrawItem(DBgrfx);
            }
            try
            {
                grfx.DrawImage(BackBuffer, 0, 0);
            }
            catch
            {
                DrawingTimer.Stop();
            }
        }
Ejemplo n.º 2
0
        private void btn_Click(object sender, EventArgs e)
        {
            if (this.typeOfHighsShow == 2)
            {
                Close();
            }

            if (this.typeOfHighsShow == 1)
            {
                if (click == 2)
                {
                    Close();
                }

                if (click == 1)
                {
                    lbl.Visible = false;
                    txt.Visible = false;
                    DecryptFile("data.txt", "data1.txt");
                    scores = File.ReadAllLines("data1.txt");
                    File.Delete("data.txt");

                    j    = 0;
                    name = txt.Text;
                    if (name.Length == 0)
                    {
                        name = "Anonymous";
                    }

                    for (i = 0; i < 10; i++)
                    {
                        while (scores[i][j] != '-')
                        {
                            j++;
                        }
                        j++;
                        if (this.pman.GetScore() > int.Parse(scores[i].Substring(j)))
                        {
                            for (j = 9; j > i; j--)
                            {
                                scores[j] = scores[j - 1];
                            }

                            for (j = 0; j < 10; j++)
                            {
                                tempstr   = scores[j].Substring(2);
                                scores[j] = (j + 1) + "." + tempstr;
                            }

                            scores[i] = (i + 1) + "." + name + " - " + pman.GetScore();
                            break;
                        }
                        j = 0;
                    }

                    for (i = 0; i < 10; i++)
                    {
                        if (scores[i][2] != '-' & scores[i][3] != '-')
                        {
                            scoreStr = scoreStr + scores[i] + "\r\n";
                        }
                    }

                    File.WriteAllLines("data1.txt", scores);
                    EncryptFile("data1.txt", "data.txt");
                    File.Delete("data1.txt");
                    click++;
                    timer1.Start();
                }
            }
        }