void ShouldShowBlocksForYesterday() { var values = vM.GetValuesOfIndex(yesterdayIndex); if (!string.IsNullOrEmpty(values[0])) { DiscolorBlock(yesterdayFirstBlock, values[0]); firstDailyCheckYesterday = values[0]; } if (!string.IsNullOrEmpty(values[1])) { DiscolorBlock(yesterdaySecondBlock, values[1]); secondDailyCheckYesterday = values[1]; } if (!string.IsNullOrEmpty(values[2])) { DiscolorBlock(yesterdayHabitBlock, values[2]); habitDailyCheckYesterday = values[20]; } if (!string.IsNullOrEmpty(values[0]) && !string.IsNullOrEmpty(values[1]) && !string.IsNullOrEmpty(values[2])) { yesterdayTitle.color = Colors.disabledRedText; } }
void CalculateCalendar() { int calendarIndex = GetCalendarIndex(); var weekToShow = calendars[calendarIndex]; //show weekly task gameobject ShowWeeklyTask(calendarIndex); for (int i = 0; i < weekToShow.Length; i++) { //colors Color32 incompleteColor = Colors.incompleteColor; Color32 invisibleColor = Colors.invisibleColor; Color32 completeColor = Colors.completeColor; Color32 failedColor = Colors.toggleGrayColor; var cur = weekToShow[i]; var curButton = cur.GetComponent <Button>(); int curDateNumber = currentDayIndex + 1; //0 is day text, 1 is the first check, 2 is the second, 3 is the underline TextMeshProUGUI[] arrayOfTMs = cur.GetComponentsInChildren <TextMeshProUGUI>(); int dayInArr = (weekIndex * 7) + i; //current day in loop - array number == zero based int dayGlobal = dayInArr + 1; //current day in loop = 1 based number cur.text = dayGlobal.ToString(); //set up regular properties arrayOfTMs[3].color = invisibleColor; //colors the underline color -- its invisible arrayOfTMs[0].color = invisibleColor; //this only makes it invisible --need to figure out how to disable it curButton.enabled = false; //this disables the button component for all days(makes them unclickable) //-- only the present and past days will be active (visible, clickable), thanks to the fragment right below //set for today and all days before today if (dayGlobal <= curDateNumber) { arrayOfTMs[0].color = incompleteColor; curButton.enabled = true; //enable the button component for current day and days before } //set for today if (dayGlobal == curDateNumber) { //indicate this is the current day arrayOfTMs[3].color = incompleteColor; } //gets values for the current day in loop string[] stringValues = vM.GetValuesOfIndex(dayInArr); //0 is firstcheck, 1 is secondcheck and 2 is habitcheck //sets the default - if the value is "" then the dot won't be visible arrayOfTMs[1].text = stringValues[0]; //sets the first daily check arrayOfTMs[2].text = stringValues[1]; //sets the second daily check //colors first daily checks if (stringValues[0] == "S") //checks first daily check value { //the index after getcomponents is +1 because the first TextMeshPro component is the day number(current one) arrayOfTMs[1].text = "."; arrayOfTMs[1].color = completeColor; } else if (stringValues[0] == "F") { arrayOfTMs[1].text = "."; arrayOfTMs[1].color = failedColor; } //colors second daily checks if (stringValues[1] == "S") //checks second daily check value { //the index after getcomponents is +1 because the first TextMeshPro component is the day number(current one) arrayOfTMs[2].text = "."; arrayOfTMs[2].color = completeColor; } else if (stringValues[1] == "F") { arrayOfTMs[2].text = "."; arrayOfTMs[2].color = failedColor; } //colors days and underline if (stringValues[2] == "S") { cur.color = completeColor; //colors underline only if its the current date if (dayGlobal == curDateNumber) { arrayOfTMs[3].color = completeColor; } } if (stringValues[2] == "F") { cur.color = failedColor; //colors underline only if its the current date if (dayGlobal == curDateNumber) { arrayOfTMs[3].color = failedColor; } } //show score Image[] stars = cur.GetComponentsInChildren <Image>(); var levelResult = PlayerPrefs.GetInt("scoreDay" + dayGlobal.ToString(), 0); if (levelResult == 0) { foreach (Image star in stars) { star.gameObject.SetActive(false); } } else if (levelResult == 1) { stars[0].gameObject.SetActive(true); stars[1].gameObject.SetActive(false); stars[2].gameObject.SetActive(false); } else if (levelResult == 2) { stars[0].gameObject.SetActive(true); stars[1].gameObject.SetActive(true); stars[2].gameObject.SetActive(false); } else if (levelResult == 3) { foreach (Image star in stars) { star.gameObject.SetActive(true); } } } }