void addChildren(DayElement d, int pos)
        {
            DayElementView dayElement = new DayElementView(d);

            UIGrid.Children.Add(dayElement);
            Grid.SetColumn(dayElement, pos);
        }
Exemplo n.º 2
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);
    }
 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();
 }
Exemplo n.º 4
0
 public void configure(DayElement dayElement, Action onClickAction)
 {
     this.dayElement      = dayElement;
     this.sleepUnits.text = dayElement.GetSleepCount() + "";
     this.date.text       = dayElement.GetDate();
     this.onClick         = onClickAction;
     this.duration.text   = TimeRecordUtility.MiliSecToDuration(dayElement.GetTotalSleepTime());
 }
Exemplo n.º 5
0
    internal static GameObject createDayView(DayElement dayElement)
    {
        Destroy(currentView);
        GameObject go = Instantiate(Resources.Load("DayView", typeof(GameObject)), GameObject.Find("Canvas").transform) as GameObject;

        go.GetComponent <DayDetailViewController>().configure(dayElement);
        currentView = go;
        return(currentView);
    }
Exemplo n.º 6
0
    internal static List <DayElement> GetDayElements()
    {
        List <DayElement> dayElements = new List <DayElement>();
        DayElement        dayElement  = new DayElement();

        foreach (Record record in RecordsManager.GetReverseHistorySortedByDay().records)
        {
            bool isSameDay = dayElement.isSameDay(record);
            if (dayElement.GetSleepElements().Count == 0 || isSameDay)
            {
                dayElement.addRecord(record);
                continue;
            }
            dayElements.Add(dayElement);
            dayElement = new DayElement();
            dayElement.addRecord(record);
        }
        dayElements.Add(dayElement);
        return(dayElements);
    }
    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;
    }
        public DayElementView(DayElement d)
        {
            this.d = d;

            InitializeComponent();
            LoadComponements();

            if (d.isTheSameDay)
            {
                UIGrid.Background = new SolidColorBrush(UISettings.isSameDayColor);
            }
            else
            if (d.isSameMonth == false)
            {
                UIGrid.Background = new SolidColorBrush(UISettings.isDifferentMonthColor);
            }
            else
            {
                UIGrid.Background = new SolidColorBrush(UISettings.defaultColor);
            }

            UIBorder.Background = new SolidColorBrush(UISettings.defaultBorderColor);
        }
 public void configure(DayElement dayElement)
 {
     this.dayElement = dayElement;
     dayElemetUi.GetComponent <DayElementController>().configure(dayElement, () => { ObjectFactory.createDayList(); });
     elements = dayElement.GetSleepElements();
 }
Exemplo n.º 10
0
    internal static void createDayElement(DayElement element, Transform container)
    {
        GameObject go = Instantiate(Resources.Load("DayElement", typeof(GameObject)), container) as GameObject;

        go.GetComponent <DayElementController>().configure(element, () => { ObjectFactory.createDayView(element); });
    }