Beispiel #1
0
 public void GetMonthData()
 {
     //check month from button to load items
     foreach (Structs.MonthStats ms in loadedData.Data)
     {
         if (ms.month == curMonth && ms.year == curYear)
         {
             selectedMonth = ms;
         }
     }
     //TODO handle if selectedMonth = null
 }
Beispiel #2
0
 void Start()
 {
     nav             = GetComponent <Navigation>();
     listMngr        = listPanel.GetComponent <ListManager>();
     welcomeNewMonth = GetComponent <NewMonth>();
     curMonth        = DateTime.Now.ToString("MMMM");
     curYear         = DateTime.Now.Year.ToString();
     loadedData      = LoadData();
     GetComponent <Predictions>().CheckIfThereIsDictionaryInData(loadedData);
     CheckForCurMonth();
     monthButton.GetComponentInChildren <Text>().text = curMonth + " " + curYear;
     if (loadedData.Data.Count > 0)
     {
         selectedMonth = loadedData.Data[loadedData.Data.Count - 1];
     }
     BalanceButton();
 }
Beispiel #3
0
    Structs.MonthStats TransferPreviousMonthValues(Structs.MonthStats stats)
    {
        List <Structs.MoneyEntry> incList = TransferValues(stats.income);
        List <Structs.MoneyEntry> expList = TransferValues(stats.standarExpenses);



        Structs.MonthStats newMonth = new Structs.MonthStats()
        {
            month           = gameManager.curMonth,
            year            = gameManager.curYear,
            income          = incList,
            standarExpenses = expList,
            randomExpenses  = new List <Structs.MoneyEntry>(),
            balance         = stats.balance + CalcPreviousMonthBalance(stats),
            avgBalance      = stats.balance + CalcPreviousMonthBalance(stats, true)
        };
        return(newMonth);
    }
Beispiel #4
0
 float CalcPreviousMonthBalance(Structs.MonthStats stats, bool avg_balance = false)
 {
     return(gameManager.SumListItems(stats.income) - gameManager.SumListItems(stats.standarExpenses) - gameManager.SumListItems(stats.randomExpenses, avg_balance));
 }
Beispiel #5
0
 public Structs.MonthStats WelcomeNewMonth(Structs.MonthStats stats)
 {
     Start();
     return(TransferPreviousMonthValues(stats));
 }