Esempio n. 1
0
 //Habilitar Cuerpo
 public void EnableBody()
 {
     HUDFolders.SetActive(false);
     Cube.SetActive(true);
     if (Gender == "F")
     {
         CuerpoMujer.SetActive(true);
     }
     else
     {
         CuerpoHombre.SetActive(true);
     }
 }
Esempio n. 2
0
    //EliminarHud
    public void ColocarEnHUD()
    {
        if (foldertype != null)
        {
            //leo cuantos personajes hay
            FilesCount = new string[0];
            if (foldertype == "Folders")
            {
                if (BodyOrFolder == true)
                {
                    //Es Folders
                    HUDFolders.SetActive(true);
                    DisableBody();
                    FilesCount   = Directory.GetDirectories(Application.persistentDataPath + "/images/" + Name);
                    BodyOrFolder = false;
                    //Cambiamos imagen a cuerpo
                    folderImage1.sprite = imageFolder;
                }
                else
                {
                    HUDFolders.SetActive(false);
                    //Es Body
                    EnableBody();
                    BodyOrFolder = true;
                    //Cambiamos imagen a folder
                    folderImage1.sprite = imageBody;
                }
            }

            else
            {
                print(Application.persistentDataPath + "/images/" + Name + "/" + foldertype);
                DisableBody();
                HUDFolders.SetActive(true);
                if (!Directory.Exists(Application.persistentDataPath + "/images/" + Name + "/" + foldertype))
                {
                    Directory.CreateDirectory(Application.persistentDataPath + "/images/" + Name + "/" + foldertype);
                }
                FilesCount = Directory.GetFiles(Application.persistentDataPath + "/images/" + Name + "/" + foldertype);
            }

            //Quitar los que hay
            DeleteHud();
            //print(FilesCount[0]);

            //por cada uno hago

            for (int i = 0; i < FilesCount.Length; i++)
            {
                //Creo un nombre temporal, nombre del personaje
                string TempName = FilesCount[i]; //TodaLaURL
                                                 //Divido la url por /
                string[] SplitURL = TempName.Split(new string[] { "/" }, System.StringSplitOptions.None);
                for (int o = 0; o < SplitURL.Length; o++)
                {
                    print(SplitURL[o]);
                }
                //Divido el final de la url por \
                //   string[] GetNameFormat = SplitURL[SplitURL.Length - 1].Split(new string[] { "/" }, System.StringSplitOptions.None);

                //Divido el final de el final de la url por .
                //  string[] GetName = GetNameFormat[1].Split(new string[] { "." }, System.StringSplitOptions.None);
                //print("Nombre del personaje: " + GetName[0]);
                string[] GetName = SplitURL[SplitURL.Length - 1].Split(new string[] { "." }, System.StringSplitOptions.None);
                if (foldertype == "Folders")
                {
                    print(GetName[0]);
                    //instancio el prefab boton en el grid
                    GameObject NewBtn = Instantiate(ImageFolder, HUDFolders.transform);
                    //Cargo la imagen

                    //Aqui va codigo de cargar desde resources la imagen

                    //añado al boton este onclick
                    NewBtn.name = GetName[0];
                    NewBtn.transform.GetChild(0).GetComponent <Text>().text = NewBtn.name;
                    //Le añadimos la funcion al boton de cargar sus carpetas
                    NewBtn.GetComponent <Button>().onClick.AddListener(delegate { BotonController(GetName[0]); });
                }
                else if (GetName[1] == "png")
                {
                    print(GetName[0] + "." + GetName[1]);
                    //instancio el prefab boton en el grid
                    GameObject NewBtn = Instantiate(ImageFolder, HUDFolders.transform);
                    //Cargo la imagen
                    LoadImage(NewBtn.GetComponent <Image>(), i);
                    //añado al boton este onclick
                    NewBtn.name = GetName[0];
                    //Le añadimos la funcion al boton de cargar sus carpetas
                    NewBtn.GetComponent <Button>().onClick.AddListener(delegate { showImage(NewBtn.GetComponent <Image>()); });
                }
            }
        }
    }