/// <summary> /// Loadout showing just particular date notes. /// </summary> /// <param name="date"></param> public void LoadData(DateTime date) { _targetDate = date; _data = NotesManager.GetNoteData(_targetDate); _topBarTitle.text = date.ToString("d MMMM, yyyy"); SetScroller(_data); SetState(State.Default); }
/// <summary> /// Default loadout showing all the list of the notes. /// </summary> public void LoadData() { _targetDate = DateTime.MinValue; _data = NotesManager.GetNoteData(); _topBarTitle.text = "Notes"; SetScroller(_data); SetState(State.Default); }
private void ScrollerScrolled(EnhancedScroller enhancedScroller, Vector2 val, float scrollposition) { int currentActiveCellIndex = scroller.GetClosestCellIndex(); // Debug.Log($"ScrollerScrolled. _lastActiveCellIndex: {_lastActiveCellIndex}, currentActiveCellIndex: {currentActiveCellIndex}, total data count: {_data.Count}"); // check is start and end cell items indexes are in a range of 7 days and value not equals to previously cached value if (_lastActiveCellIndex != currentActiveCellIndex && currentActiveCellIndex > -1 && currentActiveCellIndex < _data.Count) { _lastActiveCellIndex = currentActiveCellIndex; EnhancedScrollerCellView activeCell = scroller.GetClosestCellView(); if (activeCell != null) { // set focus of cells only for daily view in CSU mode if (appMode == AppMode.CSU) { if (activeCell != null) { _lastActiveCellView?.SetFocus(false); _lastActiveCellView = (activeCell as DayScrollItemView); // Debug.Log( // $"active cell data: {_lastActiveCellView.graphData.data}, date: {_lastActiveCellView.graphData.date}, value: {_lastActiveCellView.graphData.interpolatedScore}"); _lastActiveCellView.SetFocus(true); } } } } QuestionBasedTrackerData data = _data[_lastActiveCellIndex].data; // for CSU if (_trackerType == TrackerManager.TrackerType.CSU) { // Debug.Log("data: " + data); // hide by default _photoHint.UpdateValue(null); if (data != null) { // if there are some photos int numOfPhotos = (data as CSUData).GetPhotosCount(); // Debug.Log("Photos count: " + numOfPhotos); if (numOfPhotos > 0) { _photoHint.UpdateValue(numOfPhotos.ToString()); } } _CSUViewController.UpdateData(data as CSUData); } // if using the graph (3 of 4 trackers) else { // move graph camera together with a slider _graphController.UpdateCameraView(val.x); // set score _scoreHint.UpdateValue(data == null ? string.Empty : data.GetScore().ToString()); } // cache last scroll position to restore last position on screen Hide >> Show or tracker type change if (_scrollLastPositions.ContainsKey(_trackerType)) { _scrollLastPositions[_trackerType] = val.x; } else { _scrollLastPositions.Add(_trackerType, val.x); } // check notes if (_lastActiveCellIndex > -1) { List <NoteData> notes = NotesManager.GetNoteData(_data[_lastActiveCellIndex].date); if (notes.Count > 0) { _notesHint.UpdateValue(notes.Count.ToString()); } else { _notesHint.UpdateValue(null); } } else { _notesHint.UpdateValue(null); } }