public void SetUp() { _dataPath = Application.dataPath + "/DB/test.json"; _task_v = GameObject.Find("MainScript").GetComponent <Task_V>(); _task_m = GameObject.Find("MainScript").GetComponent <Task_M>(); StreamReader reader = new StreamReader(_dataPath); var index = reader.ReadToEnd(); _taskList = JsonUtility.FromJson <TaskList>(index); }
void Awake() { var MainSctipt = GameObject.Find("MainScript"); _view = MainSctipt.GetComponent <Task_V>(); _model = MainSctipt.GetComponent <Task_M>(); _calender = MainSctipt.GetComponent <CalenderManager>(); // ビューが変化したらモデルに伝える _view.FetchTaskEvent.AddListener(() => _model.FetchIndex()); _view.RegisterEvent.AddListener((newTask) => _model.Save(newTask)); _view.DeleteEvent.AddListener(deleteKeys => _model.Delete(deleteKeys)); // モデルが変化したらビューに伝える _model.FetchTaskEvent.AddListener(taskList => _view.RenderingTask(taskList)); _model.RegisterEvent.AddListener(taskList => _view.RenderingTask(taskList)); _model.DeletedEvent.AddListener(taskList => _view.RenderingTask(taskList)); //カレンダーの選択ボタンが押されたらviewに伝える _calender.onClickPanelSelected.AddListener(clickedDate => _view.SelectedCalenderItem(clickedDate)); }