This commit is contained in:
2023-05-04 12:56:56 +02:00
parent b94c80b293
commit 2f0ae77e35
5 changed files with 113 additions and 87 deletions

View File

@@ -21,10 +21,16 @@ public class DatabaseData : MonoBehaviour
public ulong coins = 0;
private string url;
private bool forceLocalUrl = true;
private const int PORT = 24002;
#if UNITY_EDITOR || UNITY_EDITOR_64
private string url = "http://localhost:" + PORT.ToString();
#else
private string url = "http://nodejs.dszcbaross.edu.hu:" + PORT.ToString();
#endif
private void Awake() {
hst = FindObjectOfType<HighScoreTable>(); //High Score Table referencia
htdc = new HighScoreTableDataContainer(); //High Score Table Container objektum
@@ -32,21 +38,20 @@ public class DatabaseData : MonoBehaviour
coinc = FindObjectOfType<CoinCounter>();
//writer = new StreamWriter(Application.persistentDataPath + "/coins.txt", false, Encoding.Default);
if((Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.OSXEditor) && forceLocalUrl){
/*if((Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.OSXEditor) && forceLocalUrl){
//ha az editorba van
url = "http://localhost:" + PORT.ToString();
}else if(!forceLocalUrl){
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
}else{
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
}
}*/
//url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
url = "http://nodejs.dszcbaross.edu.hu:" + PORT.ToString();
}
private void Start() {
GetHighScoreData();
//StartCoroutine(GetCoinData(1));
GetHighScoreData(); //highscore scenehez
}
public void jsonParser(string jsondata) { //beerkezo json adat eltarolasa