using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class player : MonoBehaviour
{
public Text textxt;
private Save_Json_av sv = new Save_Json_av();
public decimal money = 0m;
void Awake()
{
if (PlayerPrefs.HasKey("sv_1"))
{
sv = JsonUtility.FromJson<Save_Json_av>(PlayerPrefs.GetString("sv_1"));
money = sv.money;
}
}
void Update()
{
textxt.text = money + "";
}
public void KrClick()
{
if (true)
{
money += 0.000000002m;
}
}
public void KrClick2()
{
if (true)
{
money += 0.10m;
}
}
private void OnApplicationPause()
{
Save();
}
private void OnApplicationQuit()
{
Save();
}
private void Save()
{
sv.money = money;
PlayerPrefs.SetString("sv_1", JsonUtility.ToJson(sv));
PlayerPrefs.Save();
}
}
[Serializable]
public class Save_Json_av
{
public decimal money;
}