Пример #1
0
    private void OnTaskFilterSelected(int itemId)
    {
        switch (itemId)
        {
        case 0:
            // All
            _taskPresenter.SetFiltering(TasksFilterType.ALL_TASKS);
            break;

        case 1:
            // Active
            _taskPresenter.SetFiltering(TasksFilterType.ACTIVE_TASKS);
            break;

        case 2:
            // Completed
            _taskPresenter.SetFiltering(TasksFilterType.COMPLETED_TASKS);
            break;

        default:
            _taskPresenter.SetFiltering(TasksFilterType.ALL_TASKS);
            break;
        }
        _taskPresenter.LoadTasks();
    }
Пример #2
0
    private void Awake()
    {
        _baseTaskItem          = transform.Find("ScrollRect_Tasks/Viewport/Content/BaseTaskItem").gameObject;
        _Dropdown_TaskFilter   = transform.Find("Dropdown_TaskFilter").GetComponent <Dropdown>();
        _Transform_TasksParent = transform.Find("ScrollRect_Tasks/Viewport/Content");
        _InputField_Task       = transform.Find("InputField_Task").GetComponent <InputField>();
        _Button_AddTask        = transform.Find("Button_Add").GetComponent <Button>();

        _Dropdown_TaskFilter.onValueChanged.AddListener(OnTaskFilterSelected);
        _Button_AddTask.onClick.AddListener(OnClickAddTask);

        _taskPresenter = new TaskPresenter(this);
        _taskPresenter.LoadTasks();
        _taskPresenter.SetFiltering(TasksFilterType.ALL_TASKS);
        _baseTaskItem.SetActive(false);
    }