public void SetDetallesJugador(Partido _partido, string nombreJugador, Estadisticas _estadisticas)
    {
        partidoFocus = _partido;
        ResultadoEntradaDatos.Resultado _tipoResultado;

        if (_partido != null)
        {
            if (partidoFocus.GetTipoResultadoPartido() == Partido.TipoResultadoPartido.Normal)
            {
                resultadoSets.gameObject.SetActive(false);
                resultadoNormal.gameObject.SetActive(true);

                ResultadoNormal _res = (ResultadoNormal)partidoFocus.GetResultadoEntradaDato();

                resultadoNormal.CopyDataFrom(_res);
                resultadoNormal.DisableEdition();
                _tipoResultado = resultadoNormal.GetResultado();
            }
            else
            {
                resultadoSets.gameObject.SetActive(true);
                resultadoNormal.gameObject.SetActive(false);

                ResultadoSets    _res   = (ResultadoSets)partidoFocus.GetResultadoEntradaDato();
                List <SetPrefab> _lista = _res.GetListaSets();

                resultadoSets.BorrarPrefabs();
                foreach (var set in _lista)
                {
                    resultadoSets.AgregarSet(set);
                }
                resultadoSets.DisableEdition();
                _tipoResultado = resultadoSets.GetResultado();
            }

            if (_tipoResultado == ResultadoEntradaDatos.Resultado.Victoria)
            {
                resultadoText.SetText("Victoria", AppController.Idiomas.Español);
                resultadoText.SetText("Victory", AppController.Idiomas.Ingles);
            }
            else if (_tipoResultado == ResultadoEntradaDatos.Resultado.Derrota)
            {
                resultadoText.SetText("Derrota", AppController.Idiomas.Español);
                resultadoText.SetText("Loss", AppController.Idiomas.Ingles);
            }
            else
            {
                resultadoText.SetText("Empate", AppController.Idiomas.Español);
                resultadoText.SetText("Tie", AppController.Idiomas.Ingles);
            }

            if (isPartido)
            {
                CanvasController.instance.overlayPanel.SetNombrePanel("PARTIDO: " + partidoFocus.GetNombre(), AppController.Idiomas.Español);
                CanvasController.instance.overlayPanel.SetNombrePanel("MATCH: " + partidoFocus.GetNombre(), AppController.Idiomas.Ingles);
            }
            else
            {
                CanvasController.instance.overlayPanel.SetNombrePanel("PRACTICA: " + partidoFocus.GetNombre(), AppController.Idiomas.Español);
                CanvasController.instance.overlayPanel.SetNombrePanel("PRACTICE: " + partidoFocus.GetNombre(), AppController.Idiomas.Ingles);
            }
        }

        if (_partido == null)
        {
            botonVerResumen.SetActive(false);
            botonBorrar.SetActive(false);
            seccionResultado.SetActive(false);
        }
        else
        {
            botonVerResumen.SetActive(true);
            botonBorrar.SetActive(true);
            seccionResultado.SetActive(true);
        }

        if (listaPrefabsTextos == null)
        {
            listaPrefabsTextos = new List <GameObject>();
        }
        jugador = AppController.instance.equipoActual.BuscarPorNombre(nombreJugador);

        estadisticas = _estadisticas;

        parentTransform = panelEstadisticas.GetPanelEstadisticaTransform();

        if (partidoFocus == null)
        {
            posicionText.text = string.Empty;
        }
        else
        {
            posicionText.text = partidoFocus.GetPosicion();
        }

        BorrarPrefabs();
        CrearPrefabs();
    }
Example #2
0
    public void SetPanelEstadisticasGlobalesEquipo(Partido _partido, bool fromGrafica = false)
    {
        botonVerResultado.SetActive(true);

        partidoFocus = _partido;
        ResultadoEntradaDatos.Resultado _tipoResultado;

        coloresBotones.Clear();
        coloresBotones.Add(AppController.instance.colorTheme.detalle5);
        coloresBotones.Add(AppController.instance.colorTheme.detalle3);

        Deportes.DeporteEnum deporteActual = AppController.instance.equipoActual.GetDeporte();

        switch (deporteActual)
        {
        //NORMAL CON PENALES
        case Deportes.DeporteEnum.Futbol:
        case Deportes.DeporteEnum.HockeyCesped:
        case Deportes.DeporteEnum.HockeyPatines:
        case Deportes.DeporteEnum.Handball:
            resultadoSets.gameObject.SetActive(false);
            resultadoNormal.gameObject.SetActive(true);

            ResultadoNormal _res = (ResultadoNormal)partidoFocus.GetResultadoEntradaDato();
            Debug.Log(_res == null);
            resultadoNormal.CopyDataFrom(_res);
            resultadoNormal.DisableEdition();
            _tipoResultado = resultadoNormal.GetResultado();
            Debug.Log("NORMAL CON PENALES");
            break;

        //NORMAL SIN PENALES
        case Deportes.DeporteEnum.Basket:
        case Deportes.DeporteEnum.Rugby:
        case Deportes.DeporteEnum.Softball:
            resultadoSets.gameObject.SetActive(false);
            resultadoNormal.gameObject.SetActive(true);

            ResultadoNormal _resNorm = (ResultadoNormal)partidoFocus.GetResultadoEntradaDato();

            resultadoNormal.CopyDataFrom(_resNorm);
            resultadoNormal.DisableEdition(false);
            _tipoResultado = resultadoNormal.GetResultado();
            Debug.Log("NORMAL SIN PENALES");
            break;

        //SETS CON TIEBREAK
        case Deportes.DeporteEnum.Padel:
        case Deportes.DeporteEnum.Tenis:
        case Deportes.DeporteEnum.Voley:
            resultadoSets.gameObject.SetActive(true);
            resultadoNormal.gameObject.SetActive(false);

            ResultadoSets    _resSets = (ResultadoSets)partidoFocus.GetResultadoEntradaDato();
            List <SetPrefab> _lista   = _resSets.GetListaSets();

            resultadoSets.BorrarPrefabs();
            foreach (var set in _lista)
            {
                resultadoSets.AgregarSet(set);
            }
            resultadoSets.DisableEdition();
            _tipoResultado = resultadoSets.GetResultado();
            Debug.Log("SETS CON TIEBREAK");
            break;

        default:
            Debug.LogError("ERROR CON EL DEPORTE ACTUAL");
            _tipoResultado = ResultadoEntradaDatos.Resultado.Derrota;
            break;
        }

        /*if (partidoFocus.GetTipoResultadoPartido() == Partido.TipoResultadoPartido.Normal)
         * {
         *  resultadoSets.gameObject.SetActive(false);
         *  resultadoNormal.gameObject.SetActive(true);
         *
         *  ResultadoNormal _res = (ResultadoNormal)partidoFocus.GetResultadoEntradaDato();
         *  Debug.Log(_res == null);
         *  resultadoNormal.CopyDataFrom(_res);
         *  resultadoNormal.DisableEdition();
         *  _tipoResultado = resultadoNormal.GetResultado();
         * }
         * else
         * {
         *  resultadoSets.gameObject.SetActive(true);
         *  resultadoNormal.gameObject.SetActive(false);
         *
         *  ResultadoSets _res = (ResultadoSets)partidoFocus.GetResultadoEntradaDato();
         *  List<SetPrefab> _lista = _res.GetListaSets();
         *
         *  resultadoSets.BorrarPrefabs();
         *  foreach (var set in _lista)
         *  {
         *      resultadoSets.AgregarSet(set);
         *  }
         *  resultadoSets.DisableEdition();
         *  _tipoResultado = resultadoSets.GetResultado();
         * }*/


        if (_tipoResultado == ResultadoEntradaDatos.Resultado.Victoria)
        {
            resultadoText.SetText("Victoria", AppController.Idiomas.Español);
            resultadoText.SetText("Victory", AppController.Idiomas.Ingles);
        }
        else if (_tipoResultado == ResultadoEntradaDatos.Resultado.Derrota)
        {
            resultadoText.SetText("Derrota", AppController.Idiomas.Español);
            resultadoText.SetText("Loss", AppController.Idiomas.Ingles);
        }
        else
        {
            resultadoText.SetText("Empate", AppController.Idiomas.Español);
            resultadoText.SetText("Tie", AppController.Idiomas.Ingles);
        }


        CanvasController.instance.overlayPanel.SetNombrePanel("PARTIDO: " + _partido.GetNombre(), AppController.Idiomas.Español);
        CanvasController.instance.overlayPanel.SetNombrePanel("MATCH: " + _partido.GetNombre(), AppController.Idiomas.Ingles);

        seccionResultado.SetActive(true);
        botonBorrar.SetActive(true);

        Screen.orientation = ScreenOrientation.Portrait;

        if (!fromGrafica)
        {
            CanvasController.instance.AgregarPanelAnterior(CanvasController.Paneles.EstadisticasGlobalesEquipo);
        }

        if (listaPrefabsTextos == null)
        {
            listaPrefabsTextos = new List <GameObject>();
        }

        estadisticas = _partido.GetEstadisticas();

        parentTransform = estadisticasGlobales.SetPanelEstadisticas();

        BorrarPrefabs();
        CrearPrefabs();
    }