Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.heroeina = new Heroe(this.txtNombre.Text, this.comboBox1.SelectedItem.ToString(), (int)this.numNivelFuerza.Value);
            //Tomo de los componenetes: nombre del text box. - Poder del item seleccionado del comboBox en formato string - NFuerza, del valor numérico del numericUpDown...

            heroeina.SetEsAyudante(this.checkEsAyudante.Checked);
            //Para es ayudante tomo el booleano de si está o no chekeado el casilllero del CheckBox.

            MessageBox.Show(heroeina.HeroeToString());
            //Para mostrarlo en una ventana aparte tomo el Método creado en la clase Heroe que StringBuildea los atributos cargados.
        }
Exemplo n.º 2
0
        public ActionResult ListMovies(int heroeId, int list = 1)
        {
            Heroe heroe    = db.Heroes.Find(heroeId);
            int   listSize = 3;
            IEnumerable <Movie> moviesOnList = heroe.Movies
                                               .OrderBy(x => x.Id)
                                               .Skip((list - 1) * listSize)
                                               .Take(listSize).ToList();

            return(PartialView(moviesOnList));
        }
        public void Test()
        {
            OneForAll ofa = new OneForAll(AllMight);

            ofa.cambiarPortador(ArturoMirodilla);
            Assert.AreEqual(2, ArturoMirodilla.Quirks.Count());

            Heroe portadorAleatorio = new Heroe(PiroQuinesis);

            ofa.cambiarPortador(portadorAleatorio);
            Assert.AreEqual(1, ArturoMirodilla.Quirks.Count());
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Universo adultez = new Universo(1);
            Heroe    h1      = new Heroe("Alejo", "Viene a hacer un trámite", 50);

            Universo.AgregarHero_(adultez, h1);

            Console.WriteLine(adultez.GetHeroeina()[0]);

            string nombre = h1.Nombre;//PARA USAR LA PROPIEDAD

            Console.WriteLine("\n {0}", nombre);
        }
Exemplo n.º 5
0
        public async Task <ActionResult <Heroe> > AddNew(Heroe newHeroe)
        {
            try
            {
                var result = await _heroesService.AddNewHeroe(newHeroe);

                return(Ok(result));
            }
            catch (InvalidOperationException ex)
            {
                return(NotFound(ex.Message));
            }
        }
Exemplo n.º 6
0
        public async Task <string> PostHeroe(Heroe Model)
        {
            List <SqlParameter> Parameters = new List <SqlParameter>();

            Parameters.Add(new SqlParameter("@Accion", 3));
            Parameters.Add(new SqlParameter("@Nombre", Model.Nombre));
            Parameters.Add(new SqlParameter("@Poder", Model.Poder));
            Parameters.Add(new SqlParameter("@Vivo", Model.Vivo));

            string Response = await _Contexto.ExecureNonQuery("spHeroes", Parameters);

            return(Response);
        }
Exemplo n.º 7
0
        public async Task <ActionResult <Heroe> > UpdateHeroe(int id, Heroe currentHeroe)
        {
            try
            {
                var heroeWithUpdates = await _heroesService.UpdateHeroe(id, currentHeroe);

                return(Ok(heroeWithUpdates));
            }
            catch (InvalidOperationException ex)
            {
                return(NotFound(ex.Message));
            }
        }
Exemplo n.º 8
0
        public async Task <ActionResult <Heroe> > GetHeroeById(int id)
        {
            Heroe Model = await _Negocio.GetHeroeById(id);

            if (Model == null)
            {
                return(BadRequest());
            }
            else
            {
                return(Model);
            }
        }
Exemplo n.º 9
0
        public async Task <ActionResult <string> > PutHeroe([FromBody] Heroe Model)
        {
            string Response = await _Negocio.PutHeroe(Model);

            if (Response.Equals("ok"))
            {
                return(Ok("Registro Completado"));
            }
            else
            {
                return(BadRequest());
            }
        }
Exemplo n.º 10
0
 private HeroeModel Map(Heroe dto)
 {
     return(new HeroeModel
     {
         ID = dto.ID,
         Name = dto.Name,
         GuideID = dto.GuideID,
         SuiteColors = dto.SuiteColors,
         CurrentPower = dto.CurrentPower,
         StartingPower = dto.StartingPower,
         Abilty = dto.Abilty,
         StartDate = dto.StartDate
     });
 }
        public void Setup()
        {
            OFA = new Quirk(180, false, "One For All");
            AllMight = new Heroe(OFA);
            HellFlame = new Quirk(300, false, "HellFlame");
            Endeavor = new Heroe(HellFlame);

            Elasticity = new Quirk(60, false, "Elasticity");
            GentleCriminal = new Villano(true, false, false, Elasticity);
            Love = new Quirk(60, false, "Love");
            laBrava = new Villano(false, true, false, Love);
            youtubers = new List<Villano>{laBrava, GentleCriminal};
            youtuberos = new Pandilla(youtubers);
        }
        public void Setup()
        {
            hellFlame     = new Quirk("Hell Flame", 300, "");
            quirkVillano1 = new Quirk("Malisimo 1", 120, "Demencia");
            quirkVillano2 = new Quirk("Malisimo 2", 40, "");

            endevaror  = new Heroe(200, 50, hellFlame);
            muyMalote  = new Villano(quirkVillano1, true, false, true);//quirk,roboenonce,trabajo,pizzaconpiña
            muyMalote2 = new Villano(quirkVillano2, true, true, false);

            villanos = new List <Villano> {
                muyMalote, muyMalote2
            };
        }
Exemplo n.º 13
0
    void Start()
    {
        int azarLimit = //variables para determinar cantidad de zombos y ciudadanos
                        Random.Range(4, 9), cantCiudadanos = Random.Range(1, azarLimit);

        //INSTANCIAS DE HEREO, ZOMBOS Y CIUDADANOS
        h = new Heroe(objectref);
        z = new Zombo(objectref, azarLimit - cantCiudadanos);
        c = new Ciudadano[cantCiudadanos];//dimensionamiento de matriz de ciudadanos
        for (int i = 0; i < c.Length; i++)
        {
            c[i] = new Ciudadano(objectref, nombres()[Random.Range(0, 20)], Random.Range(0, 100));
        }
    }
Exemplo n.º 14
0
 public async Task <IActionResult> Post(Heroe model)
 {
     try
     {
         _repo.Add(model);
         if (await _repo.SaveChangeAsync())
         {
             return(Ok("Bazinga!"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest($"Erro: {e.Message}"));
     }
     return(BadRequest("Não salvou!"));
 }
Exemplo n.º 15
0
        public ActionResult Heroe(Heroe heroModel)
        {
            using (DbModels dbModel = new DbModels())
            {
                if (dbModel.Heroe.Any(x => x.nombre_heroe == heroModel.nombre_heroe))
                {
                    ViewBag.DuplicateMessage = "Ya existe un Héroe con este nombre.";
                    return(View("Heroe", heroModel));
                }

                dbModel.Heroe.Add(heroModel);
                dbModel.SaveChanges();
            }
            ModelState.Clear();
            ViewBag.SuccessMessage = "Registro exitoso.";
            return(View("Heroe", new Heroe()));
        }
Exemplo n.º 16
0
        public ActionResult Heroe(long id, int list = 1)
        {
            Heroe heroe    = db.Heroes.Find(id);
            int   listSize = 3;
            IEnumerable <Movie> moviesOnList = heroe.Movies
                                               .OrderBy(x => x.Id)
                                               .Skip((list - 1) * listSize)
                                               .Take(listSize).ToList();
            ListInfo listInfo = new ListInfo {
                ListNumber = list, ListSize = listSize, TotalItems = heroe.Movies.Count()
            };
            ViewHeroe vh = new ViewHeroe {
                ListInfo = listInfo, Heroe = heroe, Movies = moviesOnList
            };

            return(View(vh));
        }
Exemplo n.º 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            var Heroe1 = new Heroe();

            Heroe1.Nombre = "Superman";
            Heroe1.Poder  = "Volar";

            var Heroe2 = new Heroe();

            Heroe2.Nombre = "Flash";
            Heroe2.Poder  = "Super Velocidad";

            var Heroe3 = new Heroe();

            Heroe3.Nombre = "Hulk";
            Heroe3.Poder  = "Super Fuerza";
        }
Exemplo n.º 18
0
        static void Main(string[] args) //Clave valor
        {
            #region Ej. 1
            //Dictionary<int, string> usuarios = new Dictionary<int, string>();

            //usuarios.Add(12, "Rafael");
            //usuarios.Add(25, "Roberta");
            //usuarios.Add(32, "Rolando");
            //usuarios.Add(63, "Ricardo");

            //foreach (KeyValuePair<int,string> item in usuarios) //no usar le f*****g var --> KeyValuePair <,> aux
            //{
            //    Console.WriteLine($"Clave : {item.Key} / Valor: {item.Value}");

            //}

            //string valor;

            //if (usuarios.TryGetValue(12, out valor)) //Intenta encontrar esa key y se lo va a asignar a la variable valor.
            //{//Dice q es la única manera de averiguar si la key existe.
            //    Console.WriteLine(valor); //Si no lo encuentra devuelve false
            //}
            //else
            //{
            //    Console.WriteLine("NOP, NO EXISTE");
            //}
            #endregion

            #region Ej.2

            Dictionary <int, Heroe> diccionarioHeroes = new Dictionary <int, Heroe>();

            Heroe h1 = new Heroe("pepe", "regala serotonina", 1000);

            diccionarioHeroes.Add(1, h1);
            diccionarioHeroes.Add(2, new Heroe("Fabritzia", "llega a las 08:00hs", 505));

            foreach (KeyValuePair <int, Heroe> info in diccionarioHeroes)
            {
                if (info.Value.GetNombre() == "Fabritzia")
                {
                    Console.WriteLine("La he encontrado tio. (llegó a las 08)");
                }
            }
            #endregion
        }
Exemplo n.º 19
0
    /// <summary>
    /// Cargador Y un pool de objectos
    /// </summary>
    void Start()
    {
        posArma = FindObjectOfType <Heroe>();
        balas   = new GameObject[100];

        for (int i = 0; i < balas.Length; i++)
        {
            bala = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            bala.AddComponent <Rigidbody>();
            bala.GetComponent <Rigidbody>().useGravity = false;
            bala.GetComponent <Collider>().isTrigger   = true;
            bala.transform.position   = new Vector3(1000, 1000, 1000);
            bala.transform.localScale = new Vector3(.3f, .3f, .3f);
            bala.tag = "Bala";
            bala.SetActive(false);
            balas[i] = bala;
        }
    }
        public void Setup()
        {
            OFA             = new Quirk(180, false, "One for All");
            AllMight        = new Heroe(OFA);
            HellFlame       = new Quirk(300, false, "HellFlame");
            Endeavor        = new Heroe(HellFlame);
            PiroQuinesis    = new Quirk(300, false, "PiroQuinesis");
            ArturoMirodilla = new Heroe(OFA);

            Elasticity     = new Quirk(60, false, "Elasticity");
            Gentlecriminal = new Villano(true, false, false, Elasticity);
            Love           = new Quirk(60, false, "Love");
            laBraba        = new Villano(false, true, false, Love);
            terrorists     = new List <Villano> {
                laBraba, Gentlecriminal
            };
            terroristas = new Pandilla(terrorists);
        }
        // Heroe Njeuvo POST
        public ActionResult Nuevo(Heroe HeroeNuevo)
        {
            //si manda una imagen que haga lo siguiente
            if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any())
            {
                var    imagen   = System.Web.HttpContext.Current.Request.Files["Imagen"];
                string logopath = Server.MapPath("~/Content/Images/");
                string filename = imagen.FileName;

                imagen.SaveAs(logopath + filename);
                HeroeNuevo.Imagen = "~/Content/Images/" + filename;
                BD.Heroe.Add(HeroeNuevo);
                BD.SaveChanges();
            }



            return(RedirectToAction("Index"));
        }
Exemplo n.º 22
0
 private void cmbPersonajeDeLista_SelectedIndexChanged(object sender, EventArgs e)
 {
     if ((Personaje)cmbPersonajeDeLista.SelectedItem is Heroe)
     {
         btnTransformar.Enabled = true;
         hero = ((Heroe)(cmbPersonajeDeLista.SelectedItem));
         if (hero.Saiyajin)
         {
             btnAvatar.ImageIndex = 0;
             lblMensaje.Text      = $"Power: {hero.PowerLevel}\n{hero.Mensaje}";
         }
     }
     else
     {
         villain = ((Villano)(cmbPersonajeDeLista.SelectedItem));
         btnAvatar.ImageIndex = 7;
         lblMensaje.Text      = $"Power: {villain.PowerLevel}\n{villain.Mensaje}";
     }
 }
Exemplo n.º 23
0
        public async Task <Heroe> UpdateHeroe(int id, Heroe currentHeroe)
        {
            var currentHero = await _dbContext.Heroes.FirstOrDefaultAsync(heroe => heroe.ID == id);

            if (currentHero == null)
            {
                throw new InvalidOperationException("cannot update heroe with id " + id);
            }

            currentHero.Name          = currentHeroe.Name;
            currentHero.GuideID       = currentHeroe.GuideID;
            currentHero.SuiteColors   = currentHeroe.SuiteColors;
            currentHero.CurrentPower  = currentHeroe.CurrentPower;
            currentHero.StartingPower = currentHeroe.StartingPower;
            currentHero.Abilty        = currentHeroe.Abilty;
            currentHero.StartDate     = currentHeroe.StartDate;
            await _dbContext.SaveChangesAsync();

            return(Map(currentHero));
        }
Exemplo n.º 24
0
 public async Task <IActionResult> Delete(int id, Heroe model)
 {
     try
     {
         var heroe = _repo.GetHeroeById(id);
         if (heroe != null)
         {
             _repo.Delete(model);
         }
         if (await _repo.SaveChangeAsync())
         {
             return(Ok("BAZINGA!"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest($"Erro: {e.Message}"));
     }
     return(BadRequest("Não encontrado!"));
 }
Exemplo n.º 25
0
        public async Task <Heroe> GetHeroeById(int id)
        {
            List <SqlParameter> Parameters = new List <SqlParameter>();

            Parameters.Add(new SqlParameter("@Accion", 2));
            Parameters.Add(new SqlParameter("@IdHeroe", id));

            SqlDataReader Dr = await _Contexto.ExecuteReader("spHeroes", Parameters);

            Heroe Model = new Heroe();

            while (await Dr.ReadAsync())
            {
                Model.IdHeroe = (int)Dr["IdHeroe"];
                Model.Nombre  = Dr["Nombre"].ToString();
                Model.Poder   = Dr["Poder"].ToString();
                Model.Vivo    = (bool)Dr["Vivo"];
            }

            return(Model);
        }
Exemplo n.º 26
0
        private void button1_Click(object sender, EventArgs e)
        {
            var Heroe1 = new Heroe();

            Heroe1.Id          = 1;
            Heroe1.Nombre      = "Linterna Verde";
            Heroe1.TipoDePoder = "Imaginacion";
            Heroe1.Descripcion = "Utiliza un anillo que obtiene los poderes a fuerza de Voluntad";
            Heroe1.Debilidad   = "El Miedo";
            Heroe1.Interprete  = "Ryan Rednos";

            var Heroe2 = new Heroe();

            Heroe2.Id          = 2;
            Heroe2.Nombre      = "SpiderMan";
            Heroe2.TipoDePoder = "Super fueza y sentidos aracnidos";
            Heroe2.Descripcion = "Utiliza super fuerza y sus sentidos aracnidos para luchar contra el crimen";
            Heroe2.Debilidad   = "La Tia May";
            Heroe2.Interprete  = "Tom Hollands";

            var Heroe3 = new Heroe();

            Heroe3.Id          = 3;
            Heroe3.Nombre      = "Siuperman";
            Heroe3.TipoDePoder = "Varios";
            Heroe3.Descripcion = "Puede volar, tiene vision laser, fuerza bruta, alientp de hielo";
            Heroe3.Debilidad   = "Criptonita";
            Heroe3.Interprete  = "Henry Cavill";

            var ListadeHeroes = new List <Heroe>();

            ListadeHeroes.Add(Heroe1);
            ListadeHeroes.Add(Heroe2);
            ListadeHeroes.Add(Heroe3);

            foreach (var H in ListadeHeroes)
            {
                MessageBox.Show(H.Id + " " + H.Nombre + " " + H.TipoDePoder + " " + H.Descripcion + " " + H.Debilidad + " " + H.Interprete);
            }
        }
Exemplo n.º 27
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var heroe1 = new Heroe();

            heroe1.Id      = 01;
            heroe1.Nombre  = "Goku";
            heroe1.Poderes = "Kamehameha";


            var heroe2 = new Heroe();

            heroe2.Id      = 01;
            heroe2.Nombre  = "Gohan";
            heroe2.Poderes = "Masenko";


            var heroe3 = new Heroe();

            heroe3.Id      = 01;
            heroe3.Nombre  = "Vegeta";
            heroe3.Poderes = "Resplandor Final";

            var villano1 = new Villano();

            villano1.Id      = 02;
            villano1.Nombre  = "Freezer";
            villano1.Poderes = "Destruir Planetas";

            var villano2 = new Villano();

            villano2.Id      = 02;
            villano2.Nombre  = "Cell";
            villano2.Poderes = "Absorber";

            var villano3 = new Villano();

            villano3.Id      = 03;
            villano3.Nombre  = "Magneto";
            villano3.Poderes = "Control de metales";
        }
Exemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
//		FirstHeroe= Instantiate(Heroe);
        sp = GetComponent <SpriteRenderer>();


        #region ARRAY VILLANOS
        for (int i = 0; i < Malos.Length; i++)
        {
            Malos[i] = Instantiate(Villano);


            Malos[i].transform.position = PosicionM[i];

            Llegada[i] = false;


            //Xpositivo[i]=GetComponent<Spr>();

            //Xpositivo[i].flipX=false;
        }

        #endregion

        //llama a otro script
        scriptA = GameObject.Find("Heroe").GetComponent <Heroe>();

        ScriptVilanos = GameObject.Find("Villano").GetComponent <Villanos>();

        #region ARRAY ALMAS
        for (int a = 0; a < Almas1.Length; a++)
        {
            Almas1[a] = Instantiate(Almas);


            Almas1[a].transform.position = PosicionA[a];
        }

        #endregion
    }
Exemplo n.º 29
0
        public async Task <List <Heroe> > GetAllHeroes()
        {
            List <Heroe>        LstHeroe   = new List <Heroe>();
            List <SqlParameter> Parameters = new List <SqlParameter>();

            Parameters.Add(new SqlParameter("@Accion", 1));

            SqlDataReader Dr = await _Contexto.ExecuteReader("spHeroes", Parameters);

            while (await Dr.ReadAsync())
            {
                Heroe Model = new Heroe();
                Model.IdHeroe = (int)Dr["IdHeroe"];
                Model.Nombre  = Dr["Nombre"].ToString();
                Model.Poder   = Dr["Poder"].ToString();
                Model.Vivo    = (bool)Dr["Vivo"];

                LstHeroe.Add(Model);
            }

            return(LstHeroe);
        }
Exemplo n.º 30
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var heroe1 = new Heroe();

            heroe1.Id      = 01;
            heroe1.Nombre  = "Superman";
            heroe1.Poderes = "Super fuerza";

            var heroe2 = new Heroe();

            heroe2.Id      = 01;
            heroe2.Nombre  = "Batman";
            heroe2.Poderes = "Sin poder";

            var heroe3 = new Heroe();

            heroe3.Id      = 01;
            heroe3.Nombre  = " Flash ";
            heroe3.Poderes = "Velocidad";

            var villano1 = new Villano();

            villano1.Id      = 02;
            villano1.Nombre  = " Ultron ";
            villano1.Poderes = " Control mental ";

            var villano2 = new Villano();

            villano2.Id      = 02;
            villano2.Nombre  = "Darkseid";
            villano2.Poderes = " Inteligencia sobrenatural ";

            var villano3 = new Villano();

            villano3.Id      = 02;
            villano3.Nombre  = " Dormammu";
            villano3.Poderes = " Inmortal y teletransportacion";
        }
Exemplo n.º 31
0
    /**
     *  This function gets the heroe from its identifier
     *
     *  int heroe_id: heroe identifier
     *
     *  return: Heroe
     *
     **/
    public Heroe getHeroe(int heroe_id)
    {
        IDbConnection dbConnection;
        IDbCommand dbCommand;
        IDataReader reader;

        int user_id = GlobalVariables.user_id;

        connectionString = "URI=file:"+Application.dataPath + "/"+GlobalVariables.user_database;
        dbConnection = new SqliteConnection (connectionString);
        dbConnection.Open ();

        Heroe heroe = new Heroe();

        // Select
        string sql = "SELECT * FROM heroe AS h ";
        sql += "WHERE h.id ="+heroe_id;

        //Debug.Log (sql);
        dbCommand = dbConnection.CreateCommand ();
        dbCommand.CommandText = sql;

        reader = dbCommand.ExecuteReader ();
        while(reader.Read()) {
            int _id = Int32.Parse(reader.GetString(0));
            string _name = reader.GetString(1);
            string _surname = reader.GetString(2);
            string _nickname = reader.GetString(3);
            string _photo = reader.GetString(4);
            string _thumbnail = reader.GetString(5);
            int _isNational = Int32.Parse(reader.GetString(6));
            int _isActive = Int32.Parse(reader.GetString(7));
            int _active = Int32.Parse(reader.GetString(8));

            heroe = new Heroe(_id,_name,_surname,_nickname,_photo,_thumbnail,_isNational,_isActive,_active);

            //Debug.Log ("activity_id:"+aniamtion.id);
        }

        if (dbCommand != null) {
            dbCommand.Dispose ();
        }
        dbCommand = null;
        if (reader != null) {
            reader.Dispose ();
        }
        reader = null;
        if (dbConnection != null) {
            dbConnection.Close ();
        }
        dbConnection = null;

        return heroe;
    }
Exemplo n.º 32
0
    /**
     *  This function gets heroes of a skill
     *
     *  int skill_id: skill identifier
     *
     *  return: list of Heroe
     *
     **/
    public List<Heroe> getHeroes(int skill_id)
    {
        IDbConnection dbConnection;
        IDbCommand dbCommand;
        IDataReader reader;

        int user_id = GlobalVariables.user_id;

        List<Animation_Heroe> animation_heroes = getAnimationHeroesFromSkill (skill_id);
        List<Heroe> heroes = new List<Heroe>();
        Heroe heroe = new Heroe();

        int itemCount = animation_heroes.Count;
        for (int i = 0; i < itemCount; i++)
        {
            int heroe_id = animation_heroes[i].heroe_id;
            heroe = getHeroe(heroe_id);
            heroes.Add(heroe);
        }

        return heroes;
    }