示例#1
0
 //retrieves trigger from TriggerListControl for script to display
 public void SetTriggerClass(TriggerClassSort newTriggerObject)
 {
     triggerObject = newTriggerObject;
     SetHour(newTriggerObject.hour);
     SetMinute(newTriggerObject.minute);
     SetDate(newTriggerObject.day);
     SetActive(newTriggerObject.active);
 }
示例#2
0
    //instantiates each trigger in order into the scrollable list
    private void createTriggerButton(TriggerClassSort trigger)
    {
        GameObject button = Instantiate(buttonTemplate) as GameObject;

        button.SetActive(true);
        button.GetComponent <TriggerListButton>().SetTriggerClass(trigger);
        button.transform.SetParent(buttonTemplate.transform.parent, false);
        AllTimeDateButtons.Add(button);
    }
    public bool compareTime(TriggerClassSort compareTrigger)
    {
        string curClassTime   = hour + minute;
        string otherClassTime = compareTrigger.hour + compareTrigger.minute;

        if (int.Parse(curClassTime) > int.Parse(otherClassTime))
        {
            return(true);
        }
        return(false);
    }
示例#4
0
    //removes a trigger from the list displayed - deleting a trigger button
    public void DeleteTrigger(TriggerClassSort triggerToDelete)
    {
        AllClassTriggers.RemoveAt(triggerToDelete.index);

        //all following index, reduce their index by one and disp
        for (int i = triggerToDelete.index; i < AllClassTriggers.Count; i++)
        {
            AllClassTriggers[i].index -= 1;
        }

        DispTriggers();
    }
示例#5
0
    //this function is called for each trigger from the "GetPrefsEditNotification" - if edit
    //creates a trigger to place in list
    public void addTriggerTime(string hourString, string minuteString, string dateString, int active)
    {
        TriggerClassSort newTrigger = new TriggerClassSort();

        newTrigger.hour   = hourString;
        newTrigger.minute = minuteString;
        newTrigger.day    = dateString;
        newTrigger.active = active;
        newTrigger.index  = AllClassTriggers.Count;

        AllClassTriggers.Add(newTrigger);

        DispTriggers();
    }
示例#6
0
 //sorts all triggers by inserting the trigger into the correct place
 private void sortTriggers(TriggerClassSort insertItem, string day)
 {
     if (insertItem.day == day)
     {
         for (int k = 0; k < tempSortedList.Count; k++)
         {
             if (tempSortedList[k].compareTime(insertItem))
             {
                 tempSortedList.Insert(k, insertItem);
                 return;
             }
         }
         tempSortedList.Add(insertItem);
     }
 }