Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ScoreBoard : MonoBehaviour
- {
- bool Nombre = false;
- public Text texto;
- // Start is called before the first frame update
- void Start()
- {
- StartCoroutine(IEScoreBoard());
- }
- IEnumerator IEScoreBoard()
- {
- //Mandamos información
- WWW getData = new WWW("https://arjierdagames.com/games_database/Test/best.php");
- //Esperamos recibir respuesta
- yield return getData;
- print(getData.text); // Avanza hasta que ya recibio algo
- if(!string.IsNullOrEmpty(getData.error) && getData.error.Contains("Could not resolve host"))
- {
- //Si hubo error de conexion, nos detenemos y salimos
- StopAllCoroutines();
- yield return null;
- }
- for(int i = 0; i < getData.text.Length; i++)
- {
- if(getData.text[i] != '■')
- {
- texto.text += getData.text[i];
- }
- else if(Nombre)
- {
- texto.text += '\n';
- Nombre = false;
- }
- else
- {
- texto.text += ' ';
- Nombre = true;
- }
- }
- //Si llegamos a este punto, todo va bien :D
- if(getData.text == "0")
- {
- print("Mejora tus puntos inepto");
- }
- else
- {
- print("Nuevo record registrado");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement