Example #1
0
    void SaveValuesAndLoad()
    {
        //sets the default (for today it's empty string)
        if (string.IsNullOrEmpty(habitDailyCheckYesterday))
        {
            habitDailyCheckYesterday = OptionCodes.options[0];
        }
        if (string.IsNullOrEmpty(firstDailyCheckYesterday))
        {
            firstDailyCheckYesterday = OptionCodes.options[0];
        }
        if (string.IsNullOrEmpty(secondDailyCheckYesterday))
        {
            secondDailyCheckYesterday = OptionCodes.options[0];
        }

        //sets the results to playerprefs
        vM.SaveHabitCheck(habitDailyCheckToday, todayIndex);
        vM.SaveFirstCheck(firstDailyCheckToday, todayIndex);
        vM.SaveSecondCheck(secondDailyCheckToday, todayIndex);
        vM.SaveDailyNamesForTomorrow(todayIndex);

        if (yesterdayIndex >= 0)
        {
            vM.SaveHabitCheck(habitDailyCheckYesterday, yesterdayIndex);
            vM.SaveFirstCheck(firstDailyCheckYesterday, yesterdayIndex);
            vM.SaveSecondCheck(secondDailyCheckYesterday, yesterdayIndex);
        }

        //loads the next scene
        if (todayIndex >= 13 && string.IsNullOrEmpty(vM.GetNamesOfDayIndex(todayIndex)[1]))
        {
            FindObjectOfType <SceneLoader>().LoadSceneByName("Second Task");
        }
        else
        {
            FindObjectOfType <SceneLoader>().LoadSceneByName("Calendar");
        }
    }