using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class NumPad : MonoBehaviour { public Text[] txtR,txtN; int[] CNum = new int[4]; public Sprite[] sprNum; public Button[] btnNum; public int iKeyIn=0; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void PressNum(int no) { if (iKeyIn <= 3) { txtN [iKeyIn].text = no.ToString (); btnNum [no].image.sprite = sprNum[no*2+1]; btnNum [no].enabled=false; iKeyIn++; } } public void PressBS() { int no; if (iKeyIn > 0) { iKeyIn--; no = int.Parse (txtN [iKeyIn].text); Debug.Log(no.ToString()); btnNum [no].image.sprite = sprNum[no*2]; btnNum [no].enabled=true; txtN [iKeyIn].text = ""; } } }