public void RestablecerPreferencias() { PlayerPrefs.DeleteAll(); //Reseteo las clases con los valores iniciales CONFIGURACION.GetConfigEnemigosPorOleada().Reset(); CONFIGURACION.GetConfigGeneracionEnergia().Reset(); CONFIGURACION.GetConfigEnergiaInicial().Reset(); //Cargo los valores iniciales y ya no se requiere reinicio InicializarValores(); }
private static bool Estabilidad(VW_MOD_POZO mod_pozo, CONFIGURACION configuracion) { Console.WriteLine("Inicia Estabilidad: " + mod_pozo.POZO); bool Executed; try { ModeloProsper.Estabilidad ObjEstabilidad = new ModeloProsper.Estabilidad(configuracion); var deletes = db.RESULTADOS.Where(w => w.IDDATOSENTRADAEST == configuracion.IDDATOSENTRADAEST).ToList(); // Models.ResultadoModel ResultadoModel = new Models.ResultadoModel(); if (deletes.Count > 0) { Task.Run(() => { deletes.ForEach(e => db.RESULTADOS.Remove(e)); db.SaveChanges(); }); } if (Executed = ObjEstabilidad.Execute()) { var Resultados = ObjEstabilidad.Mapa; //Ejecucion de manera asyncrona y desplegado de errores independientes Task.Run(() => SaveEstabilidad(configuracion, Resultados)); } configuracion.QL = ObjEstabilidad.Ql; configuracion.ESTATUS = Executed?2:-1; configuracion.RECOMENDACIONES = ObjEstabilidad.Recomendacion; db.Entry(configuracion).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); WriteLineText("Termina Estabilidad: " + mod_pozo.POZO, "success"); return(true); } catch (Exception ex) { configuracion.ESTATUS = -1; configuracion.RECOMENDACIONES = ex.Message; db.Entry(configuracion).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); throw new Exception(ex.Message); } }
/// <summary> /// Carga la clase del xml /// </summary> /// <returns>Clase de configuraciones</returns> public static bool CargarConfiguraciones() { try { Configuracion = new CONFIGURACION(); Configuracion = Configuracion.CargarXML("XMLConfig\\Configuracion.xml"); return(true); } catch (Exception ex) { MessageBox.Show(@"No se pudo cargar el archivo de configuraciones: " + ex.Message); return(false); } }
void Start() { GameObject gameControlerObject = GameObject.FindWithTag("GameController"); if (gameControlerObject != null) { controladorDeJuego = gameControlerObject.GetComponent <ControladorDeJuego>(); } if (controladorDeJuego == null) { Debug.Log("No se ha encontrado 'ControladorDeJuego' script"); } energia = (int)CONFIGURACION.GetEnergiaInicial(); actualizarCapaVisual(); StartCoroutine(generarEnergia()); }
public bool Delete() { try { CONFIGURACION conf = CommonBC.DBConexion.CONFIGURACION.First(co => co.ID == this.Id); CommonBC.DBConexion.CONFIGURACION.Remove(conf); CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
/// <summary> /// Rutina de regeneración /// </summary> /// <returns></returns> IEnumerator generarEnergia() { while (true) { // loops forever... if (energia < 100) { // Si está por debajo de 100 energia += (int)CONFIGURACION.GetGeneracionEnergia(); // Obtenemos el valor de incremento energia = Math.Min(100, energia); //Máximo 100 actualizarCapaVisual(); yield return(new WaitForSeconds(1)); } else { // Si ya esta a tope, no hago nada yield return(null); } } }
public bool Read() { try { CONFIGURACION conf = CommonBC.DBConexion.CONFIGURACION.First(co => co.ID == this.Id); this.Rut = conf.RUT; this.Empresa = conf.EMPRESA; this.Direccion = conf.DIRECCION; this.Correo = conf.CORREO; this.Moneda = char.Parse(conf.MONEDA); return(true); } catch (Exception) { return(false); } }
private void InicializarValores() { float volumenEfectos = PlayerPrefs.GetFloat("VolumenEfectos", 0.0f); float volumenMusica = PlayerPrefs.GetFloat("VolumenMusica", 0.0f); sliderEfectos.value = volumenEfectos; sliderMusica.value = volumenMusica; //Configuro el control (Máximo, mínimo y valor por defecto) configurarSlider(sliderNumeroEnemigos, CONFIGURACION.GetConfigEnemigosPorOleada()); configurarSlider(sliderGeneracionEnergia, CONFIGURACION.GetConfigGeneracionEnergia()); configurarSlider(sliderEnergiaInicial, CONFIGURACION.GetConfigEnergiaInicial()); //Recupero los valores sliderNumeroEnemigos.value = CONFIGURACION.GetEnemigosPorOleada(); sliderGeneracionEnergia.value = CONFIGURACION.GetGeneracionEnergia(); sliderEnergiaInicial.value = CONFIGURACION.GetEnergiaInicial(); }
/// <summary> /// Serializa el xml de configuración /// </summary> /// <param name="obj">Objeto de la clase</param> /// <param name="NombreXml">Nombre del xml</param> /// <returns></returns> public static CONFIGURACION CargarXML(this CONFIGURACION obj, string NombreXml) { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(CONFIGURACION)); try { if (System.IO.File.Exists(NombreXml)) { System.IO.StreamReader sr = new System.IO.StreamReader(NombreXml); obj = (CONFIGURACION)serializer.Deserialize(sr); sr.Close(); } } catch (Exception ex) { obj = null; MessageBox.Show(@"No se puede cargar el archivo: " + ex.Message); } return(obj); }
public bool Update() { try { CONFIGURACION conf = CommonBC.DBConexion.CONFIGURACION.First(co => co.ID == this.Id); conf.RUT = this.Rut; conf.EMPRESA = this.Empresa; conf.DIRECCION = this.Direccion; conf.CORREO = this.Correo; conf.MONEDA = char.ToString(this.Moneda); CommonBC.DBConexion.Entry(conf).State = System.Data.EntityState.Modified; CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Create() { try { CONFIGURACION conf = new CONFIGURACION(); conf.ID = this.Id; conf.RUT = this.Rut; conf.EMPRESA = this.Empresa; conf.DIRECCION = this.Direccion; conf.CORREO = this.Correo; conf.MONEDA = char.ToString(this.Moneda); CommonBC.DBConexion.CONFIGURACION.Add(conf); CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
void Start() { levelManager = new ControladorDeDificultad(this); pausa = false; score = 0; restart = false; gameOver = false; //Valor inicial para el número de enemigos numeroEnemigos = (int)CONFIGURACION.GetEnemigosPorOleada(); textoEstado.SetText(""); textoNotificaciones.SetText(""); MenuOpciones.SetActive(false); UpdateScore(); //Cargamos la puntuación del jugador CargarPuntuacionJugador(); //Empezamos StartCoroutine(SpawnWaves()); }
private void Awake() { DontDestroy = GameObject.Find("DD").GetComponent <CONFIGURACION>(); baudRate = int.Parse(DontDestroy.val_BResp32); portName = DontDestroy.val_COMesp32; }
private static void SaveEstabilidad(CONFIGURACION Configuracion, List <ModeloProsper.Clases.MapaEstabilidad.Parametros_Estabilidad> Resultados) { try { using (Entities_ModeloCI db_n = new Entities_ModeloCI()) { if (Resultados.Count > 0) { WriteLineText("Guardando Estabilidad:" + Resultados.Count.ToString() + " resultados (" + Configuracion.IDMODPOZO + ")."); var ids_estabilidad = db.CAT_ESTABILIDAD_OPC.Where(w => w.Ind_Est != null).ToDictionary(d => d.Ind_Est, d => d.IDCATDESCRIPCION); //Dr Ivan foreach (var item in (from r in Resultados where r.Variable != "Qgi" select r).ToList()) { RESULTADOS insert_ivan = new RESULTADOS() { IDRESULTADOS = Guid.NewGuid().ToString().ToUpper(), IDCATDESCRIPCION = ids_estabilidad[item.Ind_Est], IDDATOSENTRADAEST = Configuracion.IDDATOSENTRADAEST, Ind_Est = item.Ind_Est, Ptr = item.Ptr, DiaVal = item.DiaVal, Dp = item.Dp, Dpvalve = item.Dpvalve, Dvalve = item.Dvalve, GOR = item.GOR, QI = item.Ql, Qg = item.Qg, Pwf_IPR = item.Pwf_IPR, Twh = item.Twh, TotalQGas = item.TotalQgas, Pwf_quicklook = item.Pwf_quicklook, Pws = item.Pws, Pti = item.Pti, Ptri = item.Ptri, Tvalv = item.Tvalv, GOR_quicklool = item.GOR_quicklook, GORFREE = item.GORFREE, Ptrcalc = item.Ptrcalc, PI = item.PI, Qgcrit = item.Qgcrit, Qcporcent = item.Qcporcent, HTC = item.HTC, Pwh = item.Pwh, Qgi = item.Qgi, Wc = item.Wc, VARIABLE = item.Variable, metodologia = 0 }; RESULTADOS insert_pob = new RESULTADOS() { IDRESULTADOS = Guid.NewGuid().ToString().ToUpper(), IDCATDESCRIPCION = ids_estabilidad[item.Ind_Poblano], IDDATOSENTRADAEST = Configuracion.IDDATOSENTRADAEST, Ind_Est = item.Ind_Poblano, Ptr = item.Ptr, DiaVal = item.DiaVal, Dp = item.Dp, Dpvalve = item.Dpvalve, Dvalve = item.Dvalve, GOR = item.GOR, QI = item.Ql, Qg = item.Qg, Pwf_IPR = item.Pwf_IPR, Twh = item.Twh, TotalQGas = item.TotalQgas, Pwf_quicklook = item.Pwf_quicklook, Pws = item.Pws, Pti = item.Pti, Ptri = item.Ptri, Tvalv = item.Tvalv, GOR_quicklool = item.GOR_quicklook, GORFREE = item.GORFREE, Ptrcalc = item.Ptrcalc, PI = item.PI, Qgcrit = item.Qgcrit, Qcporcent = item.Qcporcent, HTC = item.HTC, Pwh = item.Pwh, Qgi = item.Qgi, Wc = item.Wc, VARIABLE = item.Variable, metodologia = 1 }; db_n.RESULTADOS.Add(insert_ivan); db_n.RESULTADOS.Add(insert_pob); } db_n.SaveChanges(); WriteLineText("Estabilidad guardada: " + Configuracion.IDMODPOZO); } } } catch (Exception ex) { WriteLineText(Configuracion.IDMODPOZO + ": " + ex.Message, "danger"); } }
public void SetNumeroEnemigos(float valor) { CONFIGURACION.SetEnemigosPorOleada(valor); }
public void SetGeneracionEnergia(float valor) { CONFIGURACION.SetGeneracionEnergia(valor); }
public void SetEnergiaInicial(float valor) { CONFIGURACION.SetEnergiaInicial(valor); }