public void SetData(DataEvaluation data, CultureInfo languageInfo) { string formatedMonth = data.CreatedAt.Value.ToString("MMMM yyyy", languageInfo).ToUpper(); mTitle.text = TextManager.Get(mCheckTitleTag) + " " + formatedMonth; for (int i = 0; i < mTopics.Length; i++) { if (i < data.Answers.Length) { DataEvaluationAnswer answer = data.Answers[i]; //Sprite ratingSprite = mRatingSprites[Mathf.Min(answer.Rating, mRatingSprites.Length - 1)]; int rating = answer.Rating; if (rating < 1) { rating = 1; } else if (rating > 6) { rating = 6; } Sprite ratingSprite = mRatingSprites[rating - 1]; string text = "<b>" + answer.Category.Name + "</b>\n" + answer.Body; mTopics[i].SetData(ratingSprite, text); } else { mTopics[i].gameObject.SetActive(false); } } }
private void RefreshPrevious() { if (DataManager.Evaluation.Data == null || DataManager.Plan.Data == null) { return; } SetActiveView(mPreviousView); // Create an array of all represented months in our data DateTime[] months = CreateCompletedMonthList(); for (int i = 0; i < months.Length; i++) { DateTime currentMonth = months[i]; // Add month header string formatedMonth = currentMonth.ToString("MMMM yyyy", mLanguageInfo).ToUpper(); string monthBarTitle = TextManager.Get(mCompletedTag) + " " + formatedMonth; Add(mHeaderPreviousPrefab).SetTitle(monthBarTitle); // Find the evaluation for this month and add it for (int j = 0; j < DataManager.Evaluation.Done.Length; j++) { DataEvaluation evaluation = DataManager.Evaluation.Done[j]; DateTime date = evaluation.CreatedAt.Value; if (date.Year == currentMonth.Year && date.Month == currentMonth.Month) { Add(mCheckPrefab).SetData(evaluation, mLanguageInfo); } } // Find the goals for this month and add them for (int j = 0; j < DataManager.Plan.CompletedGoals.Length; j++) { DataGoal goal = DataManager.Plan.CompletedGoals[j]; DateTime date = goal.FinishedAt.Value; if (date.Year == currentMonth.Year && date.Month == currentMonth.Month) { MonthlyGoal created = Add(mGoalPrefab); created.SetData(goal); if (mToFocus != null && goal.ID == mToFocus.ID) { mFocusGoal = created; mFocusIsOngoing = false; } } } } }
private void RefreshHeader() { if (DataManager.Evaluation.Data == null || DataManager.Plan.Data == null) { mFlowerArea.SetPositionOut(); mIndicatorArea.SetPositionOut(); return; } // Set flower count int flowerTotal = DataManager.Plan.OngoingGoals.Length + DataManager.Plan.CompletedGoals.Length; int flowerDone = DataManager.Plan.CompletedGoals.Length; if (flowerTotal > 0) { mFlowerArea.BeginMoveIn(); mFlowerCountText.text = flowerDone + "/" + flowerTotal; } // Set indicators if (DataManager.Evaluation.Done.Length > 0) { DataEvaluation evaluation = DataManager.Evaluation.Done.Last(); mIndicatorLiving.sprite = mIndicationSprites[Mathf.Min(evaluation.Answers[0].Rating, mIndicationSprites.Length - 1)]; mIndicatorParticipation.sprite = mIndicationSprites[Mathf.Min(evaluation.Answers[1].Rating, mIndicationSprites.Length - 1)]; mIndicatorAssignment.sprite = mIndicationSprites[Mathf.Min(evaluation.Answers[2].Rating, mIndicationSprites.Length - 1)]; mIndicatorArea.BeginMoveIn(); } else { // No evaluation done yet, hide indicators mIndicatorArea.SetPositionOut(); } }