Пример #1
0
        private void DibujarMapa()
        {
            for (x = 0; x < mapa.GetTamanio(); x++)
            {
                for (y = 0; y < mapa.GetTamanio(); y++)
                {
                    DibujarCuadra();
                    DibujarVehiculo();
                    DibujarSorpresasObstaculos();
                }
            }

            DibujarSombraDeJugador();
            DibujarOscurecerMapa();
            DibujarLlegada();

            ButtonControl guardarButton = new ButtonControl();

            guardarButton.Bounds = new UniRectangle(750.0f, 300.0f, 120.0f, 50.0f);
            guardarButton.Text   = "Guardar";
            this.gui.Screen.Desktop.Children.Add(guardarButton);

            guardarButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                this.gui.Screen.Desktop.Children.Clear();
                PersistenciaJuego persistidor = new PersistenciaJuego();
                persistidor.persistirJuego(juego);
                juegoActivo      = false;
                enPantallaInicio = true;
            };
        }
Пример #2
0
        private void MenuCargarPartida(Screen mainScreen)
        {
            List <ChoiceControl> jugadoresChoice = new List <ChoiceControl>();
            LabelControl         noHayJugador    = new LabelControl("No posee partidas guardadas");

            if (File.Exists(nombre + ".xml"))
            {
                PersistenciaJuego persistidor = new PersistenciaJuego();
                juego    = persistidor.cargarJuego(nombre);
                jugador  = juego.Jugador;
                mapa     = juego.Mapa;
                nombre   = juego.Jugador.Nombre;
                vehiculo = juego.Jugador.Vehiculo;
                tipo     = juego.Jugador.Vehiculo.Tipo.GetType();
                menuElegirPartidaGuardada = false;
                juegoActivo = true;
                mainScreen.Desktop.Children.Clear();
            }
            else
            {
                noHayJugador.Bounds = new UniRectangle(graphics.PreferredBackBufferWidth / 2 - 75, 300, 150.0f, 16.0f);

                ButtonControl aceptarButton = new ButtonControl();
                aceptarButton.Bounds = new UniRectangle(graphics.PreferredBackBufferWidth / 2 - 60, 350, 120.0f, 50.0f);
                aceptarButton.Text   = "Aceptar";

                mainScreen.Desktop.Children.Add(noHayJugador);
                mainScreen.Desktop.Children.Add(aceptarButton);

                aceptarButton.Pressed += delegate(object sender, EventArgs arguments)
                {
                    menuElegirPartidaGuardada = false;
                    menuGeneral = true;
                    mainScreen.Desktop.Children.Clear();
                };
            }
        }