public static ElementosJuego buscarElemJuego(Elemento elem) { if (Player.elemento == elem) return Player; foreach (Jugador aux in Jugadores) { if (aux.elemento == elem) return aux; } foreach (Enemigo aux in Enemigos) { if (aux.elemento == elem) return aux; } foreach (Obstaculo aux in Obstaculos) { if (aux.elemento == elem) return aux; } foreach (Comida aux in Comidas) { if (aux.elemento == elem) return aux; } foreach (NPCEnMapa aux in NPCsEnMapa) { if (aux.elemento == elem) return aux; } return new Jugador(new Personaje("", -1), new Vector2(0,0)); }
public Dictionary<Elemento, List<List<Elemento>>> terminar = new Dictionary<Elemento, List<List<Elemento>>>(); //Elemento - cosas que provoca #endregion Fields #region Methods public void instanciarDialogoPulsable(Elemento elem) { if (pfBoton == null) { pfBoton = Resources.Load("Prefabs/Boton") as GameObject; if (pfBoton == null) { throw new Exception("Cannot find resource"); } } GameObject GO = (GameObject)Instantiate(pfBoton, new Vector3(0, 0, 0), Quaternion.identity); GO.transform.parent = GameObject.Find("TextContainer").transform; GO.name = elem.nombre; GO.GetComponentInChildren<Text>().text = elem.propiedades["texto"]; GO.transform.localPosition = new Vector3(float.Parse(elem.propiedades["posicionx"]) -100, 0, 0); foreach (KeyValuePair<Elemento, List<List<Elemento>>> par in pulsar) { if (par.Key == elem) { foreach (List<Elemento> consecuente in par.Value) { foreach (Elemento el in consecuente) { if(el.nombre == "mostrar") { addListener(GO, el, consecuente); } } } } } }
public void FiltroComentariosPorFechaResolucionNoAgregadaOK() { Elemento e = utilidad.NuevoElemento(); e.Comentarios = new List <Comentario>(); Comentario c1 = utilidad.NuevoComentario(); Comentario c2 = utilidad.NuevoComentario(); c1.FechaResolucion = new DateTime(2017, 5, 6); c2.FechaResolucion = new DateTime(2017, 5, 5); e.AgregarComentario(c1); e.AgregarComentario(c2); nuevoSistema.AgregarElemento(e); List <Comentario> comentarios = nuevoSistema.FiltroComentarioPorFechaResolucion(new DateTime(2017, 5, 7)); bool condicion = !comentarios.Contains(c1) && !comentarios.Contains(c2); Assert.IsTrue(condicion); }
public override IDado Retirar() { if (!IsEmpty()) { IDado resultado = inicioFila.prox.dado; if (inicioFila.prox != finalFila) { inicioFila.prox = inicioFila.prox.prox; } else { inicioFila.prox = null; finalFila = inicioFila; } return(resultado); } return(null); }
public virtual Dados RemoveFirst() { if (this.prim.Prox != null) { Elemento aux = this.prim.Prox; Elemento aux2 = aux; this.prim.Prox = aux.Prox; aux = null; ElementDeleted(); CalcMenor(); Rebuild(); return(aux2.GetDados()); } else { return(null); } }
protected void PonerElemento(int cant, Elemento element) { int x; int y; do { x = Random.Next(0, N); y = Random.Next(0, M); if (!Ocupadas[x, y]) { Ocupadas[x, y] = true; Casillas[x, y] = element; switch (element) { case Elemento.Niño: { PosNiños.Add(new Tuple <int, int>(x, y)); Acciones.Enqueue("Se ubica niño en la posicion (" + x + "," + y + ")"); } break; case Elemento.Suciedad: { PosSuciedad.Add(new Tuple <int, int>(x, y)); Acciones.Enqueue("Se crea suciedad en la posicion (" + x + "," + y + ")"); } break; case Elemento.Obstaculo: { PosObstaculo.Add(new Tuple <int, int>(x, y)); Acciones.Enqueue("Se ubica obstaculo en la posicion (" + x + "," + y + ")"); } break; default: break; } cant--; } } while (cant > 0 && HayEspacio()); }
public JsonResult AddGroup(NodoElementoModel model) { Elemento NewElement = null; var elemento = entities.Elemento.FirstOrDefault(p => p.nomElemento == model.elemento && p.fk_Organizacion == model.pk_Organizacion); if (elemento == null) { NewElement = new Elemento { fk_TipoElemento = 2, fk_Organizacion = model.pk_Organizacion, nomElemento = model.elemento }; entities.Elemento.Add(NewElement); entities.SaveChanges(); } return(Json(new { id = NewElement.pk_Elemento }, JsonRequestBehavior.AllowGet)); }
/// <summary> ///Em um grafo conexo G com exatamente 2K vértices de grau ímpar, existem K subgrafos disjuntos de arestas, todos eles unicursais, de maneira que juntos eles contêm todas as arestas de G /// </summary> /// <returns> /// true : É Unicursal /// False: Não é unicursal /// </returns> public bool IsUnicursal() { int Impar = 0; Elemento aux = vertices.pri.Prox; while (aux.Prox != null) { if (vertices.BuscarVertice((Vertice)aux.Dados).Arestas.Tamanho % 2 != 0) { Impar++; if (Impar > 1)//se ele possuir mais de um vértice com grau par { return(true); } } aux = aux.Prox; } return(false); }
internal void GuardarDatosAux(ref MySqlConnection cn, ref MySqlTransaction tr) { PRODUCTOS.Productos auxL = PRODUCTOS.Productos.ObtenInstancia(); string sql = _SQL_LINEAS_CARE; sql = sql.Replace("[IDELEM]", (this._datos["ID_ELEM"] != DBNull.Value ? this._datos["ID_ELEM"].ToString() : "0")); foreach (DataRow d in this._lineas.Rows) { d["ID_ELEM_CARE"] = this._datos["ID_ELEM"]; if (d["ID_ELEM"].ToString() == "") { Elemento auxe = new Elemento(); auxe.TIPO_ELEMENTO = "LRS"; d["ID_ELEM"] = auxe.ObtenIDNuevoElemento(ref cn, ref tr); Thread.Sleep(10); } } IGlobal.guardar_datos(sql, ref this._lineas, ref cn, ref tr); }
public string pop() { Elemento aux = this.topo.Prox; if (aux != null) { this.topo.Prox = aux.Prox; aux.Prox = null; if (aux == this.fundo) { this.fundo = this.topo; } return(aux.GetDado()); } else { return(null); } }
/// <summary> /// COLOCA UM VERTICE NA FILA /// </summary> /// <param name="vertice"></param> public void ColocarFila(Vertice vertice) { Elemento novo = new Elemento { Vertice = vertice, Proximo = null }; if (Fim != null) { Fim.Proximo = novo; } else { Inicio = novo; } Fim = novo; }
private void CalcMenor() { Elemento next = this.prim.Prox; while (next != null) { Processo dd = (Processo)menor; if (dd == null) { this.menor = next.GetDados(); } else if (dd.CompareTTotalExecucao(next.GetDados()) == -1) { this.menor = next.GetDados(); } next = next.Prox; } }
private static List <Elemento> Scrapp(WebDriverInstance wbInstance, ICollection <Rule> ruleList) { ElementoBuilder _ElementoBuilder = new ElementoBuilder(); List <Elemento> list = new List <Elemento>(); List <ElementoScrap> esps = wbInstance._scrapInstance.GetSharedElements(ruleList); foreach (var esp in esps) { Elemento elemento = new Elemento(); _ElementoBuilder.BuildElemento( elemento, esp.Selected, esp.TagName, esp.Enable, esp.Displayed, esp.Text, esp.Type, esp.Height, esp.Width, esp.X, esp.Y, esp.ClassName, esp.UICodigo, esp.Label, esp.OnClick, esp.IsGrid, esp.IsCampoPesquisa, esp.TabIndex ); if (elemento.TipoControle == ConstControlTypeUI.TYPE_COMBOBOX) { elemento.OptionValues = wbInstance._scrapInstance.GetComboboxOptions(elemento.CodigoUi); } list.Add(elemento); } return(list); }
private void preencherListview() { listView1.Items.Clear(); for (int x = 31; x >= 0; x--) { aux = escalonador.LstListaProcessos[x].InicioFila.prox; while (aux != null) { processo = (Processo)aux.dado; item = new ListViewItem(processo.PID.ToString()); item.SubItems.Add(processo.nome); item.SubItems.Add(processo.tempoRestante.ToString()); item.SubItems.Add(processo.tempoEspera.ToString()); item.SubItems.Add(processo.prioridade.ToString()); listView1.Items.Add(item); aux = aux.prox; } } }
public virtual void Add(Dados el) { Rebuild(); Elemento aux = new Elemento(el); this.ult.Prox = aux; this.ult = aux; ElementAdded(); Processo dd = (Processo)menor; if (dd == null) { this.menor = el; } else if (dd.CompareTTotalExecucao(el) == -1) { this.menor = el; } }
public void selectCorrect() { int aleatorio = Random.Range(0, elementos.Count); elementoCorrecto = elementos[aleatorio]; elementosIncorrecto = new List <Elemento>(); string correctWord = elementoCorrecto.getNombre(); textoPalabra.text = correctWord; correctsAnswer.Add(correctWord); for (int i = 0; i < elementos.Count; i++) { if (!elementos[i].getNombre().Equals(correctWord)) { elementosIncorrecto.Add(elementos[i]); } } loadAudio(correctWord); }
//A única modificação (além das adaptações de contexto) da classe Lista foi a inclusão do contador de comparações necessárias para buscar o RoomID na Lista (que nesse caso é uma posição da Tabela) public Airbnb Pesquisar(int RoomID, ref int NumComp) { Aux = Início; while (Aux != null) { NumComp++; if (Aux.Airbnb.RoomID == RoomID) { return(Aux.Airbnb); } else { Aux = Aux.Prox; } } return(null); }
public void BuscarComentarioPorUsuarioYFechaNotOK() { DateTime fecha = new DateTime(2017, 2, 2); DateTime fecha2 = new DateTime(2017, 3, 2); Pizarron p = utilidad.NuevoPizarron(); Elemento e = utilidad.NuevoElemento(); Comentario c = utilidad.NuevoComentario(); Usuario u = utilidad.NuevoUsuario(); c.FechaCreacion = fecha; c.Creador = u; p.AgregarElemento(e); e.AgregarComentario(c); nuevoSistema.AgregarPizarron(p); Comentario buscar = nuevoSistema.BuscarComentarioPorUsuarioYFecha(u, fecha2); bool condicion = buscar == null; Assert.IsTrue(condicion); }
private Elemento RemoveElemento(Elemento item) { Elemento Aux; if (Início == null) { return(null); } if (Início.Equals(item)) { Início = Início.Prox; if (Início != null) { Início.Ant = null; } return(Início); } Elemento el = Início; while (el != null && !el.Equals(item)) { el = el.Prox; } if (el == null) { return(null); } Aux = el.Prox; el.Ant.Prox = el.Prox; if (el.Prox != null) { el.Prox.Ant = el.Ant; } return(Aux); }
public void rewardCorrect() { int aleatorio = Random.Range(0, correctsAnswer.Count); elementosIncorrecto = new List <Elemento>(); string correctWord = correctsAnswer[aleatorio]; for (int i = 0; i < elementos.Count; i++) { if (!elementos[i].getNombre().Equals(correctWord)) { elementosIncorrecto.Add(elementos[i]); } else { elementoCorrecto = elementos[i]; } } loadAudio(correctWord); }
/// <summary> /// Um grafo conexo, não orientado é euleriano se, e somente se, todos os seus vértices tiverem grau par /// </summary> /// <returns> /// true: é Euleriano /// False: não é Euleriano /// </returns> public bool IsEuleriano() { if (IsConexo()) { Elemento aux = vertices.pri.Prox; while (aux.Prox != null) { if (vertices.BuscarVertice((Vertice)aux.Dados).Arestas.Tamanho % 2 != 0) { return(false); } aux = aux.Prox; } return(false); } else { return(false); } }
public void FiltroComentariosPorUsuarioResolutorNoAgregadoOK() { Elemento e = utilidad.NuevoElemento(); e.Comentarios = new List <Comentario>(); Comentario c1 = utilidad.NuevoComentario(); Comentario c2 = utilidad.NuevoComentario(); Usuario u1 = utilidad.NuevoUsuario(); Usuario u2 = utilidad.OtroUsuario(); c1.Resolutivo = u1; c2.Resolutivo = u1; e.AgregarComentario(c1); e.AgregarComentario(c2); nuevoSistema.AgregarElemento(e); List <Comentario> comentarios = nuevoSistema.FiltrarComentarioPorUsuarioResolutor(u2); bool condicion = !comentarios.Contains(c2) && !comentarios.Contains(c1); Assert.IsTrue(condicion); }
/// <summary> /// Pega o elemento no topo da pilha, removendo- /// </summary> /// <returns></returns> public T Pop() { Elemento aux = this.topo.Prox; if (aux != null) { this.topo.Prox = aux.Prox; aux.Prox = null; if (aux == this.fundo) { this.fundo = this.topo; } this.count--; return((T)aux.GetDado()); } else { return(default(T)); } }
public void Inserir(Airbnb Dado) { Elemento Novo = new Elemento(); Novo.Airbnb = Dado; if (Início == null) { Início = Novo; Fim = Novo; Novo.Prox = null; } else { Fim.Prox = Novo; Fim = Novo; Fim.Prox = null; } }
/// <summary> /// Método para verificar quantas componentes conexas o grafo possui /// </summary> /// <returns>O número total de componentes conexas de um grafo</returns> private int GetComponentes() { int componentes = 0; ResetarCores(); Elemento aux = vertices.pri.Prox; while (aux.Prox != null) { if (vertices.BuscarVertice((Vertice)aux.Dados).Cor == "BRANCO") { Visitar(vertices.BuscarVertice((Vertice)aux.Dados)); componentes++; } aux = aux.Prox; } return(componentes); }
private int ValidaToken(string sToken) { int iRespuesta = 0; XDocument xmlToken = XDocument.Parse(sToken); var Valores = from Elemento in xmlToken.Descendants("APP") select new { IDAgente = Elemento.Element("IDCredenciales").Value }; foreach (var Elemento in Valores) { ViewState["sMatriculas"] = Elemento.IDAgente; } iRespuesta = 1; return(iRespuesta); }
public virtual Dados Remover(Dados obj) { Elemento aux = this.prim; while (aux.Prox != null) { if (aux.Prox.GetDados().Equals(obj)) { Elemento aux2 = aux.Prox; aux.Prox = aux.Prox.Prox; aux2.Prox = null; ElementDeleted(); CalcMenor(); Rebuild(); return(aux2.GetDados()); } aux = aux.Prox; } return(null); }
public JsonResult AddNode(NodoElementoModel model) { Usuario NewUser = new Usuario { fk_Directorio = model.fk_Directorio, loginUsuario = model.loginUsuario, nombreUsuario = model.nombreUsuario, emailUsuario = model.emailUsuario, fk_Dependencia = model.pk_Dependencia, fk_TipoIdentificacion = model.pk_TipoIdentificacion, numIdentificacion = model.numIdentificacion, bloqueado = model.bloqueado, activo = model.activo }; entities.Usuario.Add(NewUser); entities.SaveChanges(); Elemento NewElement = new Elemento { fk_TipoElemento = model.pk_TipoElemento, fk_Organizacion = model.pk_Organizacion, nomElemento = model.elemento }; entities.Elemento.Add(NewElement); entities.SaveChanges(); Funcion NewFunction = new Funcion { fk_Usuario = NewUser.pk_Usuario, fk_Elemento = NewElement.pk_Elemento, rolPrincipal = model.rolPrincipal, ak_NodoPadre = model.pid }; entities.Funcion.Add(NewFunction); entities.SaveChanges(); return(Json(new { id = NewUser.pk_Usuario }, JsonRequestBehavior.AllowGet)); }
public static void AggiungiElementi() { // Creare un nuovo elemento (servizio di Negozio) // Invocare il metodo Modifica // In caso di successo, aggiungere l'elemento al negozio (servizio di Document) string categoria = null; //Faccio scegliere la categoria using (ListForm listForm = new ListForm()) { listForm.EditButton.Enabled = false; listForm.AddButton.Enabled = false; listForm.DeleteButton.Enabled = false; listForm.DataSource = Negozio.Categorie; listForm.Text = "Scelta categoria elemento"; Label label = new Label(); label.Text = "Scegliere la categoria dell'elemento"; label.TextAlign = ContentAlignment.MiddleCenter; label.Anchor = AnchorStyles.Top; label.AutoSize = true; listForm.SetFilter(label); listForm.Size = new Size(568, 355); listForm.OkButton.DialogResult = DialogResult.OK; if (listForm.ShowDialog() == DialogResult.OK && listForm.DataGridView.CurrentRow != null) { categoria = listForm.DataGridView.CurrentRow.DataBoundItem.ToString(); } else { return; } } Elemento elemento = Negozio.NuovoElemento(categoria); if (NoleggioServices.Modifica(elemento, true)) { Negozio.InserisciNuovoElemento(elemento); } }
public Boolean RemoveElementos(Elemento item, int qt) { Elemento Aux = item; Boolean flag = true; try { while (qt != 0) { Aux = RemoveElemento(Aux); qt--; Tamanho--; } return(true); } catch (Exception e) { return(false); } }
public ActionResult Crear(CuerposDeElemento modelo) { if (ModelState.IsValid) { DefaultListPerfiles(); Elemento elem = db.Elementos.Find(modelo.Id_Elemento); modelo.Nivel_de_tension = elem.NivelTension; db.CuerposDeElementoes.Add(modelo); db.SaveChanges(); int numeroCuerpo = db.CuerposDeElementoes.ToList().FindAll(x => x.Id_Elemento == modelo.Id_Elemento).Count; TempData["guardado"] = "Registro guardado con exito"; TempData["cuerpos"] = numeroCuerpo; return(View(modelo)); } else { ModelState.AddModelError("error", "error en agregar el elemento"); return(View(modelo)); } }
private void ImprimirEmprestimos(int id) { try { Usuario atual = (Usuario)ArvoreUsuarios.Buscar(id); Lista Emprestimo = atual.Emprestimos; Elemento aux = Emprestimo.prim.prox; while (aux != null) { Operacao op = (Operacao)aux.dado; PreencheGrid(op); aux = aux.prox; } } catch (NullReferenceException) { MessageBox.Show("Usuario nao exite!!"); } }
public string ObtenerResultado(Elemento jugador1, Elemento jugador2) { var resultado = string.Empty; if (!jugador1.Equals(jugador2)) { switch (jugador1) { case Elemento.Piedra: resultado = (jugador2 == Elemento.Lagarto || jugador2 == Elemento.Tijera) ? GanaJugador1 : GanaJugador2; break; case Elemento.Papel: resultado = (jugador2 == Elemento.Piedra || jugador2 == Elemento.Spock) ? GanaJugador1 : GanaJugador2; break; case Elemento.Tijera: resultado = (jugador2 == Elemento.Papel || jugador2 == Elemento.Lagarto) ? GanaJugador1 : GanaJugador2; break; case Elemento.Lagarto: resultado = (jugador2 == Elemento.Spock || jugador2 == Elemento.Papel) ? GanaJugador1 : GanaJugador2; break; case Elemento.Spock: resultado = (jugador2 == Elemento.Tijera || jugador2 == Elemento.Piedra) ? GanaJugador1 : GanaJugador2; break; } } else resultado = Empate; return resultado; }
public Incidente() { _atenciones = new BindingList<Atencion>(); _solicitudCambio = new SolicitudCambio(); _tipoIncidente = new TipoIncidente(); _elemento = new Elemento(); _impacto = new Impacto(); _plataforma = new Plataforma(); _prioridad = new Prioridad(); _solicitudCambio = new SolicitudCambio(); _categoria = new Categoria(); _subCategoria = new SubCategoria(); _usuarioDeriva = new Usuario(); _usuarioAsigna = new Usuario(); _asesor = new Usuario(); _area = new Area(); _sede = new Sede(); _usuarioContacto = new Usuario(); }
/// <summary> /// Agrega un elemento a la lista del nivel /// </summary> /// <param name="elementoAgregado">elemento a agregar</param> public void agregarElemento(Elemento elementoAgregado) { listaElementos.Add(elementoAgregado); List<List<relacion>> temp = new List<List<relacion>>(); for (int a = 0; a < listaElementos.Count; a++) { temp.Add(new List<relacion>()); for (int b = 0; b < listaElementos.Count; b++) { temp[a].Add(null); } } //se copia la información que había en la matriz hasta ahora for (int i = 0; i < matriz.Count; i++) { for (int j = 0; j < matriz[i].Count; j++) { temp[i][j] = matriz[i][j]; } } matriz = temp; }
public EnlaceStats(int idProyecto, int idEnlace) { Data.dsEstadisticasTableAdapters.EstadisticasEnlaceTableAdapter Adapter = new Data.dsEstadisticasTableAdapters.EstadisticasEnlaceTableAdapter(); Data.dsEstadisticas.EstadisticasEnlaceDataTable dt = Adapter.SelectEstadisticasEnlace(idProyecto, idEnlace); this.nBWReservadoTotal = 0; this.listaElementos = new List<Elemento>(); if (dt.Count > 0) { this.idProyecto = dt[0].idProyecto; this.idEnlace = dt[0].idEnlace; this.nBWTotal = dt[0].nBandwidthTotal; } foreach(var dr in dt) { Elemento temp = new Elemento(); temp.idLSP = dr.idLSP; temp.cNombre = new LSP(this.idProyecto, temp.idLSP).cNombre; temp.nBWElemento = dr.nBandwidthLSP; this.nBWReservadoTotal += dr.nBandwidthReservado; this.listaElementos.Add(temp); } }
public static void mostrarDialogo(Elemento elem) { if (elem.propiedades["pulsable"] == "no") { GameObject.Find("TextContainer").GetComponentInChildren<Text>().text = elem.propiedades["texto"]; GameObject.Find("TextContainer").GetComponent<TextContainer>().dialogo = elem; } else if (elem.propiedades["pulsable"] == "si") { GameObject.Find("TextContainer").GetComponentInChildren<Text>().text = " "; GameObject.Find("TextContainer").GetComponentInChildren<TextContainer>().dialogo = null; } }
public static void morir(Elemento elem) { ElementosJuego aux = buscarElemJuego(elem); if (aux.modo == 1) return; if (aux.reaparece == "random") { aux.posicion.x = UnityEngine.Random.Range(0.5f, 9.5f); aux.posicion.y = UnityEngine.Random.Range(0.5f, 9.5f); aux.GO.transform.localPosition = aux.posicion3D(); } else if (aux.reaparece == "si") { aux.GO.transform.localPosition = aux.posicion3D(); } else { Destroy(buscarElemJuego(elem).GO); } }
public void CreateElemento(Elemento elemento, Nivel n) { if (this.nombreselementos.Any(x => x == elemento.nombre)) { // such a person already exists: there should be some validation message, but // it is not so important in a demo return; } var p = new ElementoGrafo(this.Graph) { nombre = elemento.nombre, valor = (int)elemento.valor }; int i = revisarsubgrafo(n); if (i != -1) { this.Graph.SubGraphs.ElementAt(i).AddVertex(p); } else { SubGraph<ElementoGrafo> sg2 = new SubGraph<ElementoGrafo>() { Label = n.nombre}; sg2.AddVertex(p); this.Graph.AddSubGraph(sg2); if (existeenotrosubgrafo(sg2.Label)) { createlink(sg2, buscarsubgrafo(n.nombre)); } } }
private void pictureBox2_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { foreach (Elemento a in Herramienta) { if(pm.Colicion(a.rec[0],new PointF(e.X,e.Y+(vScrollBar2.Value*pictureBox2.Height/100)))) { selected = a; break; } } } }
public void agregarAntec(Elemento elem) { if (cantidadA < 4) { cantidadA = cantidadA + 1; antecedenteActual.Add(elem); actualizarTxtAntec(); } else { Debug.Log("Error, no se pueden mas de 4 elementos!"); } }
public void AgregarElemento(Elemento E) { }
public void modificarElemento(int posicion, Elemento elemento) { listaElementos[posicion] = elemento; }
private void addListener(GameObject GO, Elemento el, List<Elemento> consecuente) { GO.GetComponent<Button>().onClick.AddListener(delegate { foreach (Transform child in GO.transform.parent) { if (child.gameObject.GetComponent<Button>() != null) Destroy(child.gameObject); } Controller.mostrarDialogo(consecuente[consecuente.IndexOf(el) + 1]); }); }
public void onTermina(Elemento e) { foreach (KeyValuePair<Elemento, List<List<Elemento>>> par in terminar) { if (par.Key == e) { foreach (List<Elemento> consecuente in par.Value) { foreach (Elemento elem in consecuente) { if (elem.nombre == "mostrar") { Controller.mostrarDialogo(consecuente[consecuente.IndexOf(elem) + 1]); if (consecuente[consecuente.IndexOf(elem) + 1].propiedades["pulsable"] == "si") { instanciarDialogoPulsable(consecuente[consecuente.IndexOf(elem) + 1]); } } } } } } }
public static bool tiene(Elemento elem, Elemento objeto) { if (buscarElemJuego(elem).inventario.Contains(objeto)) return true; return false; }
//Al presionar cancelar se cierra. private void button2_Click(object sender, EventArgs e) { //guardar los datos de la tabla foreach (Nivel n in sistema.niveles) { if (n.nombre.Equals(comboBox1.SelectedItem.ToString())) { Elemento elemento = new Elemento(textBox1.Text, double.Parse(textBox2.Text)); n.agregarElemento(elemento); } } limpia_text(sender, e); llenarTablas(); }
public void agregarConsec(Elemento elem) { if (cantidadC < 4) { cantidadC = cantidadC + 1; consecuenteActual.Add(elem); actualizarTxtConsec(); } else { Debug.Log("Error, no se pueden mas de 4 elementos!"); } }
public static void coger(Elemento elem, Elemento objeto) { buscarElemJuego(elem).inventario.Add(objeto); Destroy(buscarElemJuego(objeto).GO); }
public void cargarEjemploColectivo() { Elemento gananciaColectivo = new Elemento("Ganancia colectivo", 2000); Elemento gananciaMicro = new Elemento("Ganancia microbus", 0); Elemento precioPasajeColectivo = new Elemento("Precio pasaje colectivo", 200); Elemento precioPasajeMicro = new Elemento("Precio pasaje micro", 150); Elemento cantidadTotalUsuarios = new Elemento("Cantidad total de usuarios", 0); Elemento precioPetroleo = new Elemento("Precio petróleo", 140); Elemento precioBencina = new Elemento("Precio bencina", 0); Elemento gananciaDiariaColectivero = new Elemento("Ganancia diaria colectivero", 0); Nivel primerNivel = new Nivel("Primer nivel"); primerNivel.agregarElemento(gananciaDiariaColectivero); primerNivel.agregarElemento(new Elemento("Ganancia diaria conductor microbús", 0)); primerNivel.agregarElemento(gananciaColectivo); primerNivel.agregarElemento(gananciaMicro); primerNivel.agregarElemento(new Elemento("Número de vueltas al día colectivo", 20)); primerNivel.agregarElemento(new Elemento("Número de vueltas al día microbús", 10)); primerNivel.agregarElemento(precioPasajeColectivo); primerNivel.agregarElemento(precioPasajeMicro); primerNivel.agregarElemento(cantidadTotalUsuarios); primerNivel.agregarRelacion(2, 0, new relacion("x", new regla(1))); primerNivel.agregarRelacion(3, 1, new relacion("x", new regla(1))); primerNivel.agregarRelacion(4, 0, new relacion("y*x", new regla(1))); primerNivel.agregarRelacion(5, 1, new relacion("y*x", new regla(1))); Nivel nivelColectivo = new Nivel("Colectivo"); Elemento demandaColectivo = new Elemento("Demanda de clientes colectivo", 40); nivelColectivo.agregarElemento(precioPasajeColectivo); nivelColectivo.agregarElemento(precioBencina); nivelColectivo.agregarElemento(demandaColectivo); nivelColectivo.agregarElemento(gananciaColectivo); nivelColectivo.agregarElemento(new Elemento("Distancia recorrida", 1000)); nivelColectivo.agregarElemento(new Elemento("Bencina ocupada", 10)); nivelColectivo.agregarElemento(new Elemento("Perdida por desgaste", 0)); nivelColectivo.agregarElemento(new Elemento("Perdida por reparacion", 0)); nivelColectivo.agregarElemento(new Elemento("Desgaste (Kilometraje acumulado)", 0)); //Relaciones //nivelColectivo.agregarRelacion(1, 3, new relacion("x*(6/13)", new regla(1))); nivelColectivo.agregarRelacion(0, 3, new relacion("x", new regla(1))); nivelColectivo.agregarRelacion(0, 2, new relacion("logx*(x/35)", new regla(1))); nivelColectivo.agregarRelacion(1, 0, new relacion("x*(6/7)", new regla(1))); nivelColectivo.agregarRelacion(1, 5, new relacion("x", new regla(1))); nivelColectivo.agregarRelacion(2, 3, new relacion("y*x", new regla(1))); nivelColectivo.agregarRelacion(2, 4, new relacion("x*10", new regla(1))); nivelColectivo.agregarRelacion(4, 5, new relacion("y*(x/14)", new regla(1))); nivelColectivo.agregarRelacion(4, 8, new relacion("y+x", new regla(1))); nivelColectivo.agregarRelacion(5, 3, new relacion("y-x", new regla(1))); nivelColectivo.agregarRelacion(6, 3, new relacion("y-x", new regla(1))); nivelColectivo.agregarRelacion(7, 3, new relacion("y-x", new regla(1))); nivelColectivo.agregarRelacion(8, 6, new relacion("x/15", new regla(1))); nivelColectivo.agregarRelacion(8, 7, new relacion("x/25", new regla(350, ">"))); nivelColectivo.agregarRelacion(8, 8, new relacion("0", new regla(500, ">="))); Nivel nivelMicrobus = new Nivel("Microbus"); Elemento demandaMicrobus = new Elemento("Demanda de clientes microbus", 0); nivelMicrobus.agregarElemento(precioPasajeMicro); nivelMicrobus.agregarElemento(precioPetroleo); nivelMicrobus.agregarElemento(demandaMicrobus); nivelMicrobus.agregarElemento(gananciaMicro); nivelMicrobus.agregarElemento(new Elemento("Distancia recorrida", 40)); nivelMicrobus.agregarElemento(new Elemento("Petroleo ocupado", 200)); nivelMicrobus.agregarElemento(new Elemento("Perdida por desgaste", 0)); nivelMicrobus.agregarElemento(new Elemento("Perdida por reparacion", 0)); nivelMicrobus.agregarElemento(new Elemento("Desgaste (Kilometraje acumulado)", 0)); //Relaciones: //nivelMicrobus.agregarRelacion(1, 3, new relacion("x", new regla(1))); nivelMicrobus.agregarRelacion(0, 3, new relacion("x", new regla(1))); nivelMicrobus.agregarRelacion(0, 2, new relacion("logx*(x/6)", new regla(1))); nivelMicrobus.agregarRelacion(1, 0, new relacion("logx*(x/5)", new regla(1))); nivelMicrobus.agregarRelacion(1, 5, new relacion("x", new regla(1))); nivelMicrobus.agregarRelacion(2, 3, new relacion("y*x", new regla(1))); nivelMicrobus.agregarRelacion(4, 5, new relacion("y*(x/6)", new regla(1))); nivelMicrobus.agregarRelacion(4, 8, new relacion("y+x", new regla(1))); nivelMicrobus.agregarRelacion(5, 3, new relacion("y-x", new regla(1))); nivelMicrobus.agregarRelacion(6, 3, new relacion("y-x", new regla(1))); nivelMicrobus.agregarRelacion(7, 3, new relacion("y-x", new regla(1))); nivelMicrobus.agregarRelacion(8, 6, new relacion("x/10", new regla(1))); nivelMicrobus.agregarRelacion(8, 7, new relacion("x/15", new regla(350, ">"))); nivelMicrobus.agregarRelacion(8, 8, new relacion("0", new regla(500, ">="))); Nivel nivelUsuario = new Nivel("Demanda usuarios"); nivelUsuario.agregarElemento(cantidadTotalUsuarios); nivelUsuario.agregarElemento(demandaColectivo); nivelUsuario.agregarElemento(demandaMicrobus); nivelUsuario.agregarRelacion(1, 0, new relacion("x", new regla(1))); nivelUsuario.agregarRelacion(2, 0, new relacion("y+x", new regla(1))); Nivel petroleo = new Nivel("Indicadores economicos"); Elemento inflacion = new Elemento("Inflación económica", 1); Elemento deuda = new Elemento("Deuda familiar acumulada del mes", 7000); Elemento gastoDiario = new Elemento("Gasto familiar diario", 6000); petroleo.agregarElemento(precioPetroleo); petroleo.agregarElemento(precioBencina); petroleo.agregarElemento(inflacion); petroleo.agregarElemento(gastoDiario); petroleo.agregarRelacion(0, 1, new relacion("x*(15/10)", new regla(1))); petroleo.agregarRelacion(0, 2, new relacion("y-2", new regla(3))); petroleo.agregarRelacion(1, 2, new relacion("y+4", new regla(5))); petroleo.agregarRelacion(2, 0, new relacion("((x/100)+1)*y", new regla(30))); petroleo.agregarRelacion(2, 2, new relacion("y*(-1)", new regla(0, "<", 5))); petroleo.agregarRelacion(2, 3, new relacion("((x/100)+1)*y", new regla(30))); Elemento ahorro = new Elemento("Ahorro familiar", 0); Nivel familiaColectivero = new Nivel("Familia colectivero"); familiaColectivero.agregarElemento(gananciaDiariaColectivero); familiaColectivero.agregarElemento(gastoDiario); familiaColectivero.agregarElemento(ahorro); familiaColectivero.agregarElemento(deuda); familiaColectivero.agregarRelacion(0, 2, new relacion("y+x", new regla(1))); familiaColectivero.agregarRelacion(1, 3, new relacion("y+x", new regla(1))); //Si el ahorro es mayor a 120000 pesos, la familia comienza a gastar más dinero familiaColectivero.agregarRelacion(2, 3, new relacion("(x/20)+y", new regla(120000, ">"))); familiaColectivero.agregarRelacion(3, 2, new relacion("y-x", new regla(30))); familiaColectivero.agregarRelacion(3, 3, new relacion("0", new regla(30))); sistema.agregarNivel(primerNivel); sistema.agregarNivel(nivelColectivo); sistema.agregarNivel(nivelMicrobus); sistema.agregarNivel(nivelUsuario); sistema.agregarNivel(petroleo); sistema.agregarNivel(familiaColectivero); }
public static void crecer(Elemento elem) { ElementosJuego aux = buscarElemJuego(elem); aux.crecer = 1; }
private void TotalSave_Click(object sender, EventArgs e) { try { caja = new RectangleF(float.Parse(posX.Text), float.Parse(posY.Text), float.Parse(width.Text), float.Parse(height.Text)); pictureBox1.Refresh(); } catch (Exception _e) { MessageBox.Show("Solo se aceptan numeros como valores, " + _e.Message); } if (Estatico.Checked) { Elemento temp = new Elemento(0.0f, 0.0f, float.Parse(_W.Value.ToString()), float.Parse(_H.Value.ToString()), 1, (int)prof.Value, solido); temp.AddImg(SelectImage.Text); temp.type = "Estatico"; temp.name = name.Text; temp.DefinePortion(caja.X, caja.Y, caja.Width, caja.Height); //int n = 0; foreach (string s in checkedListBox1.CheckedItems) { temp.AddTexto(s); } A_E(temp); } if (Animado.Checked) { Elemento_Ani temp = new Elemento_Ani(0.0f, 0.0f, float.Parse(_W.Value.ToString()), float.Parse(_H.Value.ToString()), 1, (int)prof.Value, solido); temp.AddImg(imagen.Text); button1.PerformClick(); temp.AddAnimation(_Anima[0], F_H); temp.type = "Animado"; temp.name = name.Text; foreach (string s in checkedListBox1.CheckedItems) { temp.AddTexto(s); } A_E(temp); } if (_Personajes.Checked) { Personaje temp = new Personaje(0, 0, float.Parse(_W.Value.ToString()), float.Parse(_H.Value.ToString()), 1,(int)prof.Value); temp.AddImg(imagen.Text); temp.type = "Personaje"; temp.name = name.Text; //Caja de coliciones temp.rec[2].X = caja.X/temp.rec[0].Width; temp.rec[2].Y = caja.Y / temp.rec[0].Height; temp.rec[2].Width = caja.Width / temp.rec[0].Width; temp.rec[2].Height = caja.Height / temp.rec[0].Height; //Estatus de personaje try { temp.health = int.Parse(health.Text); temp.speed = int.Parse(speed.Text); temp.force = int.Parse(force.Text); temp.stamina = int.Parse(stamina.Text); } catch(Exception _e) { MessageBox.Show("Asegurese de introduir un satatus valido"+_e.Message); } foreach (Animacion a in _Anima) { temp.AddAnimation(a, F_H); } foreach (string s in checkedListBox1.CheckedItems) { temp.AddTexto(s); } if (player.Checked) { Jugador j = (Jugador)temp; j.clase = "Jugador"; A_E(j); } else if (Enemy.Checked) { Enemigo En = (Enemigo)temp; En.clase = "Enemigo"; A_E(En); } else if (_NPC.Checked) { NPC np = (NPC)temp; np.clase = "NPC"; A_E(np); } } }
public static bool estaBerserker(Elemento elem) { if (buscarElemJuego(elem).modo == 1) return true; return false; }
private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { PointF p = new PointF(e.X - temMap.Escenario.X, e.Y - temMap.Escenario.Y); int n=0; if (e.Button == MouseButtons.Middle) { foreach (Elemento a in Matriz) { if (pm.Colicion(a.rec[0], p)) { foreach (Elemento b in temMap.Ele) { if (a._x == b._x && a._y == b._y && b.profundidad == a.profundidad-1) { Herramienta.Add(b); break; } } break; //MessageBox.Show("x="+a._x+" ,y="+a._y+" ,w="+a._w+" ,h="+a._h); } n++; } pictureBox2.Refresh(); } else if (e.Button == MouseButtons.Right) { Elemento t=new Elemento(0,0); foreach (Elemento a in Matriz) { if (pm.Colicion(a.rec[0], p)) { foreach (Elemento b in temMap.Ele) { if (b._x == a._x && b._y == a._y && b.profundidad == a.profundidad-1) { t = b; int q=Matriz.IndexOf(a); Matriz[q].profundidad--; break; } } break; } } temMap.Ele.Remove(t); R_M.Render_List.Clear(); foreach (Elemento a in Matriz) a.Draw(new RenderHandler(R_M.AddData)); temMap.Draw(new RenderHandler(R_M.AddData)); R_M.Sorting(); pictureBox1.Refresh(); /*temMap.Ele.Remove(t); R_M.Render_List.Clear(); temMap.Draw(new RenderHandler(R_M.AddData)); pictureBox1.Refresh();*/ } else if (e.Button == MouseButtons.Left) { foreach (Elemento a in Matriz) { if (pm.Colicion(a.rec[0], p)) { if (selected != null) { Elemento t = selected; t._x = a._x; t._y = a._y; t.profundidad = a.profundidad; t.AddPosition(t._x * trackBar1.Value, t._y * trackBar1.Value); int q = Matriz.IndexOf(a); Matriz[q].profundidad++; t.rec[0].Width = t._w * trackBar1.Value; t.rec[0].Height = t._h * trackBar1.Value; temMap.Ele.Add(t); temMap.Ele.Last().Draw(new RenderHandler(R_M.AddData)); //R_M.Update(); //R_M.Render_List.Clear(); //temMap.Draw(new RenderHandler(R_M.AddData)); //temMap.Ele[n].Draw(new RenderHandler(R_M.AddData)); //R_M.Update(); R_M.Sorting(); pictureBox1.Refresh(); break; } } n++; } } }
public static void modoB(Elemento elem) { ElementosJuego aux = buscarElemJuego(elem); aux.modo = 1; }
public static void Main(string[] args) { /*uno=new Elemento("uno", 1); dos=new Elemento("dos", 2); Elemento tres = new Elemento("tres", 3); Elemento cuatro = new Elemento("cuatro", 4); miNivel=new Nivel("Nivel Uno"); miNivel.agregarElemento(uno); miNivel.agregarElemento(dos); miNivel.agregarRelacion(0,1,new relacion("4*x",new regla(1))); miNivel.agregarRelacion(1,0, new relacion("y-x", new regla(1))); miNivel.agregarElemento(tres); miNivel.agregarRelacion(2, 0, new relacion("x/2", new regla(2))); Nivel nivelDos = new Nivel("Nivel dos"); nivelDos.agregarElemento(tres); nivelDos.agregarElemento(cuatro); nivelDos.agregarRelacion(1, 0, new relacion("x^2-2", new regla(2))); nivelDos.agregarRelacion(0, 1, new relacion("x+1", new regla(4))); nivelDos.agregarRelacion(0, 0, new relacion("3", new regla(50000, ">"))); Sistema elSistema = new Sistema(); elSistema.agregarNivel(miNivel); elSistema.agregarNivel(nivelDos); //*/ //Console.WriteLine(new calculos().leerFuncion("(x^2/6000)+300", 1)); //Console.ReadKey(); Sistema unSistema = new Sistema(); Nivel primerNivel = new Nivel("Primer nivel"); primerNivel.agregarElemento(new Elemento("Colectivo", 0)); primerNivel.agregarElemento(new Elemento("Microbus", 0)); primerNivel.agregarElemento(new Elemento("Usuario", 0)); primerNivel.agregarElemento(new Elemento("Combustible", 0)); Nivel nivelColectivo = new Nivel("Colectivo"); Elemento demandaColectivo = new Elemento("Demanda de clientes colectivo", 0); nivelColectivo.agregarElemento(primerNivel.listaElementos[0]); nivelColectivo.agregarElemento(new Elemento("Precio pasaje colectivo", 200)); nivelColectivo.agregarElemento(new Elemento("Precio Bencina", 150)); nivelColectivo.agregarElemento(demandaColectivo); nivelColectivo.agregarElemento(new Elemento("Ganancia", 2000)); nivelColectivo.agregarElemento(new Elemento("Distancia recorrida", 1000)); nivelColectivo.agregarElemento(new Elemento("Bencina ocupada", 10)); //Relaciones //nivelColectivo.agregarRelacion(1, 3, new relacion("x*(6/13)", new regla(1))); nivelColectivo.agregarRelacion(1, 4, new relacion("x", new regla(1))); nivelColectivo.agregarRelacion(2, 1, new relacion("x*(6/7)", new regla(1))); nivelColectivo.agregarRelacion(2, 2, new relacion("y+5", new regla(10))); nivelColectivo.agregarRelacion(2, 3, new relacion("x*(1/10)", new regla(1))); nivelColectivo.agregarRelacion(2, 6, new relacion("x", new regla(1))); nivelColectivo.agregarRelacion(3, 4, new relacion("y*x", new regla(1))); nivelColectivo.agregarRelacion(3, 5, new relacion("x*10", new regla(1))); nivelColectivo.agregarRelacion(5, 6, new relacion("y*(x/12)", new regla(1))); nivelColectivo.agregarRelacion(6, 4, new relacion("y-x", new regla(1))); Nivel nivelMicrobus = new Nivel("Microbus"); Elemento demandaMicrobus = new Elemento("Demanda de clientes microbus", 0); nivelMicrobus.agregarElemento(primerNivel.listaElementos[1]); nivelMicrobus.agregarElemento(new Elemento("Precio pasaje", 150)); nivelMicrobus.agregarElemento(new Elemento("Precio petróleo", 140)); nivelMicrobus.agregarElemento(demandaMicrobus); nivelMicrobus.agregarElemento(new Elemento("Ganancia", 0)); nivelMicrobus.agregarElemento(new Elemento("Distancia recorrida", 1000)); nivelMicrobus.agregarElemento(new Elemento("Petroleo ocupado", 200)); //Relaciones: //nivelMicrobus.agregarRelacion(1, 3, new relacion("x", new regla(1))); nivelMicrobus.agregarRelacion(1, 4, new relacion("x", new regla(1))); nivelMicrobus.agregarRelacion(2, 1, new relacion("x*(4/7)", new regla(1))); nivelMicrobus.agregarRelacion(2, 2, new relacion("y+(48/10)", new regla(10))); nivelMicrobus.agregarRelacion(2, 3, new relacion("x*(1/10)", new regla(1))); nivelMicrobus.agregarRelacion(2, 6, new relacion("x", new regla(1))); nivelMicrobus.agregarRelacion(3, 4, new relacion("y*x", new regla(1))); nivelMicrobus.agregarRelacion(3, 5, new relacion("100", new regla(1))); nivelMicrobus.agregarRelacion(5, 6, new relacion("y*(x/12)", new regla(1))); nivelMicrobus.agregarRelacion(6, 4, new relacion("y-x", new regla(1))); Nivel nivelUsuario = new Nivel("Demanda usuarios"); nivelUsuario.agregarElemento(primerNivel.listaElementos[2]); nivelUsuario.agregarElemento(demandaColectivo); nivelUsuario.agregarElemento(demandaMicrobus); //nivelUsuario.agregarRelacion(1, 2, new relacion("y-x/100", new regla(1))); unSistema.agregarNivel(primerNivel); unSistema.agregarNivel(nivelColectivo); unSistema.agregarNivel(nivelMicrobus); unSistema.agregarNivel(nivelUsuario); while (true) { Console.Clear(); unSistema.iterar(); unSistema.imprimirSistema(); Console.WriteLine(unSistema.obtenerEstado() + "\n"); System.Threading.Thread.Sleep(1000); } /* for(int j=0; j<elSistema.valores.Count;j++){ for(int k=0; k< elSistema.valores[j].Count;k++){ Console.Write(elSistema.valores[j][k]+ " "); } Console.WriteLine(); }*/ }
public void Dispose() { _solicitudCambio = null; _tipoIncidente = null; _elemento = null; _impacto = null; _plataforma = null; _prioridad = null; _solicitudCambio = null; _categoria = null; _subCategoria = null; _usuarioDeriva = null; _usuarioAsigna = null; _asesor = null; _area = null; _sede = null; _usuarioContacto = null; _atenciones = null; }