public void CrearPrefabs(CarpetaJugada _carpeta, Transform _goJugadas)
    {
        carpeta = _carpeta;
        if (_carpeta.GetNombre() == "-")
        {
            nombreCarpetaText.text = "SIN CARPETA";
        }
        else
        {
            nombreCarpetaText.text = _carpeta.GetNombre();
        }

        seccionJugadas = Instantiate(seccionJugadasPrefab, _goJugadas, false);
        seccionJugadas.SetActive(false);

        listaBotonImagen = new List <BotonImagen>();

        foreach (var jugada in _carpeta.GetListaJugadas())
        {
            Debug.Log("NOMBRE: " + jugada.GetNombre());
            Debug.Log("CATEGORIA: " + jugada.GetCategoria());

            GameObject go = Instantiate(botonJugadaPrefab, seccionJugadas.transform, false);
            go.SetActive(true);
            BotonImagen botonGO = go.GetComponent <BotonImagen>();
            botonGO.SetJugadaFocus(jugada);
            listaBotonImagen.Add(botonGO);
        }
    }
示例#2
0
    public static void EditarJugada(string nombreViejo, string nombreNuevo, CarpetaJugada _carpeta)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string nombreCarpeta = _carpeta.GetNombre();

        string pathViejo = pathImagenJugadas + _carpeta.GetNombre() + "/" + nombreViejo;
        string pathNuevo = pathImagenJugadas + _carpeta.GetNombre() + "/" + nombreNuevo;

        if (_carpeta == null || nombreCarpeta.ToUpper() == carpetaEspecialEspañol || nombreCarpeta.ToUpper() == carpetaEspecialIngles)
        {
            pathViejo = pathImagenJugadas + "-" + "/" + nombreViejo;
            pathNuevo = pathImagenJugadas + "-" + "/" + nombreNuevo;
        }

        Directory.Move(pathViejo, pathNuevo);

        ImagenBiblioteca jugada = _carpeta.BuscarJugada(nombreViejo);

        if (jugada == null)
        {
            Debug.Log("JUGADA NULL");
            return;
        }

        jugada.SetNombre(nombreNuevo);

        string filePathViejo = pathNuevo + "/" + nombreViejo + ".png";
        string filePathNuevo = pathNuevo + "/" + nombreNuevo + ".png";

        File.Move(filePathViejo, filePathNuevo);
    }
    public void Activar(BotonCarpetaJugada _botonCarpeta)
    {
        AndroidManager.HapticFeedback();
        _carpetaFocus = _botonCarpeta.GetCarpeta();

        text.SetText("Borrar carpeta \"" + _carpetaFocus.GetNombre() + "\"? Todas las jugadas en esta carpeta serán eliminadas".ToUpper(), AppController.Idiomas.Español);
        text.SetText("Delete folder \"" + _carpetaFocus.GetNombre() + "\"? Every strategy in this folder will be deleted".ToUpper(), AppController.Idiomas.Ingles);
        ToggleDesplegar();
    }
示例#4
0
    public static void GuardarJugadaImagen(byte[] bytes, string nombreJugada, string categoria, CarpetaJugada _carpeta)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string carpetaPath;

        if (_carpeta == null || _carpeta.GetNombre() == carpetaEspecialEspañol || _carpeta.GetNombre() == carpetaEspecialIngles)
        {
            carpetaPath = pathImagenJugadas + "-" + "/";
        }
        else
        {
            carpetaPath = pathImagenJugadas + _carpeta.GetNombre() + "/";
        }

        string imagenPath = carpetaPath + nombreJugada + "/";

        if (!Directory.Exists(imagenPath))
        {
            Directory.CreateDirectory(imagenPath);
            if (_carpeta == null)
            {
                if (AppController.instance.idioma == AppController.Idiomas.Español)
                {
                    _carpeta = AppController.instance.BuscarCarpetaPorNombre(carpetaEspecialEspañol);
                    if (_carpeta == null)
                    {
                        _carpeta = new CarpetaJugada(carpetaEspecialEspañol);
                        AppController.instance.AgregarCarpetaJugada(_carpeta);
                    }
                }
                else if (AppController.instance.idioma == AppController.Idiomas.Ingles)
                {
                    _carpeta = AppController.instance.BuscarCarpetaPorNombre(carpetaEspecialIngles);
                    if (_carpeta == null)
                    {
                        _carpeta = new CarpetaJugada(carpetaEspecialIngles);
                        AppController.instance.AgregarCarpetaJugada(_carpeta);
                    }
                }
            }
        }

        //string nombreImagen = System.DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");

        FileStream streamCategoria = new FileStream(imagenPath + "categoria.txt", FileMode.Create);

        formatter.Serialize(streamCategoria, categoria);
        streamCategoria.Close();

        File.WriteAllBytes(imagenPath + nombreJugada + ".png", bytes);

        ImagenBiblioteca _imagenBiblioteca = new ImagenBiblioteca(bytes, nombreJugada, categoria, _carpeta);

        _carpeta.AgregarJugada(_imagenBiblioteca);
    }
示例#5
0
    public static void BorrarJugada(ImagenBiblioteca _jugada, CarpetaJugada _carpeta)
    {
        string path = pathImagenJugadas + _carpeta.GetNombre() + "/" + _jugada.GetNombre();

        if (_carpeta.GetNombre() == carpetaEspecialEspañol || _carpeta.GetNombre() == carpetaEspecialIngles)
        {
            path = pathImagenJugadas + "-/" + _jugada.GetNombre();
        }

        if (Directory.Exists(path))
        {
            Directory.Delete(path, true);
        }
    }
    public void NuevaCarpeta(CarpetaJugada _carpeta, bool saveNew = false)
    {
        GameObject goCarpeta = Instantiate(botonCarpetaPrefab, parentTransform, false);

        goCarpeta.SetActive(true);
        BotonCarpetaJugada _botonCarpeta = goCarpeta.GetComponent <BotonCarpetaJugada>();

        _botonCarpeta.CrearPrefabs(_carpeta, parentTransform);

        listaBotonCarpeta.Add(_botonCarpeta);

        //esto arregla el bug al abrir las carpetas la primera vez
        _botonCarpeta.ToggleSeccionJugadas();
        _botonCarpeta.ToggleSeccionJugadas();

        if (_carpeta.GetNombre() == SaveSystem.carpetaEspecialEspañol)
        {
            _botonCarpeta.SetCarpetaEspecial();
        }

        if (saveNew)
        {
            SaveSystem.GuardarCarpetaBiblioteca(_carpeta);
        }

        //BorrarPrefabsCarpetas();
        //CrearPrefabsCarpetas();
    }
    public void SetSeleccionMultiple(bool active)
    {
        if (carpeta.GetNombre() == "SIN CARPETA" || carpeta.GetNombre() == "WITHOUT FOLDER")
        {
            return;
        }
        seleccionMultipleActivada = active;

        toggleSeleccionMultiple.gameObject.SetActive(active);
        botonBorrar.SetActive(!active);
        inputfield.gameObject.SetActive(!active);

        if (!active)
        {
            imagen.color = AppController.instance.colorTheme.detalle4;
        }
    }
示例#8
0
    public static void BorrarCarpeta(CarpetaJugada _carpeta)
    {
        string path = pathImagenJugadas + _carpeta.GetNombre();

        if (Directory.Exists(path))
        {
            Directory.Delete(path, true);
        }
    }
示例#9
0
    public static void EditarCarpetaJugada(ImagenBiblioteca _jugada, CarpetaJugada _carpetaVieja, CarpetaJugada _carpetaNueva)
    {
        if (_carpetaVieja == _carpetaNueva)
        {
            return;
        }

        string _nombreViejo = _carpetaVieja.GetNombre();
        string _nombreNuevo = _carpetaNueva.GetNombre();

        if (_nombreViejo == carpetaEspecialEspañol || _nombreViejo == carpetaEspecialIngles)
        {
            _nombreViejo = "-";
        }
        if (_nombreNuevo == carpetaEspecialEspañol || _nombreNuevo == carpetaEspecialIngles)
        {
            _nombreNuevo = "-";
        }

        string pathViejo = pathImagenJugadas + _nombreViejo + "/" + _jugada.GetNombre();
        string pathNuevo = pathImagenJugadas + _nombreNuevo + "/" + _jugada.GetNombre();

        Directory.Move(pathViejo, pathNuevo);
    }
示例#10
0
    public static void GuardarCarpetaBiblioteca(CarpetaJugada _carpeta)
    {
        string path = pathImagenJugadas + _carpeta.GetNombre();

        Directory.CreateDirectory(path);
    }
 public void SetCarpeta(CarpetaJugada _carpeta)
 {
     carpeta            = _carpeta;
     nombreCarpeta.text = carpeta.GetNombre();
 }