Ejemplo n.º 1
0
        public static void ShowTimePicker(int hour, int minute, bool isAM, Action <int, int, bool> onAffirmativeClicked, Color accentColor)
        {
            DialogTimePicker dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogTimePicker, instance.transform).GetComponent <DialogTimePicker>();

            dialog.Initialize(hour, minute, isAM, onAffirmativeClicked, accentColor);
            dialog.Show();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows a time picker dialog with a required time picker, and a required button.
        /// </summary>
        /// <param name="time">The time selected when the dialog is shown.</param>
        /// <param name="onAffirmativeClicked">Called when the affirmative button is clicked.</param>
        /// <param name="accentColor">Color of the accent of the picker.</param>
        public static void ShowTimePicker(DateTime time, Action <DateTime> onAffirmativeClicked, Color accentColor)
        {
            DialogTimePicker dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogTimePicker, instance.transform).GetComponent <DialogTimePicker>();

            dialog.Initialize(time, onAffirmativeClicked, accentColor);
            dialog.Show();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Shows a time picker dialog with a required time picker, and a required button.
        /// </summary>
        /// <param name="time">The time selected when the dialog is shown.</param>
        /// <param name="onAffirmativeClicked">Called when the affirmative button is clicked.</param>
        /// <param name="accentColor">Color of the accent of the picker.</param>
        public DialogTimePicker ShowTimePicker(DateTime time, Action <DateTime> onAffirmativeClicked, Color accentColor)
        {
            DialogTimePicker dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogTimePicker, GetContentTransform()).GetComponent <DialogTimePicker>();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            dialog.Initialize(time, onAffirmativeClicked, accentColor);
            dialog.Show();
            return(dialog);
        }
Ejemplo n.º 4
0
        public override void Show()
        {
            System.DateTime date = GetCurrentDate();

            var isTimePicker  = m_PickerMode == DateTimeMode.Time || m_PickerMode == DateTimeMode.DateTime;
            var isDatePicker  = m_PickerMode == DateTimeMode.Date || m_PickerMode == DateTimeMode.DateTime;
            var isMonthPicker = m_PickerMode == DateTimeMode.Month;

            if (isDatePicker || isMonthPicker)
            {
                //We must call changeTime after change date (if supported)
                System.Action <System.DateTime> onChangeDate = (pickedDate) =>
                {
                    HandleOnChangeDateKeepingLastTime(pickedDate);

                    pickedDate = GetCurrentDate();
                    if (isTimePicker)
                    {
                        ShowFrameActivity <DialogTimePicker>(s_TimePicker, PrefabManager.ResourcePrefabs.dialogTimePicker,
                                                             (dialog, isDialog) =>
                        {
                            s_TimePicker = dialog;
                            dialog.Initialize(pickedDate, HandleOnChangeTimeKeepingLastDate, m_DialogColor);
                        });
                    }
                };

                //Show DatePicker
                if (isMonthPicker)
                {
                    ShowFrameActivity <DialogDatePicker>(s_MonthPicker, PrefabManager.ResourcePrefabs.dialogMonthPicker,
                                                         (dialog, isDialog) =>
                    {
                        s_MonthPicker = dialog;
                        dialog.Initialize(date.Year, date.Month, date.Day, onChangeDate, HandleOnHide, m_DialogColor);
                        dialog.SetCultureInfo(GetCultureInfo());
                    });
                }
                else
                {
                    ShowFrameActivity <DialogDatePicker>(s_DatePicker, PrefabManager.ResourcePrefabs.dialogDatePicker,
                                                         (dialog, isDialog) =>
                    {
                        s_DatePicker = dialog;
                        dialog.Initialize(date.Year, date.Month, date.Day, onChangeDate, HandleOnHide, m_DialogColor);
                        dialog.SetCultureInfo(GetCultureInfo());
                    });
                }
            }

            //Show Time Picker Only
            if (isTimePicker && m_PickerMode != DateTimeMode.DateTime)
            {
                ShowFrameActivity <DialogTimePicker>(s_TimePicker, PrefabManager.ResourcePrefabs.dialogTimePicker,
                                                     (dialog, isDialog) =>
                {
                    s_TimePicker = dialog;
                    dialog.Initialize(date, HandleOnChangeDateTime, m_DialogColor);
                });
            }
        }