public void CambiarDatos(__informacionEnemigos infoColocar)
 {
     NombreSoldado.text      = infoColocar.Nombre;
     LevelSoldado.text       = "Level : " + infoColocar.Level;
     VidaSoldado.text        = "Vida : " + infoColocar.Vida;
     DañoSoldado.text        = "Daño : " + infoColocar.Daño;
     EnergiaSoldado.text     = "Energia : " + infoColocar.Energia;
     ExperienciaSoldado.text = "";
     PoderesSoldado.text     = "Poderes : " + infoColocar.Poderes + "/3";
     HeroeSoldado.text       = string.Empty;
 }
Beispiel #2
0
    //------------------------------------

    /// <summary>
    /// Colocacion de la informacion de los enemigos y los porcentajes a las diversas dificultades de misiones.
    /// </summary>
    public void CargarDatos()
    {
        if (_NombresDisponiblesSoldados.Count == 0 && RazasDisponibles.Count == 0 && PasivasExistentes.Count == 0 &&
            DificultadesDisponibles.Count == 0 && EnemigosExistentes.Count == 0)
        {
            DatosCargados = false;
        }

        if (!DatosCargados)
        {
            //Agregar Nombres posibles de Soldados desde su respectivo archivo excel
            LeerArchivoExcel(out _NombresDisponiblesSoldados, "NombreSoldados.xlsx");

            //Agregar Razas disponibles de Soldados desde su respectivo archivo excel
            List <string> InfoRazas = new List <string>();
            LeerArchivoExcel(out InfoRazas, "RazasSoldados.xlsx");
            int    camposRecorridos = 0;
            string nombreRaza       = "";
            for (int contador = 0; contador < InfoRazas.Count; contador++)
            {
                if (camposRecorridos == 0)
                {
                    nombreRaza = InfoRazas[contador];
                    camposRecorridos++;
                }
                else if (camposRecorridos == 1)
                {
                    Sprite   Icono  = null;
                    Sprite[] Iconos = (Resources.LoadAll <Sprite>(@"Iconos\Soldados\Atlas_razas_soldados"));
                    foreach (Sprite CIcono in Iconos)
                    {
                        if (CIcono.name == InfoRazas[contador])
                        {
                            Icono = CIcono;
                            break;
                        }
                    }
                    if (Icono != null)
                    {
                        RazasDisponibles.Add(nombreRaza, Icono);
                    }
                    else
                    {
                        Debug.LogError("Icono No Encontrado. Raza: " + nombreRaza + ". Verifica la escritura y ubicacion del mismo");
                    }

                    camposRecorridos = 0;
                }
            }
            //Agregar Pasivas disponibles desde su respectivo archivo excel
            List <string> InfoPasivas = new List <string>();
            LeerArchivoExcel(out InfoPasivas, "PasivasSoldados.xlsx");

            string NombrePasiva = "";
            int    Vida         = 0;
            int    Energia      = 0;
            int    Dano         = 0;
            int    numeroCelda  = 0;
            for (int contador = 0; contador < InfoPasivas.Count; contador++)
            {
                switch (numeroCelda)
                {
                case 0:
                    NombrePasiva = InfoPasivas[contador];
                    numeroCelda++;
                    break;

                case 1:
                    Vida = Convert.ToInt32(InfoPasivas[contador]);
                    numeroCelda++;
                    break;

                case 2:
                    Energia = Convert.ToInt32(InfoPasivas[contador]);
                    numeroCelda++;
                    break;

                case 3:
                    Dano = Convert.ToInt32(InfoPasivas[contador]);
                    __informacionPasivas InfoPasiva = new __informacionPasivas(NombrePasiva, Vida, Energia, Dano);
                    PasivasExistentes.Add(NombrePasiva, InfoPasiva);
                    numeroCelda = 0;
                    break;
                }
            }

            //Agregar Porcentajes para dificultades disponibles desde su respectivo archivo excel
            List <string> infoPorcentajes = new List <string>();
            LeerArchivoExcel(out infoPorcentajes, "PorcentajesDificultadesMisiones.xlsx");
            int    NumeroCeldaPorcentajes = 0;
            string nombreDificultad       = "";
            float  porcentajeDificultad   = 0.0f;
            for (int contador = 0; contador < infoPorcentajes.Count; contador++)
            {
                switch (NumeroCeldaPorcentajes)
                {
                case 0:
                    nombreDificultad = infoPorcentajes[contador];
                    NumeroCeldaPorcentajes++;
                    break;

                case 1:
                    porcentajeDificultad = Convert.ToSingle(infoPorcentajes[contador].Replace(".", ","));
                    EDificultadMisiones DificultadLista;
                    Enum.TryParse(nombreDificultad, out DificultadLista);
                    DificultadesDisponibles.Add(DificultadLista, porcentajeDificultad);
                    NumeroCeldaPorcentajes = 0;
                    break;
                }
            }

            ////Agregar Informacion de enemigos disponbiles desde su respectivo archivo excel
            List <string> infoEnemigos = new List <string>();
            LeerArchivoExcel(out infoEnemigos, "EnemigosInformacion.xlsx");
            int NumeroCeldaEnemigos = 0;
            __informacionEnemigos InfoCadaEnemigo = new __informacionEnemigos();
            for (int contador = 0; contador < infoEnemigos.Count; contador++)
            {
                switch (NumeroCeldaEnemigos)
                {
                case 0:
                    InfoCadaEnemigo.Nombre = infoEnemigos[contador];
                    NumeroCeldaEnemigos++;
                    break;

                case 1:
                    InfoCadaEnemigo.Level = Convert.ToInt32(infoEnemigos[contador]);
                    NumeroCeldaEnemigos++;
                    break;

                case 2:
                    InfoCadaEnemigo.Daño = Convert.ToInt32(infoEnemigos[contador]);
                    NumeroCeldaEnemigos++;
                    break;

                case 3:
                    InfoCadaEnemigo.Vida = Convert.ToInt32(infoEnemigos[contador]);
                    NumeroCeldaEnemigos++;
                    break;

                case 4:
                    InfoCadaEnemigo.Energia = Convert.ToInt32(infoEnemigos[contador]);
                    NumeroCeldaEnemigos++;
                    break;

                case 5:
                    InfoCadaEnemigo.Poderes = Convert.ToInt32(infoEnemigos[contador]);
                    NumeroCeldaEnemigos++;
                    break;

                case 6:
                    Sprite[] IconosEnemigos = Resources.LoadAll <Sprite>(@"Iconos\Enemigos\enemigos_atlas_1");
                    foreach (Sprite CIcono in IconosEnemigos)
                    {
                        if (CIcono.name == infoEnemigos[contador])
                        {
                            InfoCadaEnemigo.Icono = CIcono;
                        }
                    }
                    EnemigosExistentes.Add(InfoCadaEnemigo.Nombre, InfoCadaEnemigo);
                    InfoCadaEnemigo     = new __informacionEnemigos();
                    NumeroCeldaEnemigos = 0;
                    break;
                }
            }
            DatosCargados = true;
        }
    }