using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonVK : MonoBehaviour
{
private int score = 1;
public Text button;
private int balance;
void Start(){
if (!PlayerPrefs.HasKey("balance")){
PlayerPrefs.SetInt("balance", 0);
}
balance = PlayerPrefs.GetInt("balance");
button.text = balance.ToString();
}
void OnMouseDown (){
transform.localScale = new Vector3 (transform.localScale.x / 1.005f, transform.localScale.y / 1.005f, transform.localScale.z / 1.005f);
}
void OnMouseUp (){
transform.localScale = new Vector3 (transform.localScale.x * 1.005f, transform.localScale.y * 1.005f, transform.localScale.z * 1.005f);
}
void OnMouseUpAsButton (){
balance = (balance + score);
PlayerPrefs.SetInt("balance", balance);
balance = PlayerPrefs.GetInt("balance");
button.text = balance.ToString();
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonVK : MonoBehaviour
{
private int score = 1;
public Text button;
private int balance;
private int save;
void Start(){
if (!PlayerPrefs.HasKey("balance")){
PlayerPrefs.SetInt("balance", 0);
PlayerPrefs.Save();
}
save = PlayerPrefs.GetInt("balance");
}
void OnMouseDown (){
transform.localScale = new Vector3 (transform.localScale.x / 1.005f, transform.localScale.y / 1.005f, transform.localScale.z / 1.005f);
}
void OnMouseUp (){
transform.localScale = new Vector3 (transform.localScale.x * 1.005f, transform.localScale.y * 1.005f, transform.localScale.z * 1.005f);
}
void OnMouseUpAsButton (){
balance = (balance + score);
PlayerPrefs.SetInt("balance", balance);
PlayerPrefs.Save();
}
void OnApplicationQuit(){
PlayerPrefs.SetInt("balance", balance);
PlayerPrefs.Save();
}
void Update(){
PlayerPrefs.SetInt("balance", balance);
PlayerPrefs.Save();
save = PlayerPrefs.GetInt("balance");
button.text = save.ToString();
}
}