示例#1
0
 // Returns 1 if this alarm is later than the other alarm, 0 if they are equal, and -1 if this one is earlier.
 public int CompareAlarmTimes(AlarmScript alarm2)
 {
     if (hour > alarm2.GetHour())
     {
         return(1);
     }
     if (hour == alarm2.GetHour())
     {
         if (minute > alarm2.GetMinute())
         {
             return(1);
         }
         else if (minute == alarm2.GetMinute())
         {
             return(0);
         }
     }
     return(-1);
 }
示例#2
0
    // Loads an alarm's values into the UI
    public void LoadAlarm(AlarmScript alarm)
    {
        editingMode = true;

        hourField.text   = "";
        minuteField.text = "";
        if (alarm.GetHour() < 10)
        {
            hourField.text += "0";
        }
        if (alarm.GetMinute() < 10)
        {
            minuteField.text += "0";
        }
        hourField.text   += alarm.GetHour().ToString();
        minuteField.text += alarm.GetMinute().ToString();
        for (int i = 0; i < weekdayButtons.Length; i++)
        {
            weekdayButtons[i].GetComponent <WeekdayButtonScript>().SetWeekday(alarm.GetWeekdayState(i));
        }
    }