コード例 #1
0
    public void submitButtonClick()
    {
        // handle ui
        AppManager.Prefabs[0].gameObject.SetActive(true);

        string time = (AMPM_dropdown.getValue() == 0) ? "上午 " : "下午 ";

        time += Hour_dropdown.getValue();
        time += ":";
        time += Minute_dropdown.getValue() < 10 ? "0" + Minute_dropdown.getValue() : Minute_dropdown.getValue().ToString();
        time += " ";

        EditingAlarm.TimeString.text = time;
        EditingAlarm.hr_dp_val       = Hour_dropdown.getValue();
        EditingAlarm.min_dp_val      = Minute_dropdown.getValue();
        EditingAlarm.ampm_dp_val     = AMPM_dropdown.getValue();
        EditingAlarm.repeat_dp_val   = Repeat_dropdown.value;
        EditingAlarm.ringer_dp_val   = Ringer_dropdown.value;
        EditingAlarm.label_if_val    = Label_input.text;
        EditingAlarm.Profile.sprite  = EditingAlarm.profile_sprites[EditingAlarm.ringer_dp_val];

        // handle notification
        // cancel the old one
        Notifications.RemoveAlarm(Id);
        // insert a new one
        Id = Notifications.AddAlarm(Hour_dropdown.getValue(), Minute_dropdown.getValue(), AMPM_dropdown.getValue(), Repeat_dropdown.value == 1, Label_input.text, Ringer_dropdown.value);
        EditingAlarm.Id = Id;
        AlarmList.SaveAlarmListToFile();
        Swipable.allow_swipe = true;
        // Destroy(gameObject);
        OnExiting();
    }
コード例 #2
0
    public void submitButtonClick()
    {
        // AlarmList界面设为可见
        AppManager.Prefabs[0].SetActive(true);
        var newAlarm = Instantiate(AlarmElementPrefab, AppManager.Prefabs[2].transform);

        string time = (AMPM_dropdown.getValue() == 0) ? "上午 " : "下午 ";

        time += Hour_dropdown.getValue().ToString();
        time += ":";
        time += Minute_dropdown.getValue() < 10 ? "0" + Minute_dropdown.getValue() : Minute_dropdown.getValue().ToString();

        var ae = newAlarm.GetComponent <AlarmElement>();

        ae.TimeString.text = time;
        ae.profile_idx     = CharacterSetting._ins.curCharacter;
        ae.ringer_dp_val   = Ringer_drowndown.value;
        ae.Profile.sprite  = ae.profile_sprites[ae.ringer_dp_val];
        ae.hr_dp_val       = Hour_dropdown.getValue();
        ae.min_dp_val      = Minute_dropdown.getValue();
        ae.ampm_dp_val     = AMPM_dropdown.getValue();
        ae.repeat_dp_val   = Repeat_dropdown.value;
        ae.label_if_val    = Label_input.text;
        ae.Id = Notifications.AddAlarm(ae.hr_dp_val, ae.min_dp_val, ae.ampm_dp_val, ae.repeat_dp_val == 1, ae.label_if_val, ae.ringer_dp_val);

        // add the alarm to list
        AlarmList.ui_alarmlist.Add(newAlarm);
        // reorder the list
        AppManager.Prefabs[0].GetComponent <AlarmList>().Reorder();
        // save
        AlarmList.SaveAlarmListToFile();
        // 此界面任务完成,把自身设为不可见
        Swipable.allow_swipe = true;
        // gameObject.SetActive(false);
        OnExiting();
    }