コード例 #1
0
    void verPremios(int windowID)
    {
        GUI.Box(rectPremios [1], "<html><color=#000000>" + Diccionario.getPalabra("PREMIOS") + "</color></html>", btnOpciones.box);
        int contx = 0;
        int conty = 0;

        for (int i = 0; i < premios.Count; i++)
        {
            if (premios [i] [2].Equals("Si"))
            {
                GUI.DrawTexture(new Rect(rectPremios [2].x + (contx) * rectPremios [2].width / 3, rectPremios [2].y + (conty) * rectPremios [2].width / 3, rectPremios [2].width / 3, rectPremios [2].width / 6), (Texture2D)premios [i] [1]);
            }
            else
            {
                GUI.DrawTexture(new Rect(rectPremios [2].x + (contx) * rectPremios [2].width / 3, rectPremios [2].y + (conty) * rectPremios [2].width / 3, rectPremios [2].width / 3, rectPremios [2].width / 6), (Texture2D)oscurecer(premios [i] [1]));
            }
            contx++;
            if (contx >= 3)
            {
                contx = 0;
                conty++;
            }
        }
        if (GUI.Button(rectPremios [3], Diccionario.getPalabra("Atras"), btnOpciones.button))
        {
            botonActivado = 0;
        }
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (logueando)
     {
         error_sincro = sync.getErrorCode();
         if (error_sincro == 1)
         {
             SceneManager.LoadScene("MapaScene");
         }
         else if (error_sincro == -1)
         {
             if (cuenta)
             {
                 SceneManager.LoadScene("MapaScene");
             }
             else
             {
                 error     = Diccionario.getPalabra("Internet");
                 logueando = false;
             }
         }
         else if (error_sincro == -2)
         {
             error     = Diccionario.getPalabra("Login Incorrecto");
             logueando = false;
         }
         else if (error_sincro == -3)
         {
             error     = Diccionario.getPalabra("Datos Incorrectos");
             logueando = false;
         }
     }
 }
コード例 #3
0
 void verDescripcion(int windowID)
 {
     GUI.Box(rectOpciones [11], Diccionario.getPalabra("OBJETIVOS"), btnOpciones.label);
     GUI.Box(rectOpciones [12], datos ["descripcion"], btnOpciones.textField);
     if (GUI.Button(rectOpciones [13], Diccionario.getPalabra("Continuar"), btnOpciones.button))
     {
         opcionesOn  = !opcionesOn;
         descripcion = !descripcion;
     }
 }
コード例 #4
0
 void opciones(int windowID)
 {
     GUI.Box(rectOpciones [4], Diccionario.getPalabra("PAUSA"), btnOpciones.box);
     if (GUI.Button(rectOpciones [5], Diccionario.getPalabra("Continuar"), btnOpciones.button))
     {
         opcionesOn = !opcionesOn;
     }
     if (GUI.Button(rectOpciones [6], Diccionario.getPalabra("Reiniciar"), btnOpciones.button))
     {
         reiniciarNivel();
     }
     if (GUI.Button(rectOpciones [7], Diccionario.getPalabra("Abandonar"), btnOpciones.button))
     {
         Constantes.setSincronizar(true);
         Instantiate(Resources.Load <GameObject> ("Prefab/Mapa"));
         Destroy(this.gameObject);
     }
 }
コード例 #5
0
 void importarOpciones()
 {
     GUISkin[] skins = Resources.LoadAll <GUISkin> ("GUISkin/Opciones");
     for (int i = 0; i < skins.Length; i++)
     {
         if (skins [i].name == "pausaSkin")
         {
             btnPausa = skins [i];
         }
         else if (skins [i].name == "botonOpcionesSkin")
         {
             skins [i].button.fontSize = (int)Mathf.Min(rectOpciones [5].width, rectOpciones [5].height) / 3;
             skins [i].box.fontSize    = (int)Mathf.Min(rectOpciones [4].width, rectOpciones [4].height) / 2;
             btnOpciones = skins [i];
         }
         else if (skins [i].name == "fondoOpcionesSkin")
         {
             fondoOpciones = skins [i];
         }
     }
     if (datos != null && datos.ContainsKey("nombre"))
     {
         titulo = datos ["nombre"];
     }
     else
     {
         titulo = Diccionario.getPalabra("SIN TITULO");
     }
     if (datos != null && datos.ContainsKey("puntuacion_maxima"))
     {
         inicializarPuntuacion(Int32.Parse(datos ["puntuacion_maxima"]));
     }
     else
     {
         inicializarPuntuacion(6);
     }
     titleSkin = Resources.Load <GUISkin> ("GUISkin/Opciones/titleSkin");
     titleSkin.box.fontSize = (int)Mathf.Max(rectOpciones [1].width / titulo.Length, rectOpciones [1].height / titulo.Length);
     fondo            = gestorSQLite.obtenerFondo(Screen.width, Screen.height);
     puntuacionImagen = Resources.Load <GUISkin> ("GUISkin/Opciones/llaveSkin");
     toast            = Resources.Load <GUISkin> ("GUISkin/Opciones/toastSkin");
     fin = Resources.Load <GUISkin> ("GUISkin/Opciones/premioSkin");
 }
コード例 #6
0
 void verFin(int windowID)
 {
     if (puntuacion == 0)
     {
         GUI.Box(rectFin [2], Diccionario.getPalabra("Sin llave"), btnOpciones.label);
     }
     else
     {
         GUI.Box(rectFin [1], Diccionario.getPalabra("Con llave"), btnOpciones.label);
         if (premio != null)
         {
             GUIContent contenido = new GUIContent();
             contenido.text  = Diccionario.getPalabra("Con Premio");
             contenido.image = premio;
             GUI.Box(rectFin [3], contenido, fin.box);
         }
     }
     if (GUI.Button(rectFin [4], Diccionario.getPalabra("Continuar"), btnOpciones.button))
     {
         Constantes.setSincronizar(true);
         Instantiate(Resources.Load <GameObject> ("Prefab/Mapa"));
         Destroy(this);
     }
 }
コード例 #7
0
 void verOpciones(int windowID)
 {
     GUI.Box(rectOpciones [2], Diccionario.getPalabra("OPCIONES"), btnOpciones.box);
     if (GUI.Button(rectOpciones [3], Diccionario.getPalabra("Castellano"), btnOpciones.button))
     {
         PlayerPrefs.SetString("idioma", "castellano");
     }
     if (GUI.Button(rectOpciones [4], Diccionario.getPalabra("Euskera"), btnOpciones.button))
     {
         PlayerPrefs.SetString("idioma", "euskera");
     }
     if (GUI.Button(rectOpciones [5], Diccionario.getPalabra("Continuar"), btnOpciones.button))
     {
         botonActivado = 0;
     }
     if (GUI.Button(rectOpciones [6], Diccionario.getPalabra("Desconectar"), btnOpciones.button))
     {
         botonActivado = 4;
         cargando      = "";
         Sync sync = Sync.getSync();
         sync.setErrorCode(0);
         new Thread(new ThreadStart(sync.actualizarNube)).Start();
     }
 }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        cargando1 = Diccionario.getPalabra("Despertando");
        if (cargando1 == null || cargando1.Trim().Length == 0)
        {
            cargando1 = "Despertando";
        }
        cargando2 = "";
        sync      = Sync.getSync();
        int id_usuario = GestorSQLite.getGestorSQLite().obtenerUsuarioAcual();

        windowRect    = new Rect(Screen.width / 4, Screen.height / 7, Screen.width / 2, 5 * Screen.height / 7);
        windowSkin    = Resources.Load <GUISkin> ("GUISkin/Opciones/fondoOpcionesSkin");
        sincronizando = Resources.Load <GUISkin> ("GUISkin/Mapa/sincronizarSkin");
        campos        = Resources.Load <GUISkin> ("GUISkin/Login/camposSkin");
        botonSkin     = Resources.Load <GUISkin> ("GUISkin/Mapa/botonesSuperiorSkin");
        fondo         = Resources.Load <Texture2D> ("Images/fondo_login");
        if (id_usuario > 0 && !Constantes.getErrorDatos())
        {
            cuenta = true;
            try {
                sync.setId_Usuario(id_usuario);
                Thread t = new Thread(new ThreadStart(sync.sincronizacion));
                t.Start();
            } catch (Exception e) {
                Debug.Log(e);
                SceneManager.LoadScene("MapaScene");
            }
            logueando = true;
        }
        else if (Constantes.getErrorDatos())
        {
            error = Diccionario.getPalabra("Datos Incorrectos");
        }
        InvokeRepeating("cambioCargando", 1f, 1f);
    }
コード例 #9
0
ファイル: FraseCorrecta.cs プロジェクト: QuantVm/TFG
 protected override void OnGUI()
 {
     base.OnGUI();
     if (!base.opcionesOn)
     {
         GUI.Box(rectFondo, "", skin.window);
         for (int i = 0; i < listaDatos [pos] ["Opciones"].Count; i++)
         {
             GUILayout.BeginArea(rectTexto [i]);
             GUILayout.BeginHorizontal();
             if (mal [pos] == i)
             {
                 GUILayout.Box(i + ".", skin.textArea, GUILayout.ExpandWidth(false));
                 if (GUILayout.Button(listaDatos [pos] ["Opciones"] [i].ToString(), skin.textArea, GUILayout.ExpandWidth(false)))
                 {
                     seleccion [pos] = -1;
                 }
             }
             else
             {
                 if (seleccion [pos] == i)
                 {
                     GUILayout.Box(i + ".", skin.label, GUILayout.ExpandWidth(false));
                     if (GUILayout.Button(listaDatos [pos] ["Opciones"] [i].ToString(), skin.label, GUILayout.ExpandWidth(false)))
                     {
                         seleccion [pos] = -1;
                         mal [pos]       = -1;
                     }
                 }
                 else
                 {
                     GUILayout.Box(i + ".", skin.box, GUILayout.ExpandWidth(false));
                     if (GUILayout.Button(listaDatos [pos] ["Opciones"] [i].ToString(), skin.box, GUILayout.ExpandWidth(false)))
                     {
                         seleccion [pos] = i;
                         mal [pos]       = -1;
                     }
                 }
             }
             GUILayout.EndHorizontal();
             GUILayout.EndArea();
         }
         GUI.Box(rectImagen, (Texture2D)listaDatos [pos] ["Enunciado"] [0], skin.textField);
         if (pos == listaDatos.Count - 1)
         {
             if (comprobarCompleto() == -1)
             {
                 if (GUI.Button(rectBotones [1], Diccionario.getPalabra("Terminar"), skin.button))
                 {
                     pos = comprobarCorrecto();
                     if (pos == -1)
                     {
                         base.terminarJuego();
                         pos = 0;
                     }
                     else
                     {
                         base.restarPuntuacion();
                     }
                 }
             }
         }
         else
         {
             if (GUI.Button(rectBotones [1], Diccionario.getPalabra("Siguiente"), skin.button))
             {
                 pos++;
             }
         }
         if (pos != 0)
         {
             if (GUI.Button(rectBotones [0], Diccionario.getPalabra("Anterior"), skin.button))
             {
                 pos--;
             }
         }
         else
         {
             GUI.Box(rectBotones [0], Diccionario.getPalabra("Anterior"), skin.button);
         }
     }
 }
コード例 #10
0
ファイル: Seleccion.cs プロジェクト: QuantVm/TFG
    protected override void OnGUI()
    {
        base.OnGUI();
        if (!base.opcionesOn)
        {
            GUILayout.BeginArea(rectArea);
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(rectArea.width),
                                                       GUILayout.Height(rectArea.height), GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false));
            for (int i = 0; i < listaDatos.Count; i++)
            {
                GUILayout.BeginVertical(skin.window);
                GUILayout.Space(alturaScroll);
                GUILayout.BeginHorizontal();
                GUILayout.Space(anchuraScroll);
                GUILayout.Box(listaDatos [i] ["Enunciado"] [0].ToString(), skin.toggle, GUILayout.Width(3 * (datos.Count - 1) * anchuraScroll), GUILayout.Height(alturaScroll));
                GUILayout.EndHorizontal();
                GUILayout.Space(alturaScroll);
                GUILayout.BeginHorizontal();
                GUILayout.Space(anchuraScroll);
                for (int j = 0; j < listaDatos [i] ["Opciones"].Count; j++)
                {
                    if (seleccion [i] == j)
                    {
                        if (GUILayout.Button((Texture2D)listaDatos [i] ["Opciones"] [j], skin.textField, GUILayout.Width(2 * anchuraScroll), GUILayout.Height(3 * alturaScroll)))
                        {
                            seleccion [i] = -1;
                        }
                    }
                    else if (mal [i] == j)
                    {
                        if (GUILayout.Button((Texture2D)listaDatos [i] ["Opciones"] [j], skin.label, GUILayout.Width(2 * anchuraScroll), GUILayout.Height(3 * alturaScroll)))
                        {
                            seleccion [i] = j;
                            mal [i]       = -1;
                        }
                    }
                    else
                    {
                        if (GUILayout.Button((Texture2D)listaDatos [i] ["Opciones"] [j], skin.box, GUILayout.Width(2 * anchuraScroll), GUILayout.Height(3 * alturaScroll)))
                        {
                            seleccion [i] = j;
                            mal [i]       = -1;
                        }
                    }
                    GUILayout.Space(anchuraScroll);
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(alturaScroll);
                GUILayout.EndVertical();
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            if (comprobarCompleto() == -1)
            {
                if (GUI.Button(rectBotonComprobar, Diccionario.getPalabra("Comprobar"), skin.button))
                {
                    int error = comprobarErrores();
                    if (error == -1)
                    {
                        base.terminarJuego();
                    }
                    else
                    {
                        scrollPosition.y = (rectArea.height + alturaScroll - 20) * error;
                        pos = error;
                        base.restarPuntuacion();
                    }
                }
            }
        }
    }
コード例 #11
0
 void verDesconectar(int windowID)
 {
     GUI.Box(rectSincronizando [1], Diccionario.getPalabra("Desconectando") + cargando, sincronizando.box);
 }
コード例 #12
0
 void verSincronizar(int windowID)
 {
     GUI.Box(rectSincronizando [1], Diccionario.getPalabra("Cargando_Energia") + cargando, sincronizando.box);
 }
コード例 #13
0
    void OnGUI()
    {
        if (imagenMapas != null)
        {
            scrollPosition = GUI.BeginScrollView(new Rect(0, 0, Screen.width, Screen.height), scrollPosition, new Rect(0, rectMapas [rectMapas.Length - 1].y, Screen.width, Screen.height * rectMapas.Length), false, false, GUIStyle.none, GUIStyle.none);
            for (int i = 0; i < rectMapas.Length - 1; i++)
            {
                GUI.BeginGroup(rectMapas [i]);
                GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), imagenMapas [i]);
                if (i != 0)
                {
                    GUI.DrawTexture(new Rect(0, Screen.height - 50, Screen.width, 50), muralla);
                }

                if (botonActivado < 2)
                {
                    for (int j = 0; botones [i].ContainsKey("botones_" + j); j++)
                    {
                        if (botones [i] ["botones_" + j] [2].Equals("Actual"))
                        {
                            if (GUI.Button((Rect)botones [i] ["botones_" + j] [1], "", botonesSkin.box))
                            {
                                GameObject game = Resources.Load <GameObject> ("Prefab/Minijuegos/" + constantes.getMinijuego((int)botones [i] ["botones_" + j] [3]));
                                game = Instantiate(game, this.transform.position, game.transform.rotation);
                                game.GetComponent <Minijuego> ().setInformacion((int)botones [i] ["botones_" + j] [3], id_mapas [i], pos_mapas [i], (int)botones [i] ["botones_" + j] [0]);
                                Destroy(this.gameObject);
                            }
                        }
                        else if (botones [i] ["botones_" + j] [2].Equals("Futuro"))
                        {
                            GUI.Box((Rect)botones [i] ["botones_" + j] [1], "", botonesSkin.label);
                        }
                        else if (botones [i] ["botones_" + j] [2].Equals("Pasado"))
                        {
                            GUI.Box((Rect)botones [i] ["botones_" + j] [1], "", botonesSkin.button);
                        }
                    }
                }
                GUI.EndGroup();
            }
            GUI.BeginGroup(rectMapas [rectMapas.Length - 1]);
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), niebla);
            GUI.DrawTexture(new Rect(0, Screen.height - muralla.height, Screen.width, muralla.height), muralla);
            GUI.EndGroup();
            GUI.EndScrollView();
            if (botonActivado == 0)
            {
                if (GUI.Button(rectMenuSuperior [0], Diccionario.getPalabra("Opciones"), botonesSuperior.box))
                {
                    botonActivado = 1;
                }
                if (GUI.Button(rectMenuSuperior [1], Diccionario.getPalabra("Premios"), botonesSuperior.box))
                {
                    botonActivado = 2;
                }
            }
            switch (botonActivado)
            {
            case 1:
                GUI.Box(rectOpciones [0], "", fondoOpciones.button);
                GUI.Window(1, rectOpciones [1], verOpciones, "", fondoOpciones.box);
                break;

            case 2:
                GUI.Box(rectOpciones [0], "", fondoOpciones.button);
                GUI.Window(2, rectPremios [0], verPremios, "", fondoBlanco.box);
                break;

            case 3:
                GUI.Box(rectOpciones [0], "", fondoOpciones.button);
                GUI.Window(3, rectSincronizando [0], verSincronizar, "", fondoOpciones.box);
                break;

            case 4:
                GUI.Box(rectOpciones [0], "", fondoOpciones.button);
                GUI.Window(3, rectSincronizando [0], verDesconectar, "", fondoOpciones.box);
                break;
            }
        }
    }
コード例 #14
0
 void OnGUI()
 {
     GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), fondo);
     GUI.Label(new Rect(Screen.width / 5, Screen.height / 4, Screen.width / 4, Screen.height / 7), Diccionario.getPalabra("Usuario"), campos.box);
     user = GUI.TextField(new Rect(Screen.width / 2, Screen.height / 4, Screen.width / 3, Screen.height / 7), user, 50, campos.textField);
     GUI.Label(new Rect(Screen.width / 5, 3 * Screen.height / 7, Screen.width / 4, Screen.height / 7), Diccionario.getPalabra("Contrasena"), campos.box);
     password = GUI.PasswordField(new Rect(Screen.width / 2, 3 * Screen.height / 7, Screen.width / 3, Screen.height / 7), password, '*', 50, campos.textField);
     if (GUI.Button(new Rect(Screen.width / 4, 4 * Screen.height / 6, Screen.width / 2, Screen.height / 7), Diccionario.getPalabra("Entrar"), botonSkin.box))
     {
         logueando = true;
         sync.setUsuario(user);
         sync.setContrasena(password);
         Thread t = new Thread(new ThreadStart(sync.login));
         t.Start();
     }
     if (!error.Equals(""))
     {
         GUI.Box(new Rect(Screen.width / 4, Screen.height / 5, Screen.width / 2, Screen.height / 21), error, campos.label);
     }
     if (logueando)
     {
         GUI.Window(1, windowRect, window, "", windowSkin.box);
     }
 }