예제 #1
0
    private void OutputData()
    {
        foreach (var repetition in UserDataObject.GetCurrentRepetitionsArray())
        {
            GameObject          timeGameObject   = Instantiate(timePanel);
            RepetitionTimePanel currentTimePanel = timeGameObject.GetComponent <RepetitionTimePanel>();

            GameObject confidenceGameObject = Instantiate(confidencePanel);
            RepetitionConfidencePanel currentConfidencePanel = confidenceGameObject.GetComponent <RepetitionConfidencePanel>();

            GameObject attemptsGameObject = Instantiate(attemptsPanel);
            RepetitionAttemptsPanel currentAttemptsPanel = attemptsGameObject.GetComponent <RepetitionAttemptsPanel>();

            int repetitionId = Array.IndexOf(UserDataObject.GetCurrentRepetitionsArray(), repetition) + 1;


            string reptitionText = repetitionId.ToString();
            switch (repetitionId)
            {
            case 1:
                reptitionText += "st rep";
                break;

            case 2:
                reptitionText += "nd rep";
                break;

            case 3:
                reptitionText += "rd rep";
                break;

            default:
                reptitionText += "th rep";
                break;
            }

            currentTimePanel.repetitionText.text = reptitionText;
            currentTimePanel.timeText.text       = repetition.userTime.ToString("F1");
//			currentTimePanel.GetComponent<Image>().fillAmount = repetition.userTime / UserDataObject.GetCurrentExerciseLongestRepetitionTime();
            imageTimeList.Add(currentTimePanel.GetComponent <Image>());
            imageTimeValue.Add(repetition.userTime / UserDataObject.GetCurrentExerciseLongestRepetitionTime());

            currentAttemptsPanel.repetitionText.text = reptitionText;
            currentAttemptsPanel.attemptsText.text   = repetition.attempts.ToString();
            imageAttemptsList.Add(currentAttemptsPanel.GetComponent <Image>());
            imageAttemptsValue.Add((float)repetition.attempts / UserDataObject.GetCurrentExerciseSideHighestAttempt());

            currentConfidencePanel.repetitionText.text = reptitionText;
            currentConfidencePanel.confidenceText.text = Mathf.Round(repetition.confidence).ToString();
//			currentConfidencePanel.GetComponent<Image>().fillAmount = repetition.confidence/100;
            imageConfidenceList.Add(currentConfidencePanel.GetComponent <Image>());
            imageConfidenceValue.Add(repetition.confidence / 100);


            attemptsGameObject.transform.SetParent(attemptsSpacer, false);
            timeGameObject.transform.SetParent(timeSpacer, false);
            confidenceGameObject.transform.SetParent(confidenceSpacer, false);
        }

        avgTimePanel.GetComponent <AverageTimePanel>().averageTimeText.text =
            UserDataObject.GetCurrentExerciseAverageRepetitionTime().ToString("F1") + " sec";

        avgAttemptsPanel.GetComponent <AverageAttemptsPanel>().avgAttemptsText.text =
            UserDataObject.GetCurrentExerciseAverageRepetitionAttempts().ToString("F1");

        avgConfidencePanel.GetComponent <AverageConfidencePanel>().averageConfidenceText.text =
            UserDataObject.GetCurrentExerciseAverageRepetitionConfidence().ToString("F1") + " %";

        startConfidenceAnim = true;
        startTimeAnim       = true;
        startAttemptsAnim   = true;
        startAnim           = true;
    }