public void NuevoJugador(InfoJugador info) //Agregar nuevo jugador a la lista de jugadores { Jugador newJug = new Jugador(info, deporte); SaveSystem.GuardarJugador(newJug, this); jugadores.Add(newJug); }
public void NuevaInfo(InfoJugador info_) { infoObligatoria = info_.infoObligatoria; infoString = info_.infoString; infoInt = info_.infoInt; infoEspecial = info_.infoEspecial; fechaNac = info_.fechaNac; pathImagenJugador = info_.pathImagenJugador; }
public void SetearPanelInfoJugador(Jugador jugador) { CanvasController.instance.overlayPanel.SetNombrePanel("JUGADOR: " + jugador.GetNombre(), AppController.Idiomas.Español); CanvasController.instance.overlayPanel.SetNombrePanel("PLAYER: " + jugador.GetNombre(), AppController.Idiomas.Ingles); textEditando.SetActive(false); botonGuardarCambios.SetActive(false); infoJugador = jugador.GetInfoJugador(); jugadorFocus = jugador; coloresBotones.Clear(); coloresBotones.Add(AppController.instance.colorTheme.detalle5); coloresBotones.Add(AppController.instance.colorTheme.detalle3); BorrarPrefabs(); CrearPrefabs(); if (prefabHeight == 0) { prefabHeight = prefabInputInfo.GetComponent <RectTransform>().rect.height; } cantMinima = (int)(scrollRect.GetComponent <RectTransform>().rect.height / (prefabHeight + parentTransform.GetComponent <VerticalLayoutGroup>().spacing + parentTransform.GetComponent <VerticalLayoutGroup>().padding.top)); Debug.Log("CANT MINIMA: " + cantMinima); imagenJugador.GetComponentInParent <Button>().enabled = false; imagenJugador.sprite = defaultSpriteJugador; if (infoJugador.pathImagenJugador != null) { Texture2D texture = NativeGallery.LoadImageAtPath(infoJugador.pathImagenJugador, 1000, markTextureNonReadable: false); if (texture == null) { Debug.Log("Couldn't load texture from " + infoJugador.pathImagenJugador); return; } Sprite sprite = Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(.5f, .5f), 100f); if (sprite == null) { Debug.Log("Error creating sprite"); return; } imagenJugador.sprite = sprite; } else { Debug.Log("PATH NULO"); } Debug.Log("PATH INFO: " + infoJugador.pathImagenJugador); }
public Jugador(/*string nombre_, int peso_, int altura_, */ InfoJugador infoJugador_, Deportes.DeporteEnum deporte_) //Constructor por nombre { /*nombre = nombre_; * peso = peso_; * altura = altura_;*/ infoJugador = infoJugador_; deporte = deporte_; estadisticasGlobalesPartido = new Estadisticas(deporte_); estadisticasGlobalesPractica = new Estadisticas(deporte_); partidos = new List <Partido>(); practicas = new List <Partido>(); }
public Jugador(SaveDataJugador dataJugador)//, SaveDataEstadisticas dataPartido, SaveDataEstadisticas dataPractica) { /*nombre = dataJugador.GetNombre(); * peso = dataJugador.GetPeso(); * altura = dataJugador.GetAltura();*/ /*estadisticasGlobalesPartido = new Estadisticas(dataPartido); * estadisticasGlobalesPractica = new Estadisticas(dataPractica);*/ infoJugador = new InfoJugador(dataJugador); //CAMBIAR ESTO, EL SAVE DATA JUGADOR TIENE QUE GUARDAR UN INFOJUGADOR estadisticasGlobalesPartido = new Estadisticas(dataJugador.deporte); estadisticasGlobalesPractica = new Estadisticas(dataJugador.deporte); partidos = new List <Partido>(); practicas = new List <Partido>(); }
private void Start() { coloresBotones = new List <Color>(); InfoJugador infoJugadorAux = new InfoJugador(); prefabHeight = prefabInputInfo.GetComponent <RectTransform>().rect.height; coloresBotones.Clear(); coloresBotones.Add(AppController.instance.colorTheme.detalle5); coloresBotones.Add(AppController.instance.colorTheme.detalle3); pathImagenJugador = null; imagenJugador.sprite = defaultSpriteJugador; SetInputs(); }
public SaveDataJugador(InfoJugador infoJugador_, Deportes.DeporteEnum deporte_) { deporte = deporte_; catObligatoria = ListaKeysString(infoJugador_.GetInfoObligatoria().Keys); valObligatoria = ListaValuesString(infoJugador_.GetInfoObligatoria().Values); catString = ListaKeysString(infoJugador_.GetInfoString().Keys); valString = ListaValuesString(infoJugador_.GetInfoString().Values); catInt = ListaKeysInt(infoJugador_.GetInfoInt().Keys); valInt = ListaValuesInt(infoJugador_.GetInfoInt().Values); catEspecial = ListaKeysString(infoJugador_.GetInfoEspecial().Keys); valEspecial = ListaValuesString(infoJugador_.GetInfoEspecial().Values); fechaNacYear = infoJugador_.GetFechaNac().Year; fechaNacMonth = infoJugador_.GetFechaNac().Month; fechaNacDay = infoJugador_.GetFechaNac().Day; pathImagenJugador = infoJugador_.pathImagenJugador; }
public void ConfirmarEdicion() { InfoJugador ij = new InfoJugador(); foreach (var input in inputsObligatorios) { if (input.GetValorCategoria() == "") { mensajeError.SetText("Completar campos obligatorios (*)".ToUpper(), AppController.Idiomas.Español); mensajeError.SetText("Complete required fields (*)".ToUpper(), AppController.Idiomas.Ingles); mensajeError.Activar(); return; } ij.SetInfoObligatoria(input); } //Reviasr si existe el nombre (hacer una función de comporbación de nombres general en appcontroller if (nombreActual != ij.GetNombre() && AppController.instance.equipoActual.BuscarPorNombre(ij.GetNombre()) != null || ij.GetNombre() == "" || ij.GetNombre() == " ") { mensajeError.SetText("Nombre inválido/existente!".ToUpper(), AppController.Idiomas.Español); mensajeError.SetText("Invalid/Existing name!".ToUpper(), AppController.Idiomas.Ingles); mensajeError.Activar(); return; } foreach (var input in inputsInt) { ij.SetInfoInt(input); } int numCamisetaActualInt = -1; int.TryParse(numCamisetaActual, out numCamisetaActualInt); Debug.Log("NUM ACTUAL: " + numCamisetaActualInt); int numCamiseta = -1; if (int.TryParse(ij.GetNumeroCamiseta(), out numCamiseta)) { Debug.Log("NUEVO NUM: " + numCamiseta); if (numCamiseta != numCamisetaActualInt && (numCamiseta < 0 || !AppController.instance.equipoActual.VerficarNumeroCamiseta(ij.GetNumeroCamiseta()))) { mensajeError.SetText("NUMERO DE CAMISETA EN USO", AppController.Idiomas.Español); mensajeError.SetText("SHIR NUMBER IN USE", AppController.Idiomas.Ingles); mensajeError.Activar(); return; } } foreach (var input in inputsString) { ij.SetInfoString(input); } foreach (var input in inputsEspecial) { ij.SetInfoEspecial(input); } ij.SetFechaNac(inputFecha.GetFechaPlaceholder()); if (pathImagenJugador != null) { ij.pathImagenJugador = pathImagenJugador; } else { ij.pathImagenJugador = null; } jugadorFocus.Editar(ij); HabilitarEdicion(false); }
public void Editar(InfoJugador infoJugador_) { SaveSystem.EditarJugador(this, AppController.instance.equipoActual, infoJugador_.GetNombre()); infoJugador.NuevaInfo(infoJugador_); SaveSystem.EditarInfoJugador(this, AppController.instance.equipoActual); }
private void SetInputs() { infoJugador = new InfoJugador(); inputsString = new List <InputPrefab>(); inputsInt = new List <InputPrefab>(); inputsEspecial = new List <InputPrefab>(); inputsObligatorios = new List <InputPrefab>(); //int idxColor = 0; foreach (var info in infoJugador.GetInfoObligatoria()) { GameObject go = Instantiate(prefabInputInfo, parentTransform); go.gameObject.SetActive(true); InputPrefab IPgo = go.GetComponent <InputPrefab>(); IPgo.SetNombreCategoria(info.Key.ToUpper()); IPgo.SetText(info.Key, AppController.Idiomas.Español); IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key, AppController.Idiomas.Ingles), AppController.Idiomas.Ingles); IPgo.SetCampoObligatorio(true); IPgo.SetKeyboardType(TouchScreenKeyboardType.Default); inputsObligatorios.Add(IPgo); //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]); //idxColor++; } GameObject GO = Instantiate(prefabInputFecha, parentTransform); GO.SetActive(true); inputFecha = GO.GetComponent <InputPrefabFecha>(); inputFecha.SetCampoObligatorio(true); inputFecha.SetNombreCategoria("Fecha Nacimiento".ToUpper()); inputFecha.SetText("Fecha Nacimiento".ToUpper(), AppController.Idiomas.Español); inputFecha.SetText("Date of birth".ToUpper(), AppController.Idiomas.Ingles); inputFecha.ResetValor(); //inputFecha.SetColor(coloresBotones[idxColor % coloresBotones.Count]); //idxColor++; foreach (var info in infoJugador.GetInfoString()) { GameObject go = Instantiate(prefabInputInfo, parentTransform); go.SetActive(true); InputPrefab IPgo = go.GetComponent <InputPrefab>(); IPgo.SetNombreCategoria(info.Key.ToUpper()); IPgo.SetText(info.Key, AppController.Idiomas.Español); IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key, AppController.Idiomas.Ingles), AppController.Idiomas.Ingles); IPgo.SetKeyboardType(TouchScreenKeyboardType.Default); inputsString.Add(IPgo); //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]); //idxColor++; } foreach (var info in infoJugador.GetInfoInt()) { Debug.Log("INFO INT"); GameObject go = Instantiate(prefabInputInfo, parentTransform); go.SetActive(true); InputPrefab IPgo = go.GetComponent <InputPrefab>(); IPgo.SetNombreCategoria(info.Key.ToUpper()); IPgo.SetText(info.Key, AppController.Idiomas.Español); IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key, AppController.Idiomas.Ingles), AppController.Idiomas.Ingles); IPgo.SetKeyboardType(TouchScreenKeyboardType.NumberPad); inputsInt.Add(IPgo); //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]); //idxColor++; } foreach (var info in infoJugador.GetInfoEspecial()) { GameObject go = Instantiate(prefabInputInfoEspecial, parentTransform); go.SetActive(true); InputPrefabEspecial IPgo = go.GetComponent <InputPrefabEspecial>(); IPgo.SetNombreCategoria(info.Key.ToUpper()); IPgo.SetText(info.Key, AppController.Idiomas.Español); IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key, AppController.Idiomas.Ingles), AppController.Idiomas.Ingles); inputsEspecial.Add(IPgo); //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]); //idxColor++; } pathImagenJugador = null; imagenJugador.sprite = defaultSpriteJugador; }
public void GuardarNuevoJugador() { Equipo equipoActual = AppController.instance.equipoActual; InfoJugador ij = new InfoJugador(); if (!inputFecha.IsDateValid()) { mensajeError.SetText("Completar campos obligatorios (*)".ToUpper(), AppController.Idiomas.Español); mensajeError.SetText("Complete required fields (*)".ToUpper(), AppController.Idiomas.Ingles); mensajeError.Activar(); return; } foreach (var input in inputsObligatorios) { if (input.GetValorCategoria() == "") { mensajeError.SetText("Completar campos obligatorios (*)".ToUpper(), AppController.Idiomas.Español); mensajeError.SetText("Complete required fields (*)".ToUpper(), AppController.Idiomas.Ingles); mensajeError.Activar(); return; } ij.SetInfoObligatoria(input); } //Reviasr si existe el nombre (hacer una función de comporbación de nombres general en appcontroller if (equipoActual.BuscarPorNombre(ij.GetNombre()) != null || !AppController.instance.VerificarNombre(ij.GetNombre())) { mensajeError.SetText("Nombre inválido/existente!".ToUpper(), AppController.Idiomas.Español); mensajeError.SetText("Invalid/Existing name!".ToUpper(), AppController.Idiomas.Ingles); mensajeError.Activar(); return; } foreach (var input in inputsInt) { ij.SetInfoInt(input); } int numCamiseta = -1; if (int.TryParse(ij.GetNumeroCamiseta(), out numCamiseta)) { if (numCamiseta < 0 || !equipoActual.VerficarNumeroCamiseta(ij.GetNumeroCamiseta())) { mensajeError.SetText("NUMERO DE CAMISETA EN USO", AppController.Idiomas.Español); mensajeError.SetText("SHIR NUMBER IN USE", AppController.Idiomas.Ingles); mensajeError.Activar(); return; } } foreach (var input in inputsString) { ij.SetInfoString(input); } foreach (var input in inputsEspecial) { ij.SetInfoEspecial(input); } ij.SetFechaNac(inputFecha.GetFecha()); //GUARDAR IMAGEN DE JUGADOR if (pathImagenJugador != null) { ij.pathImagenJugador = pathImagenJugador; } else { ij.pathImagenJugador = null; } Debug.Log("PATH: " + pathImagenJugador); equipoActual.NuevoJugador(ij); CanvasController.instance.MostrarPanelAnterior(); }