public static void PantallaPrincipal(Cine cine) { bool ingreso = false; int eleccion; int contador = -1; List <Pelicula> peliculas = new List <Pelicula>(); foreach (var p in cine.Peliculas) { peliculas.Add(p); } while (!ingreso) { Console.Clear(); Console.WriteLine("Bienvenido a CineMaster\n¿Que pelicula quiere ver?\n"); foreach (var p in peliculas) { contador++; Console.WriteLine($"{contador} - {p.Titulo} ({p.TituloOriginal})"); } Console.WriteLine(); eleccion = PedirValorIntClampeado("Su eleccion: ", 0, peliculas.Count - 1); Pelicula peliopcion = peliculas.ElementAt(eleccion); contador = -1; PantallaSeleccionFuncion(peliopcion, cine); } }
public static void PantallaSeleccionFuncion(Pelicula peliopcion, Cine cine) { int eleccion; Console.Clear(); Console.WriteLine($"Titulo: {peliopcion.Titulo}\n\nTitulo Original: {peliopcion.TituloOriginal}\nDuracion: {peliopcion.Duracion.TotalMinutes} minutos\nDirector: {peliopcion.Director.Nombre} {peliopcion.Director.Apellido}\n"); foreach (var keyValuePair in peliopcion.Reparto) { Console.WriteLine($"*{keyValuePair.Key.Nombre} {keyValuePair.Key.Apellido} como: {keyValuePair.Value}"); } Console.WriteLine($"\n{peliopcion.Sinopsis}\n"); ////////////////////////////////////////////////////////////////////////////////////////////////// Console.WriteLine("Funciones:\n"); List <Funcion> funcionopcion = cine.BuscarFuncion(cine, peliopcion); Console.WriteLine("Ingrese -1 para regresar al menu anterior.\n"); eleccion = PedirValorIntClampeado("Su eleccion: ", -1, funcionopcion.Count - 1); if (eleccion == -1) { return; } Funcion funcionelegida = funcionopcion.ElementAt(eleccion); PantallaSeleccionAsiento(cine, funcionelegida); }
public static void CargarDataCine(Cine cine) { Sala sala1 = new Sala(1, 17, 28); Sala sala2 = new Sala(2, 28, 39); Sala sala3 = new Sala(3, 24, 24); Sala sala4 = new Sala(4, 18, 25); Sala sala5 = new Sala(5, 24, 17); Sala sala6 = new Sala(6, 25, 30); cine.Salas.Add(sala1); cine.Salas.Add(sala2); cine.Salas.Add(sala3); cine.Salas.Add(sala4); cine.Salas.Add(sala5); cine.Salas.Add(sala6); Dictionary <Persona, string> beautyCast = new Dictionary <Persona, string>(); beautyCast.Add(new Persona("Paige", "O'Hara"), "Belle (voice)"); beautyCast.Add(new Persona("Robby", "Benson"), "Beast (voice)"); beautyCast.Add(new Persona("Richard", "White"), "Gaston (voice)"); beautyCast.Add(new Persona("Jerry", "Orbach"), "Lumiere (voice)"); beautyCast.Add(new Persona("David", "Ogden"), "Cogsworth (voice)"); beautyCast.Add(new Persona("Angela", "Lansbury"), "Mrs. Potts (voice)"); string beautySynopsis = "An enchantress disguised as an old beggar woman offers a rose to a cruel and selfish prince in exchange for shelter from a storm." + "\nWhen he refuses, she reveals her identity. As punishment for the prince's lack of compassion, the enchantress transforms him into a beast and his servants into household objects." + "\nShe casts a spell on the rose and warns the prince that the spell will only be broken if he learns to love another," + " and be loved in return, before the last petal falls, or he will remain a beast forever."; Dictionary <Persona, string> lionCast = new Dictionary <Persona, string>(); lionCast.Add(new Persona("Matthew", "Broderick"), "Simba (voice)"); lionCast.Add(new Persona("James", "Jones"), "Mufasa (voice)"); lionCast.Add(new Persona("Jeremy", "Irons"), "Scar (voice)"); lionCast.Add(new Persona("Moira", "Kelly"), "Nala (voice)"); lionCast.Add(new Persona("Nathan", "Lane"), "Timon (voice)"); lionCast.Add(new Persona("Ernie", "Sabella"), "Pumbaa (voice)"); string lionSynopsis = "In the Pride Lands of Africa, a pride of lions rule over the animal kingdom from Pride Rock." + "\nKing Mufasa's and Queen Sarabi's newborn son, Simba, is presented to the gathering animals by Rafiki the mandrill," + " the kingdom's shaman and advisor."; Dictionary <Persona, string> aladdinCast = new Dictionary <Persona, string>(); aladdinCast.Add(new Persona("Will", "Smith"), "Genie"); aladdinCast.Add(new Persona("Mena", "Massoud"), "Aladdin"); aladdinCast.Add(new Persona("Naomi", "Scott"), "Princess Jasmine"); aladdinCast.Add(new Persona("Marwan", "Kenzaro"), "Jafar"); string aladdinSynopsis = "Aladdin, a street urchin in the Arabian city of Agrabah, and his monkey Abu meet Princess Jasmine," + " who has snuck away from her sheltered life in the palace. " + "\nJasmine wishes to succeed her father as Sultan, but is instead expected to marry one of her royal suitors," + " including the charming yet dimwitted Prince Anders. " + "\nJafar, the grand vizier, schemes to overthrow the Sultan and seeks a magic lamp hidden in the Cave of Wonders," + " but only \"the diamond in the rough\" can enter the cave."; Pelicula laBellaYLaBestia = new Pelicula("La Bella y la Bestia", "Beaty and the Beast", new Persona("Gary", "Trousdale"), beautyCast, new TimeSpan(1, 24, 0), beautySynopsis); Pelicula elReyLeon = new Pelicula("El Rey Leon", "The Lion King", new Persona("Roger", "Allers"), lionCast, new TimeSpan(1, 28, 0), lionSynopsis); Pelicula aladdin = new Pelicula("Aladdin (2019)", "Aladdin (2019)", new Persona("Guy", "Ritchie"), aladdinCast, new TimeSpan(2, 8, 0), aladdinSynopsis); cine.Peliculas.Add(laBellaYLaBestia); cine.Peliculas.Add(elReyLeon); cine.Peliculas.Add(aladdin); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala1, new DateTime(2020, 12, 18, 11, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala2, new DateTime(2020, 12, 18, 15, 0, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala3, new DateTime(2020, 12, 18, 18, 15, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala4, new DateTime(2020, 12, 19, 10, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala5, new DateTime(2020, 12, 19, 16, 45, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala6, new DateTime(2020, 12, 19, 20, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala1, new DateTime(2020, 12, 20, 12, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala2, new DateTime(2020, 12, 20, 15, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala3, new DateTime(2020, 12, 20, 18, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala4, new DateTime(2020, 12, 21, 12, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala5, new DateTime(2020, 12, 21, 16, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala6, new DateTime(2020, 12, 21, 19, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala1, new DateTime(2020, 12, 23, 9, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala2, new DateTime(2020, 12, 23, 12, 30, 0))); cine.Funciones.Add(new Funcion(laBellaYLaBestia, sala3, new DateTime(2020, 12, 23, 15, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala1, new DateTime(2020, 12, 18, 11, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala2, new DateTime(2020, 12, 18, 15, 0, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala3, new DateTime(2020, 12, 18, 18, 15, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala4, new DateTime(2020, 12, 19, 10, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala5, new DateTime(2020, 12, 19, 16, 45, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala6, new DateTime(2020, 12, 19, 20, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala1, new DateTime(2020, 12, 20, 12, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala2, new DateTime(2020, 12, 20, 15, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala3, new DateTime(2020, 12, 20, 18, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala4, new DateTime(2020, 12, 21, 12, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala5, new DateTime(2020, 12, 21, 16, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala6, new DateTime(2020, 12, 21, 19, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala1, new DateTime(2020, 12, 23, 9, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala2, new DateTime(2020, 12, 23, 12, 30, 0))); cine.Funciones.Add(new Funcion(elReyLeon, sala3, new DateTime(2020, 12, 23, 15, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 18, 11, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 18, 15, 0, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 18, 18, 15, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 19, 10, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 19, 16, 45, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 19, 20, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 20, 12, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 20, 15, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 20, 18, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 21, 12, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 21, 16, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 21, 19, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 23, 9, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 23, 12, 30, 0))); cine.Funciones.Add(new Funcion(aladdin, sala1, new DateTime(2020, 12, 23, 15, 30, 0))); }
static void Main(string[] args) { Persona director1 = new Persona("Sean", "Cunningan"); Dictionary <Persona, string> reparto1 = new Dictionary <Persona, string>(); reparto1.Add(new Persona("Ari", "Lehman"), "Jason"); reparto1.Add(new Persona("Adriane", "King"), "Alice"); reparto1.Add(new Persona("Harry", "Crosby"), "Bill"); string sinopsis1 = "Un grupo de adolescentes que son asesinados uno por uno por un asesino desconocido al intentar reabrir un campamento abandonado."; Pelicula pelicula1 = new Pelicula("Viernes 13", "Friday the 13th", director1, reparto1, new TimeSpan(1, 28, 0), sinopsis1); /////////////////////////////////////////////////////////////////////////// Persona director2 = new Persona("Stanley", "Cubrik"); Dictionary <Persona, string> reparto2 = new Dictionary <Persona, string>(); reparto2.Add(new Persona("Jack", "Nicholson"), "Jack Torrance"); reparto2.Add(new Persona("Shelley", "Duvall"), "Wendy Torrance"); reparto2.Add(new Persona("Danny", "LLoyd"), "Dany Torrance"); string sinopsis2 = "Jack Torrance acepta una oferta de trabajo en un hotel de montaña que se encuentra a 65 kilómetros del pueblo más cercano. ... Danny, el hijo de Jack tiene la capacidad de ver visiones sobre el pasado del hotel y de resistirse a su poder hipnótico"; Pelicula pelicula2 = new Pelicula("El Resplandor", "The Shinning", director2, reparto2, new TimeSpan(2, 26, 00), sinopsis2); /////////////////////////////////////////////////////////////////////////// Persona director3 = new Persona("John", "Carpenter"); Dictionary <Persona, string> reparto3 = new Dictionary <Persona, string>(); reparto3.Add(new Persona("Kurt", "Russell"), "R.J McReady"); reparto3.Add(new Persona("Wildford", "Brimley"), "Dr.Blair"); reparto3.Add(new Persona("Keith", "David"), "Childs"); string sinopsis3 = "Un grupo de investigadores estadounidenses en Antártida que se encuentran con la «Cosa», una forma de vida extraterrestre parasitaria que se asimila y luego imita a otros organismos."; Pelicula pelicula3 = new Pelicula("La Cosa", "The Thing", director3, reparto3, new TimeSpan(1, 45, 0), sinopsis3); /////////////////////////////////////////////////////////////////////////// Persona director4 = new Persona("Ridley", "Scott"); Dictionary <Persona, string> reparto4 = new Dictionary <Persona, string>(); reparto4.Add(new Persona("Sigourney", "Weaver"), "Ellen Ripley"); reparto4.Add(new Persona("Veronica", "Cartwright"), "Lambert"); reparto4.Add(new Persona("Yaphet", "Kotto"), "Parker"); string sinopsis4 = "La tripulación de la nave espacial Nostromo atiende una señal de auxilio y, sin saberlo, sube a bordo una letal forma de vida extraterrestre."; Pelicula pelicula4 = new Pelicula("Alien, el octavo pasajero", "Alien", director4, reparto4, new TimeSpan(1, 56, 0), sinopsis4);; /////////////////////////////////////////////////////////////////////////// Asiento[,] asientossala1 = new Asiento[8, 8]; Sala sala1 = new Sala(1, asientossala1); Cine cine = new Cine("Cinemaster", 100, 200); cine.Peliculas.Add(pelicula1); cine.Peliculas.Add(pelicula2); cine.Peliculas.Add(pelicula3); cine.Peliculas.Add(pelicula4); cine.Salas.Add(sala1); Funcion funcion1 = new Funcion(pelicula1, sala1, new DateTime(2020, 11, 28, 18, 15, 0)); Funcion funcion2 = new Funcion(pelicula1, sala1, new DateTime(2020, 11, 29, 20, 0, 0)); Funcion funcion3 = new Funcion(pelicula2, sala1, new DateTime(2020, 11, 29, 20, 0, 0)); Funcion funcion4 = new Funcion(pelicula2, sala1, new DateTime(2020, 11, 30, 19, 30, 0)); Funcion funcion5 = new Funcion(pelicula3, sala1, new DateTime(2020, 11, 30, 22, 0, 0)); Funcion funcion6 = new Funcion(pelicula3, sala1, new DateTime(2020, 12, 1, 20, 0, 0)); Funcion funcion7 = new Funcion(pelicula4, sala1, new DateTime(2020, 12, 2, 18, 0, 0)); Funcion funcion8 = new Funcion(pelicula4, sala1, new DateTime(2020, 12, 2, 20, 0, 0)); cine.Funciones.Add(funcion1); cine.Funciones.Add(funcion2); cine.Funciones.Add(funcion3); cine.Funciones.Add(funcion4); cine.Funciones.Add(funcion5); cine.Funciones.Add(funcion6); cine.Funciones.Add(funcion7); cine.Funciones.Add(funcion8); PantallaPrincipal(cine); Console.ReadLine(); }
static void PantallaSeleccionAsiento(Cine cine, Funcion funcion) { int ingresofila; int ingresocolumna; bool ocupar = false; string fecha = funcion.FechaHora.ToShortDateString(); string hora = funcion.FechaHora.ToShortTimeString(); Console.Clear(); ////////////////////////////////////////////////////////////////////////////////////////////////// Console.WriteLine($"Pelicula: {funcion.Pelicula.Titulo}\n"); Console.WriteLine($"Funcion: {fecha} {hora}\n"); string str = "PANTALLA"; char c = '='; int largo = (3 * funcion.Sala.Asientos.GetLength(1)); Console.WriteLine($" {CentrarString(str, largo, c)}"); for (int col = 0; col < funcion.Sala.Asientos.GetLength(1); col++) { Console.Write($" {col}"); } Console.WriteLine(); for (int filas = 0; filas < funcion.Sala.Asientos.GetLength(0); filas++) { Console.Write($"{filas}"); for (int columnas = 0; columnas < funcion.Sala.Asientos.GetLength(1); columnas++) { if (funcion.EstadoAsientos[funcion.Sala.Asientos[filas, columnas]] == EstadoAsiento.Ocupado) { Console.Write("["); Console.ForegroundColor = ConsoleColor.Red; Console.Write("O"); Console.ResetColor(); Console.Write("]"); } else if (funcion.Sala.Asientos[filas, columnas].EsVip) { Console.Write("[V]"); } else { Console.Write("[ ]"); } } Console.WriteLine(); } Console.WriteLine(); if (funcion.FechaHora.DayOfWeek == DayOfWeek.Wednesday) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Precio dia miercoles!\n"); Console.ResetColor(); Console.WriteLine($"Referencias:\n[ ] = Libre ${cine.PrecioEntrada / 2} Promo\n[V] = Vip ${cine.PrecioEntradaVIP/2} Promo\n[O] = Ocupado\nIngrese -1 para cancelar.\n"); } else { Console.WriteLine($"Referencias:\n[ ] = Libre ${cine.PrecioEntrada}\n[V] = Vip ${cine.PrecioEntradaVIP}\n[O] = Ocupado\nIngrese -1 para cancelar.\n"); } ////////////////////////////////////////////////////////////////////////////////////////////////// while (!ocupar) { ingresofila = PedirValorIntClampeado("Ingrese fila:\n", -1, funcion.Sala.Asientos.GetLength(0) - 1); if (ingresofila == -1) { return; } ingresocolumna = PedirValorIntClampeado("Ingrese columna:\n", -1, funcion.Sala.Asientos.GetLength(1) - 1); if (ingresocolumna == -1) { return; } ocupar = funcion.IntentarOcuparAsiento(funcion.Sala.Asientos[ingresofila, ingresocolumna]); if (!ocupar) { Console.WriteLine("Asiento ocupado. Seleccione otro asiento."); } if (ocupar) { cine.Entradas.Add(new Entrada(funcion, funcion.Sala.Asientos[ingresofila, ingresocolumna])); } } Console.Clear(); ////////////////////////////////////////////////////////////////////////////////////////////////// Console.WriteLine("Confirmar asiento:\n"); Console.WriteLine($"Pelicula: {funcion.Pelicula.Titulo}\nDia: {fecha} Hora: {hora}\nSala: {funcion.Sala.Numero}\n\nPresione enter para continuar.\n"); Console.ReadLine(); }