Ejemplo n.º 1
0
        public GameOverMenu(int lives, int level, int map, GraphicsContext g, Vector2 scales) : base(g, scales, new Vector4(0, 97, 146, 255))
        {
            this.lives       = lives;
            this.level       = level;
            this.map         = map;
            this.options[0] += " " + lives;
            this.font        = new Font(new Vector4(255, 255, 255, 255), true, scales, g);

            // Ultimo continue
            if (lives == -1)
            {
                options[0] = "Continue last";
                this.font  = new Font(new Vector4(255, 0, 0, 255), true, scales, g);
            }

            // No hay mas continues
            if (lives == -2)
            {
                options = new String[] { "End" };
            }

            // Buscar password
            using (StreamReader sr = new StreamReader(File.OpenRead("/Application/res/maps/definitions/passwords.txt")))
            {
                for (int i = 0; i < 8; i++)
                {
                    for (int j = 0; j < 8; j++)
                    {
                        if (level == i + 1 && map == j + 1)
                        {
                            string line = Convert.ToString(sr.ReadLine());
                            this.password = line.Substring(line.Length - 8);
                            goto found;
                        }
                        //else
                        //sr.Read();
                    }
                }
            }

            found : this.sl = new SpriteLoader();
            this.sl.cargarImagen(sprites);
            this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scales.X),
                                                                (int)(sl.getImage().Size.Height *scales.Y))));

            this.ss = new SpriteSheet(this.sl.getImage());

            this.bg    = ss.obtenerSprite(0, 0, (int)(193 * scales.X), (int)(65 * scales.Y), g);
            this.title = ss.obtenerSprite(0, (int)(65 * scales.Y), (int)(156 * scales.X), (int)(27 * scales.Y), g);

            this.sl.cargarImagen(cursor);
            this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scales.X),
                                                                (int)(sl.getImage().Size.Height *scales.Y))));
            this.ss = new SpriteSheet(this.sl.getImage());

            this.cu = this.sl.ImageToSprite(g);

            backgroundColor = Textures.CreateTexture(g.Screen.Width, g.Screen.Height, g, bgColor);

            this.passfont = new Font(new Vector4(255, 255, 255, 255), true, scales, g);
            //MP3Player.no_continue.play();
        }