commit1e4ffae4f6Author: bance <90307762+bance23@users.noreply.github.com> Date: Sat May 13 14:23:47 2023 +0200 proba athozas veszelyes commit0297a2cb78Merge:604088e31b9214Author: bance <90307762+bance23@users.noreply.github.com> Date: Sat May 13 14:09:48 2023 +0200 Merge branch 'master' of https://github.com/playmaker1210/PuzzleColorBall commit31b9214f35Merge:184d2e889976bbAuthor: Playmaker1210 <hatvanitamas09@gmail.com> Date: Mon May 8 14:42:34 2023 +0200 Merge https://github.com/playmaker1210/PuzzleColorBall commit184d2e84daAuthor: Playmaker1210 <hatvanitamas09@gmail.com> Date: Mon May 8 14:41:59 2023 +0200 server mukodik commit89976bbcf8Author: playmaker1210 <75033623+playmaker1210@users.noreply.github.com> Date: Fri May 5 12:49:28 2023 +0200 Update README.md commit250cc0ffeeAuthor: playmaker1210 <75033623+playmaker1210@users.noreply.github.com> Date: Fri May 5 12:49:01 2023 +0200 Create README.md commit2f0ae77e35Author: playmaker1210 <hatvanitamas09@gmail.com> Date: Thu May 4 12:56:56 2023 +0200 update commitb94c80b293Author: Playmaker1210 <hatvanitamas09@gmail.com> Date: Tue May 2 13:46:38 2023 +0200 coin db working commit25d792e0fdAuthor: playmaker1210 <hatvanitamas09@gmail.com> Date: Sat Apr 29 17:07:23 2023 +0200 update
67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
public class CoinCounter : MonoBehaviour
|
|
{
|
|
public ulong coin; //szedje le db-bol a playerhez a coint
|
|
public TMP_Text coinCounterUI;
|
|
private string path;
|
|
private StreamWriter writer;
|
|
private StreamReader reader;
|
|
|
|
private DatabaseData db;
|
|
private UsernameHandler usernameHandler;
|
|
|
|
private void Awake() {
|
|
db = FindObjectOfType<DatabaseData>();
|
|
usernameHandler = FindObjectOfType<UsernameHandler>();
|
|
|
|
|
|
/*path = Application.persistentDataPath + "/coins.txt";
|
|
|
|
if(!File.Exists(path)){ //ha nincs meg ilyen fajl hozza letre
|
|
writer = new StreamWriter(path, false, Encoding.Default);
|
|
writer.Write(0);
|
|
writer.Close();
|
|
}
|
|
|
|
reader = new StreamReader(path);
|
|
coin = ulong.Parse(reader.ReadLine());
|
|
reader.Close();
|
|
Debug.Log("Coins at start: " + coin);*/
|
|
|
|
/*Debug.Log("coin 1: " + coin);
|
|
coin = db.GetCoins(1);
|
|
Debug.Log("itt van coin");
|
|
Debug.Log("coin 2: " + coin);
|
|
coinCounterUI.text = "Coins: " + coin.ToString();*/
|
|
}
|
|
|
|
public void SetCoin(ulong number){
|
|
coin = number;
|
|
coinCounterUI.text = "Coins: " + coin.ToString();
|
|
}
|
|
|
|
public void AddCoin(ulong number){
|
|
coin += number;
|
|
coinCounterUI.text = "Coins: " + coin.ToString();
|
|
|
|
/*writer = new StreamWriter(path, false, Encoding.Default);
|
|
writer.Write(coin);
|
|
writer.Close();*/
|
|
}
|
|
|
|
public void RemoveCoin(ulong number){
|
|
coin -= number;
|
|
coinCounterUI.text = "Coins: " + coin.ToString();
|
|
|
|
/*writer = new StreamWriter(path, false, Encoding.Default);
|
|
writer.Write(coin);
|
|
writer.Close();*/
|
|
}
|
|
}
|