示例#1
0
 private void MonthGenerator(GameObject monthPrefab, Transform parent)
 {
     for (int i = 0; i < 12; i++)
     {
         GameObject month = prefabGenerator(monthPrefab, parent);
         DMY        dmy   = month.AddComponent <DMY>();
         month.GetComponent <Button>().onClick.AddListener(() =>
         {
             m_selectDT = dmy.DateTime;
             if (CalendarType == E_CalendarType.Month)
             {
                 CalendarType = E_CalendarType.Day;
                 calendarTypeChange(true);
                 onMonthClick.Invoke(dmy.DateTime);
             }
             if (CalendarType == E_CalendarType.Year)
             {
                 CalendarType = E_CalendarType.Month;
                 onYearClick.Invoke(dmy.DateTime);
             }
             Refresh();
         });
         _monthYearPool.Add(dmy);
     }
     Destroy(monthPrefab);
 }
示例#2
0
 private void DayGenerator(GameObject dayPrefab, Transform parent)
 {
     for (int i = 0; i < 42; i++)
     {
         GameObject day = prefabGenerator(dayPrefab, parent);
         DMY        dmy = day.AddComponent <DMY>();
         day.GetComponent <Button>().onClick.AddListener(() =>
         {
             m_selectDT = dmy.DateTime;
             onDayClick.Invoke(dmy.DateTime);
             Refresh();
         });
         _daysPool.Add(dmy);
     }
     Destroy(dayPrefab);
 }