Example #1
0
    public void SetInputFecha(InputPrefabFecha _input, int day, int month, int year)
    {
        inputFecha = _input;

        List <string> optionsMonth = new List <string>();

        for (int i = 1; i <= 12; i++)
        {
            optionsMonth.Add(i.ToString());
        }
        dropdownMonth.AddOptions(optionsMonth);
        dropdownMonth.value = 0;

        List <string> optionsYear = new List <string>();

        for (int i = minYear; i <= maxYear; i++)
        {
            optionsYear.Add(i.ToString());
        }
        dropdownYear.AddOptions(optionsYear);

        int maxDays = (dropdownMonth.value == 3 || dropdownMonth.value == 5 || dropdownMonth.value == 8 || dropdownMonth.value == 10) ? 30 : 31;

        if (dropdownMonth.value == 1)
        {
            maxDays = 28;
        }

        List <string> optionsDay = new List <string>();

        for (int i = 1; i <= maxDays; i++)
        {
            optionsDay.Add(i.ToString());
        }
        dropdownDay.AddOptions(optionsDay);

        //CONTROLAR AÑOS BISIESTOS

        if (day > 0 && month > 0 && year >= minYear)
        {
            dropdownDay.value   = day - 1;
            dropdownMonth.value = month - 1;
            dropdownYear.value  = year - minYear;
        }
    }
Example #2
0
    private void CrearPrefabs()
    {
        //if(listaPrefabs == null) return;

        //int idxColor = 0;

        foreach (var info in infoJugador.GetInfoObligatoria())
        {
            if (info.Key.ToUpper() == "NOMBRE")
            {
                nombreJugadorText.text = info.Value.ToString();
            }
            else
            {
                InputPrefab IPgo = Instantiate(prefabInputInfo, parentTransform).GetComponent <InputPrefab>();
                IPgo.gameObject.SetActive(true);
                IPgo.SetNombreCategoria(info.Key.ToString());
                IPgo.SetText(info.Key.ToString().ToUpper(), AppController.Idiomas.Español);
                IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key.ToString(), AppController.Idiomas.Ingles), AppController.Idiomas.Ingles);
                IPgo.SetPlaceholder(info.Value.ToString());
                IPgo.HabilitarInput(false);
                inputsObligatorios.Add(IPgo);
                IPgo.SetKeyboardType(TouchScreenKeyboardType.Default);
                nombreActual = info.Value.ToString();
            }
            //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]);
            //idxColor++;
        }

        InputPrefabFecha IPGO = Instantiate(prefabInputFecha, parentTransform).GetComponent <InputPrefabFecha>();

        IPGO.gameObject.SetActive(true);
        IPGO.SetNombreCategoria("Fecha Nacimiento");
        IPGO.SetText("Fecha Nacimiento".ToUpper(), AppController.Idiomas.Español);
        IPGO.SetText("Date of Birth".ToUpper(), AppController.Idiomas.Ingles);
        IPGO.SetValorCategoria(infoJugador.GetFechaNac().ToShortDateString());
        IPGO.HabilitarInput(false);
        //listaPrefabs.Add(IPGO);
        inputFecha = IPGO;

        //IPGO.SetColor(coloresBotones[idxColor % coloresBotones.Count]);
        //idxColor++;
        //GO.transform.GetChild(0).GetComponent<Text>().text = "Fecha Nacimiento";
        //listaPrefabs.Add(GO);

        foreach (var info in infoJugador.GetInfoString())
        {
            InputPrefab IPgo = Instantiate(prefabInputInfo, parentTransform).GetComponent <InputPrefab>();
            IPgo.gameObject.SetActive(true);
            IPgo.SetNombreCategoria(info.Key.ToString());
            IPgo.SetText(info.Key.ToString().ToUpper(), AppController.Idiomas.Español);
            IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key.ToString(), AppController.Idiomas.Ingles), AppController.Idiomas.Ingles);
            IPgo.SetPlaceholder(info.Value.ToString());
            IPgo.HabilitarInput(false);
            IPgo.SetKeyboardType(TouchScreenKeyboardType.Default);
            inputsString.Add(IPgo);

            //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]);
            //idxColor++;
        }

        foreach (var info in infoJugador.GetInfoInt())
        {
            InputPrefab IPgo = Instantiate(prefabInputInfo, parentTransform).GetComponent <InputPrefab>();
            IPgo.gameObject.SetActive(true);
            IPgo.SetNombreCategoria(info.Key.ToUpper());
            IPgo.SetText(info.Key.ToUpper(), AppController.Idiomas.Español);
            IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key.ToString(), AppController.Idiomas.Ingles), AppController.Idiomas.Ingles);
            IPgo.SetPlaceholder(info.Value.ToString());
            IPgo.HabilitarInput(false);
            IPgo.SetKeyboardType(TouchScreenKeyboardType.NumberPad);
            inputsInt.Add(IPgo);

            if (IPgo.GetNombreCategoria() == "NUMERO CAMISETA")
            {
                numCamisetaActual = info.Value.ToString();
            }

            //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]);
            //idxColor++;
        }

        foreach (var info in infoJugador.GetInfoEspecial())
        {
            InputPrefabEspecial IPgo = Instantiate(prefabInputInfoEspecial, parentTransform).GetComponent <InputPrefabEspecial>();
            IPgo.gameObject.SetActive(true);
            IPgo.SetNombreCategoria(info.Key.ToString());
            IPgo.SetText(info.Key.ToString().ToUpper(), AppController.Idiomas.Español);
            IPgo.SetText(infoJugador.GetKeyInLaguage(info.Key.ToString(), AppController.Idiomas.Ingles), AppController.Idiomas.Ingles);
            IPgo.SetValor(infoJugador.GetSpecialValueInLanguage(info.Value.ToString(), AppController.Idiomas.Español), AppController.Idiomas.Español);
            IPgo.SetValor(infoJugador.GetSpecialValueInLanguage(info.Value.ToString(), AppController.Idiomas.Ingles), AppController.Idiomas.Ingles);
            IPgo.HabilitarInput(false);
            inputsEspecial.Add(IPgo);

            //IPgo.SetColor(coloresBotones[idxColor % coloresBotones.Count]);
            //idxColor++;
        }
    }
    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;
    }