コード例 #1
0
        public SpaceGameScoreScreen(Canvas c, Label l, double x, double y, SpaceScore score)
            : base(c, l, x, y)
        {
            int i;

            Scores = new SpaceScore[11];
            for (i = 0; i < 11; i++)
            {
                Scores[i] = new SpaceScore(50, "ERR");
            }
            Scores[10] = new SpaceScore(score.Score, score.GetName());
            //Scores[0] = new SpaceScore(score.Score, score.GetName());
            fs     = new FileStream("highscores.ast", FileMode.OpenOrCreate);
            Reader = new StreamReader(fs);

            i = 0;
            while (Reader.Peek() != -1)
            {
                Scores[i] = new SpaceScore(Reader.ReadLine());
                i++;
            }
            for (; i < 10; i++)
            {
                Scores[i] = new SpaceScore(42, "BPS");
            }
            Reader.Close();
            fs.Close();

            //SpceScores are really C#y. I like them.
            Scores = Scores.OrderBy(s => - s.Score).ToArray();  // Trying lambdas they're awesome.


            this.ScreenDim = new Point(x, y);
            //MessageBox.Show(ScreenDim + "");
            Counter = 0;
            //this.ScreenDim = new Point(400, 400);
            this.ScoreLabel.Content = "";
            gameLoopRunning         = true;
            Score       = 0;
            dt          = 10000;
            Enemies     = new List <Blastable>();
            ToBeBlasted = new List <Blastable>();
            Debris      = new List <Blastable>();
            Bullets     = new List <Blastable>();
            factory     = new SpaceFactory(this);
            //Lives = 3;
            //TimeInPlayer(30);
            //level = 6;
            StartLevel(8);
            GameLoop();
        }
コード例 #2
0
 public SpaceGame(Canvas canvas, Label scoreLabel, double x, double y)
 {
     this.ScreenDim = new Point(x, y);
     //MessageBox.Show(ScreenDim + "");
     Counter = 0;
     //this.ScreenDim = new Point(400, 400);
     this.ScoreLabel = scoreLabel;
     gameLoopRunning = true;
     view            = canvas;
     Score           = 0;
     dt          = 10000;
     Enemies     = new List <Blastable>();
     ToBeBlasted = new List <Blastable>();
     Debris      = new List <Blastable>();
     Bullets     = new List <Blastable>();
     Aliens      = new List <SpaceAlien>();
     factory     = new SpaceFactory(this);
     Lives       = 3;
     TimeInPlayer(30);
     level = 6;
     StartLevel(8);
     LivesScoreThreshold = 5000;
     GameLoop();
 }