public frmCiv(Civilizacion civ) : base(Gtk.WindowType.Toplevel) { this.civ = civ; this.Build(); ActualizarDebil(); nvCiudades.NodeStore = stCiudad; nvAvances.NodeStore = stCienciasCono; nvInvestigando.NodeStore = stCienciasAbtas; nvInvestDetalle.NodeStore = stCienciaDetail; nvCiudades.AppendColumn("Nombre", new Gtk.CellRendererText(), "text", 0); nvCiudades.AppendColumn("Población", new Gtk.CellRendererText(), "text", 1); nvCiudades.AppendColumn("Ocupación", new Gtk.CellRendererProgress(), "value", 2); nvCiudades.AppendColumn("Terreno", new Gtk.CellRendererText(), "text", 3); nvAvances.AppendColumn("Avance", new Gtk.CellRendererText(), "text", 0); nvInvestigando.AppendColumn("%", new Gtk.CellRendererProgress(), "text", 0); nvInvestigando.AppendColumn("Avance", new Gtk.CellRendererText(), "text", 1); nvInvestDetalle.AppendColumn("Recurso", new Gtk.CellRendererText(), "text", 0); nvInvestDetalle.AppendColumn("Progreso", new Gtk.CellRendererProgress(), "value", 1); nvCiudades.Columns[0].Reorderable = false; nvCiudades.Columns[1].Reorderable = true; nvCiudades.Columns[2].Reorderable = true; nvAvances.Columns[0].Reorderable = true; nvInvestigando.Columns[0].MaxWidth = 70; }
public static void Main(string[] args) { g_.CargaData(); Global.g_.InicializarJuego(); MyCiv = (Civilizacion)g_.State.Civs[0]; Ciudad cd = (Ciudad)(MyCiv.Ciudades[0]); cd.AutoReclutar = false; //EdificioRAW eraw = g_.Data.Trabajos[0].Edificio; //cd.AgregaEdificio(eraw); //new Trabajo(g_.Data.Trabajos[0], cd); MyCiv.OnNuevoMensaje += MuestraMensajes; Application.Init(); win = new gtk.frmCiv(MyCiv); win.Show(); timer = DateTime.Now; // Ciclo principal while (!endGame) { Tick(); while (Gtk.Application.EventsPending()) Gtk.Application.RunIteration(); } //Application.Run(); }
public static void Main(string[] args) { g_.CargaData(); Global.g_.InicializarJuego(); MyCiv = (Civilizacion)g_.State.Civs[0]; Ciudad cd = (Ciudad)(MyCiv.Ciudades[0]); cd.AutoReclutar = false; //EdificioRAW eraw = g_.Data.Trabajos[0].Edificio; //cd.AgregaEdificio(eraw); //new Trabajo(g_.Data.Trabajos[0], cd); MyCiv.OnNuevoMensaje += MuestraMensajes; Application.Init(); win = new gtk.frmCiv(MyCiv); win.Show(); timer = DateTime.Now; // Ciclo principal while (!endGame) { Tick(); while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } } //Application.Run(); }
public void ValidarUnidades() { // Arrange // Act Civilizacion civ = Civilizacion.GetCivilizacion(8000, 8000, 8000, 8000); // Assert Assert.IsNotNull(civ.Unidades); }
private void btnCerrar_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("¿Desea guardar la civilizacion en un archivo XML y texto ubicados en el escritorio?", "Aviso!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Civilizacion.Guardar(this.civilizacion); Civilizacion.GuardarTexto(this.civilizacion); } this.refresher.Abort(); this.Close(); }
public void ValidarLimitePoblacion() { // Arrange Civilizacion civ = Civilizacion.GetCivilizacion(5000, 5000, 5000, 5000); Unidad unidad = new Unidad("Woad Raider", 0, 65, 35, 0); // Act for (int i = 0; i < 16; i++) { civ += unidad; } // Assert }
public static void Main(string[] args) { g_.CargaData(); g_.InicializarJuego(); #if DEBUG CivLibrary.Debug.Debug.CrearArchivoObjetosAbiertos(); #endif #if HACERARBOL System.Environment.Exit(0); #endif MyCiv = g_.State.Civs[0]; /* * Armada a = new Armada(); * a.AgregaUnidad(new Unidad(U)); * MyCiv.Armadas.Add(a); * Armada b = new Armada(); * b.AgregaUnidad(new Unidad(U)); * g_.State.Civs[1].Armadas.Add(b); * * a.Pelea(b, 0.01f); */ Thread Tk = new Thread(new ThreadStart(Ticker)); string input; LastUpdate = DateTime.Now; Tk.Start(); while (true) { input = Console.ReadLine().ToLower(); switch (input) { case "ciencias": Console.WriteLine("Ciencias conocidas:"); foreach (var x in MyCiv.Avances) { Console.WriteLine(x); } break; default: break; } } }
/// <summary> /// En base a lo que el usuario busco previamente, se fijará qué tipo de entidadmilitar es realizando validaciones y la agregará a la base de datos /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnComprar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtCostoComida.Text)) { if (this.txtTipo.Text == "Unidad") { Unidad unidad = new Unidad(this.txtBuscador.Text, int.Parse(this.txtCostoMadera.Text), int.Parse(this.txtCostoComida.Text), int.Parse(this.txtCostoOro.Text), int.Parse(this.txtCostoPiedra.Text)); try { this.civilizacion += unidad; MessageBox.Show("Carga realizada con exito en la base de datos"); }catch (Exception ex) { MessageBox.Show(ex.Message); } } else { Edificio edificio = new Edificio(this.txtBuscador.Text, int.Parse(this.txtCostoMadera.Text), int.Parse(this.txtCostoComida.Text), int.Parse(this.txtCostoOro.Text), int.Parse(this.txtCostoPiedra.Text)); try { this.civilizacion += edificio; MessageBox.Show("Carga realizada con exito en la base de datos"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } else { MessageBox.Show("Primero debe buscar una unidad para comprar!!"); } }
static void Main(string[] args) { // Hardcodeo de entidades militares Civilizacion civ = Civilizacion.GetCivilizacion(500, 8000, 500, 0); Edificio edificioCastillo = new Edificio("Castillo", 0, 0, 0, 650); Edificio edificioGaleria = new Edificio("Galeria", 175, 0, 0, 0); Edificio edificioEstablo = new Edificio("Establo", 175, 0, 0, 0); Unidad unidad = new Unidad("Caballeria Ligera", 0, 80, 0, 0); // Se empiezan a agregar estas entidades a la civilizacion ( Persisten en la base de datos) // Siendo 15 el limite de poblacion, agrego a 15 unidades para alcanzarlo y lanzar excepcion al siguiente intento for (int i = 0; i < 15; i++) { civ += unidad; } try { civ += unidad; } catch (Exception ex) { Console.WriteLine(ex.Message); } civ += edificioEstablo; civ += edificioGaleria; // Se intenta agregar un castillo sin poseer piedra try { civ += edificioCastillo; } catch (Exception ex) { Console.WriteLine(ex.Message); } /// Se guardan los datos en un archivo xml en el escritorio Civilizacion.Guardar(civ); /// Se guardan el un archivo de texto en el escritorio Civilizacion.GuardarTexto(civ); /// Se leen los datos del archivo de texto Console.WriteLine(Civilizacion.LeerTexto()); Console.WriteLine("PD: Los celtas no tienen camellos :c"); Console.ReadKey(); }
private void FormularioInventario_Load(object sender, EventArgs e) { this.civilizacion = Civilizacion.GetCivilizacion(1500, 600, 600, 700); this.refresher.Start(); }