예제 #1
0
    void FillSummaryList()
    {
        Debug.Log(_currentTierData.fileName);
        Debug.Log(_currentTierData.tips);
        Debug.Log(_currentTierData.tips[1]);

        foreach (var exercise in _currentTierData.exercises)
        {
            _exerciseIterator += 1;

            textTimeNumber.text       = _exerciseIterator.ToString();
            textAttemptsNumber.text   = _exerciseIterator.ToString();
            textConfidenceNumber.text = _exerciseIterator.ToString();

            textAttemptsExerciseName.text   = exercise.exerciseName;
            textConfidenceExerciseName.text = exercise.exerciseName;
            textTimeExerciseName.text       = exercise.exerciseName;

            GameObject gameObjectTierExerciseTime       = Instantiate(exerciseTimeImage) as GameObject;
            GameObject gameObjectTierExerciseConfidence = Instantiate(exerciseConfidenceImage) as GameObject;
            GameObject gameObjectTierExerciseAttempts   = Instantiate(exerciseAttemptsImage) as GameObject;

            GameObject gameObjectTierExercisNumber = Instantiate(exerciseNumberText) as GameObject;


            TierSummaryExerciseTimeImage summaryTimeImage =
                gameObjectTierExerciseTime.GetComponent <TierSummaryExerciseTimeImage>();
            TierSummaryExerciseConfidenceImage summaryConfidenceImage =
                gameObjectTierExerciseConfidence.GetComponent <TierSummaryExerciseConfidenceImage>();
            TierSummaryExerciseAttemptImage summaryAttemptImage =
                gameObjectTierExerciseAttempts.GetComponent <TierSummaryExerciseAttemptImage>();


            summaryTimeImage.avgTimeText.text = exercise.userTime.ToString("F1");
            summaryTimeImage.GetComponent <Image>().fillAmount = exercise.userTime / UserDataObject.GetCurrentTierAllExercisesHighestTime();

            summaryConfidenceImage.avgConfidence.text = exercise.confidence.ToString("F0");
            summaryConfidenceImage.GetComponent <Image>().fillAmount = exercise.confidence / 100;

            summaryAttemptImage.avgAttempt.text = exercise.attempts.ToString();
            summaryAttemptImage.GetComponent <Image>().fillAmount = exercise.attempts / UserDataObject.GetCurrentTierAllExercisesHighestAttempt();


            gameObjectTierExercisNumber.GetComponent <Text>().text += (_currentTierData.exercises.IndexOf(exercise) + 1);

            gameObjectTierExerciseTime.transform.SetParent(timeSpacer, false);
            gameObjectTierExerciseConfidence.transform.SetParent(confidenceSpacer, false);
            gameObjectTierExerciseAttempts.transform.SetParent(attemptsSpacer, false);
            gameObjectTierExercisNumber.transform.SetParent(exerciseNumberSpacer, false);
        }
    }