예제 #1
0
    private void SetTaskItemEvent(GameObject taskItem, Task task)
    {
        Toggle Toggle_Completed = taskItem.transform.Find("Toggle_Completed").GetComponent <Toggle>();
        Button Button_Delete    = taskItem.transform.Find("Button_Delete").GetComponent <Button>();
        Text   Text_title       = taskItem.transform.Find("Text_TodoContent").GetComponent <Text>();

        Toggle_Completed.isOn = task.IsCompleted;
        Toggle_Completed.onValueChanged.AddListener((isCompleted) => {
            if (isCompleted)
            {
                _taskPresenter.CompleteTask(task);
            }
            else
            {
                _taskPresenter.ActiveTask(task);
            }
        });
        Button_Delete.onClick.AddListener(() => {
            _taskPresenter.DeleteTask(task.Id);
        });
        Text_title.text = task.Title;
    }