coin backend start
This commit is contained in:
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
public class CoinCounter : MonoBehaviour
|
||||
{
|
||||
public ulong coin = 0;
|
||||
public ulong coin = 0; //szedje le db-bol a playerhez a coint
|
||||
|
||||
public void AddCoin(ulong number){
|
||||
coin += number;
|
||||
|
||||
@@ -87,6 +87,29 @@ public class DatabaseData : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private IEnumerator IGetPlayerCoins(string username){
|
||||
string uri = "http://localhost:3000/coinget";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "POST");
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+username+"}"); //palya id megadasa
|
||||
uwr.uploadHandler = (UploadHandler)new UploadHandlerRaw(jsonToSend); //felkuldi a palya id-t
|
||||
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
|
||||
uwr.SetRequestHeader("Content-Type", "application/json");
|
||||
|
||||
yield return uwr.SendWebRequest();
|
||||
|
||||
if (uwr.isNetworkError) {
|
||||
Debug.Log(uwr.error);
|
||||
} else {
|
||||
Debug.Log(uwr.downloadHandler.text);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private IEnumerator IPostNewPlayerData() {
|
||||
input.text = "loading...";
|
||||
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
public class WallCollision : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if(other.gameObject.tag == "Player"){
|
||||
Debug.Log("neki ment a falnak");
|
||||
Application.Quit();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user