public void SetCarpetaActual(CarpetaJugada _carpeta) { SaveSystem.EditarCarpetaJugada(this, carpetaActual, _carpeta); carpetaActual.BorrarJugada(this); _carpeta.AgregarJugada(this); carpetaActual = _carpeta; }
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 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); } }
public void CrearNuevaCarpeta() { string _nombreCarpeta = inputNombreCarpeta.text.ToUpper(); if (!AppController.instance.VerificarNombreCarpeta(_nombreCarpeta)) { mensajeError.SetText("CARPETA EXISTENTE", AppController.Idiomas.Español); mensajeError.SetText("EXISTING FOLDER", AppController.Idiomas.Ingles); mensajeError.Activar(); return; } if (_nombreCarpeta == SaveSystem.carpetaEspecialEspañol || _nombreCarpeta == SaveSystem.carpetaEspecialIngles) { mensajeError.SetText("NOMBRE RESERVADO", AppController.Idiomas.Español); mensajeError.SetText("RESERVED NAME", AppController.Idiomas.Ingles); mensajeError.Activar(); return; } CarpetaJugada _nuevaCarpeta = new CarpetaJugada(_nombreCarpeta); AppController.instance.AgregarCarpetaJugada(_nuevaCarpeta); NuevaCarpeta(_nuevaCarpeta, true); seccionCrearNuevaCarpeta.ToggleDesplegar(); }
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(); }
public static void BorrarCarpeta(CarpetaJugada _carpeta) { string path = pathImagenJugadas + _carpeta.GetNombre(); if (Directory.Exists(path)) { Directory.Delete(path, true); } }
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); }
public void BorrarCarpeta(CarpetaJugada _carpeta) { if (!carpetasJugadas.Contains(_carpeta)) { return; } carpetasJugadas.Remove(_carpeta); SaveSystem.BorrarCarpeta(_carpeta); }
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 ImagenBiblioteca(byte[] bytes_, string nombre_, string categoria_, CarpetaJugada _carpeta) { nombre = nombre_; bytes = bytes_; categoria = categoria_; carpetaActual = _carpeta; //Debug.Log("W: " + AppController.instance.resWidth); //Debug.Log("H: " + AppController.instance.resHeight); texture = new Texture2D(AppController.instance.resWidth, AppController.instance.resHeight, TextureFormat.RGB24, false); texture.LoadImage(bytes); }
private void VerificarEdicionNombreJugada(string _nuevoNombre) { if (_nuevoNombre != nombreImagenText.text) { CarpetaJugada _carpeta = _jugadaFocus.GetCarpetaActual(); if (_carpeta.ExistsJugada(_nuevoNombre.ToUpper())) { Debug.Log("NOMBRE EXISTENTE: " + _nuevoNombre); panelPrincipalBiblioteca.ActivarMensajeError(); return; } else { Debug.Log("NOMBRE CAMBIADO"); panelPrincipalBiblioteca.ActivarMensajeExitoso(); SaveSystem.EditarJugada(nombreImagenText.text, _nuevoNombre.ToUpper(), _jugadaFocus.GetCarpetaActual()); //panelPrincipalBiblioteca.ResetPrefabs(); nombreImagenText.text = _nuevoNombre.ToUpper(); } } }
private void VerificarEdicionNombreJugada(string _nuevoNombre) { if (!inputNuevoNombre.wasCanceled && _nuevoNombre != _botonImagenFocus.GetNombre()) { CarpetaJugada _carpeta = _botonImagenFocus.GetCarpeta(); if (_carpeta.ExistsJugada(_nuevoNombre.ToUpper())) { Debug.Log("NOMBRE EXISTENTE: " + _nuevoNombre); mensajeError.SetText("NOMBRE EXISTENTE", AppController.Idiomas.Español); mensajeError.SetText("EXISTING NAME", AppController.Idiomas.Ingles); mensajeError.Activar(); return; } else { Debug.Log("NOMBRE CAMBIADO"); mensajeExitoso.Activar(); SaveSystem.EditarJugada(_botonImagenFocus.GetNombre(), _nuevoNombre.ToUpper(), _botonImagenFocus.GetCarpeta()); _botonImagenFocus.SetNewName(_nuevoNombre.ToUpper()); } } }
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); }
public void SetImageNuevaCarpeta(Text _nombreCarpetaText) { CarpetaJugada _nuevaCarpeta = AppController.instance.BuscarCarpetaPorNombre(_nombreCarpetaText.text.ToUpper()); if (_nuevaCarpeta == _botonImagenFocus.GetCarpeta()) { seccionSeleccionarNuevaCarpeta.Cerrar(); return; } if (!_botonImagenFocus.VerificarNombreJugadasCarpeta(_nuevaCarpeta)) { Debug.Log("NOMBRE EXISTENTE"); mensajeError.SetText("YA EXISTE UNA JUGADA CON ESTE NOMBRE", AppController.Idiomas.Español); mensajeError.SetText("THERE'S ALREADY A STRATEGY WITH THIS NAME", AppController.Idiomas.Ingles); mensajeError.Activar(); return; } _botonImagenFocus.SetCarpeta(_nuevaCarpeta); seccionSeleccionarNuevaCarpeta.Cerrar(); CanvasController.instance.retrocesoPausado = false; _botonImagenFocus = null; botones.SetActive(false); ResetPrefabs(); }
public static void GuardarCarpetaBiblioteca(CarpetaJugada _carpeta) { string path = pathImagenJugadas + _carpeta.GetNombre(); Directory.CreateDirectory(path); }
public static void LoadData() { BinaryFormatter formatter = new BinaryFormatter(); if (Directory.Exists(pathEquipos)) { #region Equipo //CARGAR EQUIPOS string[] equiposDirectories = Directory.GetDirectories(pathEquipos); for (int i = 0; i < equiposDirectories.Length; i++) { //PATH DE UN EQUIPO string pathEquipo = equiposDirectories[i]; FileStream equipoStream = new FileStream(pathEquipo + "/equipo.txt", FileMode.Open); SaveDataEquipo dataEquipo = (SaveDataEquipo)formatter.Deserialize(equipoStream); //CREAR EL EQUIPO Equipo equipo = new Equipo(dataEquipo); equipoStream.Close(); #region Jugadores //CARGAR JUGADORES string pathJugadores = pathEquipo + "/jugadores"; if (Directory.Exists(pathJugadores)) { string[] jugadoresDirectories = Directory.GetDirectories(pathJugadores); foreach (var jugadorDir in jugadoresDirectories) { FileStream streamJugador = new FileStream(jugadorDir + "/jugador.txt", FileMode.Open); SaveDataJugador dataJugador = (SaveDataJugador)formatter.Deserialize(streamJugador); Jugador jugador = new Jugador(dataJugador); streamJugador.Close(); #region Estadisticas globales jugadores //CARGAR ESTADISTICAS GLOBALES if (File.Exists(jugadorDir + "/estGlobalPartido.txt")) { FileStream estPartidoStream = new FileStream(jugadorDir + "/estGlobalPartido.txt", FileMode.Open); SaveDataEstadisticas dataEstPartido = (SaveDataEstadisticas)formatter.Deserialize(estPartidoStream); jugador.CargarEstadisticasGlobalesPartido(new Estadisticas(dataEstPartido)); estPartidoStream.Close(); } if (File.Exists(jugadorDir + "/estGlobalPractica.txt")) { FileStream estPracticaStream = new FileStream(jugadorDir + "/estGlobalPractica.txt", FileMode.Open); SaveDataEstadisticas dataEstPractica = (SaveDataEstadisticas)formatter.Deserialize(estPracticaStream); jugador.CargarEstadisticasGlobalesPractica(new Estadisticas(dataEstPractica)); estPracticaStream.Close(); } #endregion #region Partidos jugadores //CARGAR PARTIDOS if (Directory.Exists(jugadorDir + "/partidos")) { string pathPartidos = jugadorDir + "/partidos"; string[] partidosDirectories = Directory.GetDirectories(pathPartidos); foreach (var partidoDir in partidosDirectories) { //string pathPartido = pathPartidos + partidoDir; FileStream streamPartido = new FileStream(partidoDir + "/partido.txt", FileMode.Open); SaveDataPartido dataPartido = (SaveDataPartido)formatter.Deserialize(streamPartido); FileStream streamPosicion = new FileStream(partidoDir + "/posicion.txt", FileMode.Open); string dataPosicion = (string)formatter.Deserialize(streamPosicion); FileStream streamEstadisticas = new FileStream(partidoDir + "/estadisticas.txt", FileMode.Open); SaveDataEstadisticas dataEstadisticas = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas); FileStream streamResultado = new FileStream(partidoDir + "/resultado.txt", FileMode.Open); Partido _partido = new Partido(dataPartido, dataEstadisticas, jugador, dataPosicion); if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley) { SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado); ResultadoSets _res = new ResultadoSets(resPartidoSets); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets); } else { SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado); ResultadoNormal _res = new ResultadoNormal(resPartidoNormal); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal); } jugador.CargarPartido(_partido); streamPartido.Close(); streamEstadisticas.Close(); } } #endregion #region Practicas jugadores //CARGAR PRACTICAS if (Directory.Exists(jugadorDir + "/practicas")) { string pathPracticas = jugadorDir + "/practicas"; string[] practicasDirectories = Directory.GetDirectories(pathPracticas); foreach (var practicaDir in practicasDirectories) { //string pathPractica = pathPracticas + practicaDir; FileStream streamPractica = new FileStream(practicaDir + "/partido.txt", FileMode.Open); SaveDataPartido dataPractica = (SaveDataPartido)formatter.Deserialize(streamPractica); FileStream streamPosicion = new FileStream(practicaDir + "/posicion.txt", FileMode.Open); string dataPosicion = (string)formatter.Deserialize(streamPosicion); Debug.Log("POS LOAD: " + jugador.GetPosicionActual()); FileStream streamEstadisticas = new FileStream(practicaDir + "/estadisticas.txt", FileMode.Open); SaveDataEstadisticas dataEstadisticas = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas); FileStream streamResultado = new FileStream(practicaDir + "/resultado.txt", FileMode.Open); Partido _partido = new Partido(dataPractica, dataEstadisticas, jugador, dataPosicion); if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley) { SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado); ResultadoSets _res = new ResultadoSets(resPartidoSets); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets); } else { SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado); ResultadoNormal _res = new ResultadoNormal(resPartidoNormal); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal); } jugador.CargarPractica(_partido); streamPractica.Close(); streamEstadisticas.Close(); } } #endregion equipo.CargarJugador(jugador); } } #endregion #region Jugador Favorito string favPlayerPath = pathEquipo + "/favouritePlayer.txt"; if (File.Exists(favPlayerPath)) { FileStream streamFavPlayer = new FileStream(favPlayerPath, FileMode.Open); string jugadorFavorito = (string)formatter.Deserialize(streamFavPlayer); equipo.SetJugadorFavorito(jugadorFavorito); } #endregion #region Estadisticas globales equipo //CARGAR ESTADISTICAS GLOBALES if (File.Exists(pathEquipo + "/estGlobalPartido.txt")) { FileStream estPartidoStream = new FileStream(pathEquipo + "/estGlobalPartido.txt", FileMode.Open); SaveDataEstadisticas dataEstPartido = (SaveDataEstadisticas)formatter.Deserialize(estPartidoStream); Estadisticas est = new Estadisticas(dataEstPartido); equipo.CargarEstadisticasGlobalesPartido(est); estPartidoStream.Close(); } if (File.Exists(pathEquipo + "/estGlobalPractica.txt")) { FileStream estPracticaStream = new FileStream(pathEquipo + "/estGlobalPractica.txt", FileMode.Open); SaveDataEstadisticas dataEstPractica = (SaveDataEstadisticas)formatter.Deserialize(estPracticaStream); equipo.CargarEstadisticasGlobalesPractica(new Estadisticas(dataEstPractica)); estPracticaStream.Close(); } #endregion #region Partidos equipo //CARGAR PARTIDOS if (Directory.Exists(pathEquipo + "/partidos")) { string pathPartidos = pathEquipo + "/partidos"; string[] partidosDirectories = Directory.GetDirectories(pathPartidos); foreach (var partidoDir in partidosDirectories) { //string pathPartido = pathPartidos + partidoDir; FileStream streamPartido = new FileStream(partidoDir + "/partido.txt", FileMode.Open); SaveDataPartido dataPartido = (SaveDataPartido)formatter.Deserialize(streamPartido); FileStream streamEstadisticas = new FileStream(partidoDir + "/estadisticas.txt", FileMode.Open); SaveDataEstadisticas dataEstadisticas = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas); FileStream streamResultado = new FileStream(partidoDir + "/resultado.txt", FileMode.Open); Partido _partido = new Partido(dataPartido, dataEstadisticas, equipo); if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley) { SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado); ResultadoSets _res = new ResultadoSets(resPartidoSets); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets); } else { SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado); ResultadoNormal _res = new ResultadoNormal(resPartidoNormal); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal); } equipo.CargarPartido(_partido); streamPartido.Close(); streamEstadisticas.Close(); } } #endregion #region Practica equipo //CARGAR PRACTICAS if (Directory.Exists(pathEquipo + "/practicas")) { string pathPracticas = pathEquipo + "/practicas"; string[] practicasDirectories = Directory.GetDirectories(pathPracticas); foreach (var practicaDir in practicasDirectories) { //string pathPractica = pathPracticas + practicaDir; FileStream streamPractica = new FileStream(practicaDir + "/partido.txt", FileMode.Open); SaveDataPartido dataPractica = (SaveDataPartido)formatter.Deserialize(streamPractica); FileStream streamEstadisticas = new FileStream(practicaDir + "/estadisticas.txt", FileMode.Open); SaveDataEstadisticas dataEstadisticas = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas); FileStream streamResultado = new FileStream(practicaDir + "/resultado.txt", FileMode.Open); Partido _partido = new Partido(dataPractica, dataEstadisticas, equipo); if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley) { SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado); ResultadoSets _res = new ResultadoSets(resPartidoSets); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets); } else { SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado); ResultadoNormal _res = new ResultadoNormal(resPartidoNormal); _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal); } equipo.CargarPractica(_partido); streamPractica.Close(); streamEstadisticas.Close(); } } #endregion #endregion #region Planillas //CARGAR PLANILLAS string pathPlanillas = pathEquipos + equipo.GetNombre() + "/planillas"; if (Directory.Exists(pathPlanillas)) { string[] planillasDirectories = Directory.GetDirectories(pathPlanillas); //Vector de Carpetas de Planillas for (int j = 0; j < planillasDirectories.Length; j++) //Para cada carpeta de planillas { string pathPlanillaAsistencia = Directory.GetFiles(planillasDirectories[j])[0]; //Obtengo la dirección de la carpeta actual FileStream streamPlanillaAsistencia = new FileStream(pathPlanillaAsistencia, FileMode.Open); SaveDataPlanillaAsistencia dataPlanillaAsistencia = (SaveDataPlanillaAsistencia)formatter.Deserialize(streamPlanillaAsistencia); equipo.AgregarPlanillaAsistencia(dataPlanillaAsistencia); string[] detallesFiles = Directory.GetFiles(planillasDirectories[j] + "/Detalles"); //Vector de todos los detalles en la carpeta actual for (int k = 0; k < detallesFiles.Length; k++) //Para cada detalle { FileStream streamDetalles = new FileStream(detallesFiles[k], FileMode.Open); SaveDataPlanilla dataDetalle = (SaveDataPlanilla)formatter.Deserialize(streamDetalles); //Agregar la Planilla al Equipo equipo.AgregarDetalle(new DetalleAsistencia(dataDetalle), dataDetalle.GetNombrePlanilla()); streamDetalles.Close(); } } } #endregion //Agregar Equipo a la lista de Equipos AppController.instance.AgregarEquipo(equipo); } } #region Jugadas //Cargar imagenes if (Directory.Exists(pathImagenJugadas)) { //Por cada imagen guardada creo un objeto imagen string[] pathsCarpeta = Directory.GetDirectories(pathImagenJugadas); for (int i = 0; i < pathsCarpeta.Length; i++) { string _nombreCarpeta = Path.GetFileName(pathsCarpeta[i]); if (_nombreCarpeta == "-") { _nombreCarpeta = SaveSystem.carpetaEspecialEspañol; } CarpetaJugada _carpeta = new CarpetaJugada(_nombreCarpeta); string[] pathCarpetasJugadas = Directory.GetDirectories(pathsCarpeta[i]); for (int k = 0; k < pathCarpetasJugadas.Length; k++) { string[] pathArchivos = Directory.GetFiles(pathCarpetasJugadas[k]); byte[] bytes = null; string nombre = string.Empty; string categoria = string.Empty; for (int j = 0; j < pathArchivos.Length; j++) { if (Path.GetExtension(pathArchivos[j]) == ".png") { nombre = Path.GetFileNameWithoutExtension(pathArchivos[j]); bytes = File.ReadAllBytes(pathArchivos[j]); } else { FileStream streamCategoria = new FileStream(pathArchivos[j], FileMode.Open); categoria = (string)formatter.Deserialize(streamCategoria); } } ImagenBiblioteca _imagenBiblioteca = new ImagenBiblioteca(bytes, nombre, categoria, _carpeta); //AppController.instance.AgregarImagen(_imagenBiblioteca); _carpeta.AgregarJugada(_imagenBiblioteca); } AppController.instance.AgregarCarpetaJugada(_carpeta); } if (!Directory.Exists(pathImagenJugadas + "-")) { Directory.CreateDirectory(pathImagenJugadas + "-"); AppController.instance.AgregarCarpetaJugada(new CarpetaJugada(SaveSystem.carpetaEspecialEspañol)); } } else { Directory.CreateDirectory(pathImagenJugadas + "-"); AppController.instance.AgregarCarpetaJugada(new CarpetaJugada(SaveSystem.carpetaEspecialEspañol)); } #endregion #region Settings string settingsPath = Application.persistentDataPath + "/" + SaveSystem.carpetaPrincipal + "/settings.txt"; if (File.Exists(settingsPath)) { FileStream streamSettings = new FileStream(settingsPath, FileMode.Open); SaveDataSettings dataSettings = (SaveDataSettings)formatter.Deserialize(streamSettings); AppController.instance.SetSettings(dataSettings); } string equipoFavPath = Application.persistentDataPath + "/" + SaveSystem.carpetaPrincipal + "/favouriteTeam.txt"; if (File.Exists(equipoFavPath)) { FileStream streamFavTeam = new FileStream(equipoFavPath, FileMode.Open); string equipoFavorito = (string)formatter.Deserialize(streamFavTeam); AppController.instance.SetTeamAsFavourite(equipoFavorito); } #endregion }
public void BorrarJugadaFocus() { CarpetaJugada _carpeta = _jugadaFocus.GetCarpetaActual(); _carpeta.BorrarJugada(_jugadaFocus); }
public bool VerificarNombreJugadasCarpeta(CarpetaJugada _carpeta) { return(_carpeta.BuscarJugada(_jugadaFocus.GetNombre()) == null); }
public void SetCarpeta(CarpetaJugada _carpeta) { carpeta = _carpeta; nombreCarpeta.text = carpeta.GetNombre(); }
public void SetCarpeta(CarpetaJugada _carpeta) { _jugadaFocus.SetCarpetaActual(_carpeta); }
public void AgregarCarpetaJugada(CarpetaJugada _carpeta) { carpetasJugadas.Add(_carpeta); }