コード例 #1
0
    /// <summary>
    /// Loads the learner interactions.
    /// </summary>
    /// <remarks>Load the learner interactions from SCORM and present as a formatted string to the GUI.</remarks>
    public void LoadLearnerInteractions()
    {
        List <StudentRecord.LearnerInteractionRecord> interactionsList = ScormManager.GetInteractions();
        string stringInteractionsList = "";

        foreach (StudentRecord.LearnerInteractionRecord record in interactionsList)
        {
            string timeStamp   = record.timeStamp.ToString();                                                                                                   // Get the Interaction data as strings
            String id          = record.id;
            string type        = record.type.ToString();
            string weighting   = record.weighting.ToString();
            string latency     = record.latency.ToString();
            string description = record.description;
            string response    = record.response;

            string result = record.result.ToString();                                                                                                                   // If the Interaction result is set as the 'estimate', the result needs to be set to the numeric estimate value
            if (record.result == StudentRecord.ResultType.estimate)
            {
                result = record.estimate.ToString();
            }

            string stringInteractionObjectivesList = "";                                                                                                        // Load the list of objectives and format it into a string
            if (record.objectives != null)
            {
                List <StudentRecord.LearnerInteractionObjective> interactionObjectivesList = record.objectives;
                if (interactionObjectivesList.Count > 0)
                {
                    string stringObjectiveIds = "";
                    foreach (StudentRecord.LearnerInteractionObjective singleObjective in interactionObjectivesList)
                    {
                        stringObjectiveIds += singleObjective.id + " ";
                    }
                    stringInteractionObjectivesList = "Objectives (" + stringObjectiveIds + ")\n";
                }
            }

            string stringInteractionCorrectResponseList = "";                                                                                                   // Load the list of correct response patterns and format it into a string
            if (record.correctResponses != null)
            {
                List <StudentRecord.LearnerInteractionCorrectResponse> interactionCorrectResponseList = record.correctResponses;
                if (interactionCorrectResponseList.Count > 0)
                {
                    string stringPatterns = "";
                    foreach (StudentRecord.LearnerInteractionCorrectResponse singleCorrectResponse in interactionCorrectResponseList)
                    {
                        stringPatterns += singleCorrectResponse.pattern + " ";
                    }
                    stringInteractionCorrectResponseList = "Correct Response Patterns (" + stringPatterns + ")\n";
                }
            }

            stringInteractionsList += timeStamp + " :: " + id + "\n" + description + "\n(type: " + type + " weighting: " + weighting + " latency: " + latency + "secs)\nResponse: " + response + " Result: " + result + "\n" + stringInteractionCorrectResponseList + stringInteractionObjectivesList + "\n"; // Format the entire Interaction data set as a string and add to the GUI element
        }
        GameObject.Find("InteractionList").GetComponent <Text> ().text = stringInteractionsList;
    }