Esempio n. 1
0
    internal static GameObject createSleepElement(DayElement dayElement, SleepElement sleepElement, Transform container)
    {
        GameObject go = Instantiate(Resources.Load("SleepElement", typeof(GameObject)), container) as GameObject;

        go.GetComponent <SleepElementController>().configure(dayElement, sleepElement, true);
        return(go);
    }
Esempio n. 2
0
    internal void addRecord(Record record)
    {
        if (sleepElements.Count == 0)
        {
            SleepElement newSleepElement = new SleepElement();
            newSleepElement.addRecord(record);
            sleepElements.Add(newSleepElement);
            date = setCurrentDate(record);
            return;
        }
        SleepElement[] sleeps      = sleepElements.ToArray();
        SleepElement   lastElement = sleeps[sleeps.Length - 1];

        Record[] records    = lastElement.GetRecords().ToArray();
        Record   lastRecord = records[records.Length - 1];

        if (lastRecord.getStartDateTime().AddHours(-2) < record.getEndDateTime())
        {
            lastElement.addRecord(record);
            return;
        }
        SleepElement element = new SleepElement();

        element.addRecord(record);
        sleepElements.Add(element);
    }
 public void configure(DayElement dayElement, SleepElement sleepElement)
 {
     this.dayElement   = dayElement;
     this.sleepElement = sleepElement;
     dayElemetUi.GetComponent <DayElementController>().configure(dayElement, () => { ObjectFactory.createDayView(dayElement); });
     sleepElementUi.GetComponent <SleepElementController>().configure(dayElement, sleepElement, false);
     elements = sleepElement.GetRecords();
 }
Esempio n. 4
0
    internal static GameObject createSleepView(DayElement dayElement, SleepElement sleepElement)
    {
        Destroy(currentView);
        GameObject go = Instantiate(Resources.Load("SleepView", typeof(GameObject)), GameObject.Find("Canvas").transform) as GameObject;

        go.GetComponent <SleepDetailViewController>().configure(dayElement, sleepElement);
        currentView = go;
        return(currentView);
    }
    public void configure(DayElement dayElement, SleepElement sleepElement, bool interactable)
    {
        this.dayElement   = dayElement;
        this.sleepElement = sleepElement;
        this.interactable = interactable;

        String count = "";

        if (sleepElement.GetRecords().Count > 1)
        {
            count = (sleepElement.GetRecords().Count - 1) + "";
        }
        this.sleepUnits.text = count;
        this.duration.text   = TimeRecordUtility.MiliSecToDuration(sleepElement.GetTotalSleepTime());

        Record[] array         = sleepElement.GetRecords().ToArray();
        String   startDateTime = TimeRecordUtility.DateTimeToTimeString(array[array.Length - 1].getStartDateTime());
        String   endDateTime   = TimeRecordUtility.DateTimeToTimeString(array[0].getEndDateTime());

        this.fromTo.text = startDateTime + " - " + endDateTime;
    }