コード例 #1
0
        // Start is called before the first frame update
        void Start()
        {
            dateText.GetComponent <TMP_Text>().text = System.DateTime.Now.Month + "/" + System.DateTime.Now.Day + "/" + System.DateTime.Now.Year;
            //Init vars
            tempBillSaveArray = new string[4];
            editCheck         = false;
            //load bills into list
            if (ES_Save.Exists("UserData.src"))
            {
                billz = ES_Save.Load <List <string[]> >("Userdata.src");
                foreach (string[] bill in billz)
                {
                    tempBill = null;
                    tempBill = Instantiate(billObjPrefab, billContainer.transform);
                    tempBill.GetComponent <BillObj>().PopulateBillInfo(bill[0], int.Parse(bill[1]), float.Parse(bill[2]), float.Parse(bill[3]));
                    bills.Add(tempBill.GetComponent <BillObj>());
                }
            }
            else
            {
                Debug.Log("No Save Data ");
            }

            TotalBills();
        }
コード例 #2
0
ファイル: ES_Demo.cs プロジェクト: JacobBoyce/Money-Tracker
 public void Save()
 {
     if (!text || !knob)
     {
         return;
     }
     // Saves the value of the text component.
     ES_Save.Save(text.text, "test string");
     ES_Save.SaveTransform(transform, "test transform");
     ES_Save.SaveRectTransform(knob, "test rect transform");
     ES_Save.Save(knobX.value, "test x");
     ES_Save.Save(knobY.value, "test y");
 }
コード例 #3
0
ファイル: ES_Demo.cs プロジェクト: JacobBoyce/Money-Tracker
 public void Load()
 {
     if (!text || !knob || !knobX || !knobY)
     {
         return;
     }
     // Loads the saved value of the text component.
     text.text = ES_Save.Load <string>("test string");
     // Requests to load the saved transform data, which will load on the next LateUpdate call to the ES_Save GameObject, if there is one. Otherwise nothing will happen.
     ES_Save.LoadTransform(transform, "test transform");
     ES_Save.LoadRectTransform(knob, "test rect transform");
     knobX.value = ES_Save.Load <float>("test x");
     knobY.value = ES_Save.Load <float>("test y");
 }
コード例 #4
0
        public void SaveBillList()
        {
            billz.Clear();
            foreach (BillObj bil in bills)
            {
                tempBillSaveArray = new string[4];

                tempBillSaveArray[0] = bil.bNameObj.text;
                tempBillSaveArray[1] = bil.bDueObj.text;
                tempBillSaveArray[2] = bil.totalAmountText.text;
                tempBillSaveArray[3] = bil.totalSavedText.text;
                billz.Add(tempBillSaveArray);
            }
            ES_Save.Save(billz, "UserData.src");
        }
コード例 #5
0
ファイル: Seperator.cs プロジェクト: JacobBoyce/Money-Tracker
    public void UpdateAfter()
    {
        totalAdded = 0;
        inAmount = float.Parse(inF.text);
        sepaSaveList.Clear();
        //deactivate erromsg obj
        errorMSGObj.SetActive(false);
        errorOn = false;
        

        //ERROR CHECK
        foreach(GameObject sepa in sepaList)
        {
            if(sepa.transform.Find("AmountTag").gameObject.GetComponent<TMP_InputField>().text.Equals("") || sepa.transform.Find("NameTag").gameObject.GetComponent<TMP_InputField>().text.Equals(""))
            {
                //seterror message active the set message
                errorMSGObj.SetActive(true);
                errorMsg = "Please enter all titles and amounts";
                errorMSGObj.GetComponent<TMP_Text>().text = errorMsg;
                errorOn = true;
            }
        }

        if(errorOn == false)
        {
            foreach(GameObject sepa in sepaList)
            {
                tempSepaSaveArray = new string[2];
                tempSepaSaveArray[0] = sepa.transform.Find("NameTag").gameObject.GetComponent<TMP_InputField>().text;
                tempSepaSaveArray[1] = sepa.transform.Find("AmountTag").gameObject.GetComponent<TMP_InputField>().text;

                sepaSaveList.Add(tempSepaSaveArray);
                
                totalAdded += float.Parse(sepa.transform.Find("AmountTag").gameObject.GetComponent<TMP_InputField>().text);
            }

            ES_Save.Save(sepaSaveList, "UserdataSepa.src");

            totalAdded =  inAmount - totalAdded;
            totalAdded = (float)Math.Round(totalAdded, 3);
            outF.text = totalAdded.ToString();

            infoutf[0] = inF.text;
            infoutf[1] = outF.text;
            ES_Save.Save(infoutf, "UserDataSepaBigVal.src");
        }
    }
コード例 #6
0
ファイル: Seperator.cs プロジェクト: JacobBoyce/Money-Tracker
    void Start()
    {
        tempSepaSaveArray = new string[2];
        infoutf = new string[2];
        sepaList.Clear();
        sepaSaveList.Clear();
        errorOn = false;

        if(ES_Save.Exists("UserDataSepa.src"))
        {
            sepaSaveList = ES_Save.Load<List<string[]>>("UserdataSepa.src");
            foreach(string[] sepa in sepaSaveList)
            {
                tempSepa = null;
                tempSepa = Instantiate(sepaPrefab, sepaContainer.transform);
                Debug.Log(sepa[0] + "  " + sepa[1]);
                tempSepa.transform.Find("NameTag").gameObject.GetComponent<TMP_InputField>().text = sepa[0];
                tempSepa.transform.Find("AmountTag").gameObject.GetComponent<TMP_InputField>().text = sepa[1];
                sepaList.Add(tempSepa);
            }
        }
        else
        {
            Debug.Log("No Save Data UserdataSepa");
        }

        if(ES_Save.Exists("UserDataSepaBigVal.src"))
        {
            infoutf = ES_Save.Load<string[]>("UserDataSepaBigVal.src");
            //load inf and outf
            inF.text = infoutf[0];
            outF.text = infoutf[1];
        }
        else
        {
            Debug.Log("No Save Data UserDataSepaBigVal");
        }
    }
コード例 #7
0
        public void SaveBillCheck()
        {
            if (bNameIF.text == "")
            {
                errorMsg.gameObject.SetActive(true);
                errorMsg.text = "Please enter a name for the bill";
            }
            else if (bTAmountIF.text == "")
            {
                errorMsg.gameObject.SetActive(true);
                errorMsg.text = "Please enter a total amount for the bill";
            }
            else if (bAmountSavedIF.text == "")
            {
                errorMsg.gameObject.SetActive(true);
                errorMsg.text = "Please enter an amount saved so far for the bill";
            }
            else if (float.Parse(bTAmountIF.text) < float.Parse(bAmountSavedIF.text))
            {
                errorMsg.gameObject.SetActive(true);
                errorMsg.text = "Please enter a saved amount that is smaller than total amount";
            }
            else
            {
                if (editCheck == false)
                {
                    tempBill = null;
                    tempBill = Instantiate(billObjPrefab, billContainer.transform);
                    tempBill.GetComponent <BillObj>().PopulateBillInfo(bNameIF.text, bDueDD.value + 1, float.Parse(bTAmountIF.text), float.Parse(bAmountSavedIF.text));

                    tempBillSaveArray = new string[4];

                    tempBillSaveArray[0] = bNameIF.text;
                    tempBillSaveArray[1] = (bDueDD.value + 1).ToString();
                    tempBillSaveArray[2] = bTAmountIF.text;
                    tempBillSaveArray[3] = bAmountSavedIF.text;
                    billz.Add(tempBillSaveArray);

                    bills.Add(tempBill.GetComponent <BillObj>());
                    addEditPanel.SetActive(false);
                    TotalBills();
                    ES_Save.Save(billz, "UserData.src");
                }
                else
                {
                    selectedBill.PopulateBillInfo(bNameIF.text, bDueDD.value + 1, float.Parse(bTAmountIF.text), float.Parse(bAmountSavedIF.text));
                    billz.Clear();

                    foreach (BillObj bill in bills)
                    {
                        tempBillSaveArray = new string[4];

                        tempBillSaveArray[0] = bill.bNameObj.text;
                        tempBillSaveArray[1] = bill.bDueObj.text;
                        tempBillSaveArray[2] = bill.totalAmountText.text;
                        tempBillSaveArray[3] = bill.totalSavedText.text;
                        billz.Add(tempBillSaveArray);
                    }
                    editCheck = false;
                    addEditPanel.SetActive(false);
                    TotalBills();
                    ES_Save.Save(billz, "UserData.src");
                }
            }
        }