/// <summary>
    /// The add objective button pressed.
    /// </summary>
    /// <remarks>Validates the input GUI elements are not empty, then adds a new objective to SCORM and the GUI</remarks>
    public void ButtonAddObjectivePressed()
    {
        GameObject inputFieldObjectiveId          = GameObject.Find("InputFieldObjectiveId");
        GameObject inputFieldObjectiveDescription = GameObject.Find("InputFieldObjectiveDescription");

        string objectiveId          = inputFieldObjectiveId.GetComponent <InputField> ().text;
        string objectiveDescription = inputFieldObjectiveDescription.GetComponent <InputField> ().text;

        if (objectiveId == "" | objectiveDescription == "")                                                                                                     // Validate the Input Elements
        {
            if (objectiveId == "")
            {
                inputFieldObjectiveId.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "You must enter an ID!";
            }
            if (objectiveDescription == "")
            {
                inputFieldObjectiveDescription.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "You must enter a description!";
            }
        }
        else                                                                                                                                                                                                    // Add the Objective
        {
            StudentRecord.Objectives newObjective = new StudentRecord.Objectives();
            newObjective.id          = objectiveId;
            newObjective.description = objectiveDescription;

            StudentRecord.LearnerScore score = new StudentRecord.LearnerScore();
            score.min    = 0f;
            score.max    = 100f;
            score.raw    = 0f;
            score.scaled = 0f;

            newObjective.score            = score;
            newObjective.successStatus    = StudentRecord.SuccessStatusType.unknown;
            newObjective.completionStatus = StudentRecord.CompletionStatusType.not_attempted;
            newObjective.progressMeasure  = 0f;

            ScormManager.AddObjective(newObjective);
            int index = ScormManager.GetObjectives().Count;
            AddObjectiveToList(index, newObjective);

            //Reset Fields
            inputFieldObjectiveId.GetComponent <InputField> ().text          = "";
            inputFieldObjectiveDescription.GetComponent <InputField> ().text = "";
            inputFieldObjectiveId.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text          = "Objective ID...";
            inputFieldObjectiveDescription.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "Objective Description...";
        }
    }
    /// <summary>
    /// The add objective button pressed.
    /// </summary>
    /// <remarks>Validates the input GUI elements are not empty, then adds a new objective to SCORM and the GUI</remarks>
    public void ButtonAddObjectivePressed()
    {
        GameObject inputFieldObjectiveId = GameObject.Find ("InputFieldObjectiveId");
        GameObject inputFieldObjectiveDescription = GameObject.Find ("InputFieldObjectiveDescription");

        string objectiveId = inputFieldObjectiveId.GetComponent<InputField> ().text;
        string objectiveDescription = inputFieldObjectiveDescription.GetComponent<InputField> ().text;

        if (objectiveId == "" | objectiveDescription == "") {												// Validate the Input Elements
            if (objectiveId == "") {
                inputFieldObjectiveId.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "You must enter an ID!";
            }
            if (objectiveDescription == "") {
                inputFieldObjectiveDescription.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "You must enter a description!";
            }
        } else {																							// Add the Objective
            StudentRecord.Objectives newObjective = new StudentRecord.Objectives();
            newObjective.id = objectiveId;
            newObjective.description = objectiveDescription;

            StudentRecord.LearnerScore score = new StudentRecord.LearnerScore();
            score.min = 0f;
            score.max = 100f;
            score.raw = 0f;
            score.scaled = 0f;

            newObjective.score = score;
            newObjective.successStatus = StudentRecord.SuccessStatusType.unknown;
            newObjective.completionStatus = StudentRecord.CompletionStatusType.not_attempted;
            newObjective.progressMeasure = 0f;

            ScormManager.AddObjective(newObjective);
            int index = ScormManager.GetObjectives().Count;
            AddObjectiveToList(index, newObjective);

            //Reset Fields
            inputFieldObjectiveId.GetComponent<InputField> ().text = "";
            inputFieldObjectiveDescription.GetComponent<InputField> ().text = "";
            inputFieldObjectiveId.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "Objective ID...";
            inputFieldObjectiveDescription.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "Objective Description...";
        }
    }
    /// <summary>
    /// Initializes the data into the GUI.
    /// </summary>
    private void InitializeData()
    {
        //Learner Data
        GameObject.Find("TextID").GetComponent <Text> ().text   = ScormManager.GetLearnerId();
        GameObject.Find("TextName").GetComponent <Text> ().text = ScormManager.GetLearnerName();

        StudentRecord.LearnerPreference learnerPreference = ScormManager.GetLearnerPreference();
        GameObject.Find("InputFieldAudioCaptioning").GetComponent <InputField> ().text = learnerPreference.audioCaptioning.ToString();
        GameObject.Find("InputFieldAudioLevel").GetComponent <InputField> ().text      = learnerPreference.audioLevel.ToString();
        GameObject.Find("InputFieldDeliverySpeed").GetComponent <InputField> ().text   = learnerPreference.deliverySpeed.ToString();
        GameObject.Find("InputFieldLanguage").GetComponent <InputField> ().text        = learnerPreference.langauge;

        LoadCommentFromLearnerList();

        //SCORM Data
        GameObject.Find("TextSCORMAPIVersion").GetComponent <Text> ().text = ScormManager.GetVersion();

        GameObject.Find("TextCredit").GetComponent <Text> ().text          = ScormManager.GetCredit().ToString();
        GameObject.Find("TextEntry").GetComponent <Text> ().text           = ScormManager.GetEntry().ToString();
        GameObject.Find("TextMode").GetComponent <Text> ().text            = ScormManager.GetMode().ToString();
        GameObject.Find("TextLocation").GetComponent <Text> ().text        = ScormManager.GetLocation();
        GameObject.Find("TextMaxTimeAllowed").GetComponent <Text> ().text  = ScormManager.GetMaxTimeAllowed().ToString();
        GameObject.Find("TextTotalTime").GetComponent <Text> ().text       = ScormManager.GetTotalTime().ToString();
        GameObject.Find("TextTimeLimitAction").GetComponent <Text> ().text = ScormManager.GetTimeLimitAction().ToString();
        GameObject.Find("TextLaunchData").GetComponent <Text> ().text      = ScormManager.GetLaunchData();

        LoadCommentFromLMSList();

        //Score
        GameObject.Find("TextScaledPassingScore").GetComponent <Text> ().text = ScormManager.GetScaledPassingScore().ToString();

        StudentRecord.LearnerScore score = ScormManager.GetScore();
        GameObject.Find("InputFieldMin").GetComponent <InputField> ().text   = score.min.ToString();
        GameObject.Find("InputFieldMax").GetComponent <InputField> ().text   = score.max.ToString();
        GameObject.Find("InputFieldScore").GetComponent <InputField> ().text = score.raw.ToString();

        GameObject.Find("SliderScoreProgressMeasure").GetComponent <Slider> ().value   = ScormManager.GetProgressMeasure();
        GameObject.Find("LabelScoreProgressMeasureAmount").GetComponent <Text> ().text = ScormManager.GetProgressMeasure().ToString();
        //Objectives
        LoadObjectives();

        //Interactions
        LoadLearnerInteractions();

        //Exit
        GameObject.Find("TextCompletionThreshold").GetComponent <Text> ().text = ScormManager.GetCompletionThreshold().ToString();
        switch (ScormManager.GetSuccessStatus())
        {
        case StudentRecord.SuccessStatusType.passed:
            GameObject.Find("TogglePassedFinal").GetComponent <Toggle>().isOn = true;
            break;

        case StudentRecord.SuccessStatusType.failed:
            GameObject.Find("ToggleFailedFinal").GetComponent <Toggle>().isOn = true;
            break;

        case StudentRecord.SuccessStatusType.unknown:
            GameObject.Find("ToggleUnknownFinal").GetComponent <Toggle>().isOn = true;
            break;
        }

        switch (ScormManager.GetCompletionStatus())
        {
        case StudentRecord.CompletionStatusType.completed:
            GameObject.Find("ToggleCompletedFinal").GetComponent <Toggle>().isOn = true;
            break;

        case StudentRecord.CompletionStatusType.incomplete:
            GameObject.Find("ToggleIncompleteFinal").GetComponent <Toggle>().isOn = true;
            break;

        case StudentRecord.CompletionStatusType.not_attempted:
            GameObject.Find("ToggleNotAttemptedFinal").GetComponent <Toggle>().isOn = true;
            break;

        case StudentRecord.CompletionStatusType.unknown:
            GameObject.Find("ToggleUnknownCompletedFinal").GetComponent <Toggle>().isOn = true;
            break;

        case StudentRecord.CompletionStatusType.not_set:
            ScormManager.SetCompletionStatus(StudentRecord.CompletionStatusType.incomplete);                                    // Set this first for every SCORM object, otherwise the LMS tends to treat it as a completed SCO by default
            GameObject.Find("ToggleIncompleteFinal").GetComponent <Toggle>().isOn = true;
            break;
        }
    }
    /// <summary>
    /// Loads the student record.
    /// </summary>
    /// <remarks>This is called on initialise and loads the SCORM data into the StudentRecord object. <see cref="Initialize_imp"/></remarks>
    /// <returns>The StudentRecord student record object.</returns>
    private static StudentRecord LoadStudentRecord()
    {
        studentRecord = new StudentRecord();

        studentRecord.version = scormAPIWrapper.GetValue ("cmi._version");

        //Comments From Learner
        int commentsFromLearnerCount = ParseInt (scormAPIWrapper.GetValue ("cmi.comments_from_learner._count"));
        studentRecord.commentsFromLearner = new List<StudentRecord.CommentsFromLearner>();

        if (commentsFromLearnerCount != 0) {

            for (int i = 0; i < commentsFromLearnerCount; i++) {
                string comment = scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".comment");
                string location = scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".location");
                DateTime timestamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".timestamp") );

                StudentRecord.CommentsFromLearner newRecord = new StudentRecord.CommentsFromLearner();
                newRecord.comment = comment;
                newRecord.location = location;
                newRecord.timeStamp = timestamp;

                studentRecord.commentsFromLearner.Add(newRecord);
            }
        }

        //Comments From LMS
        int commentsFromLMSCount = ParseInt (scormAPIWrapper.GetValue ("cmi.comments_from_lms._count"));
        studentRecord.commentsFromLMS = new List<StudentRecord.CommentsFromLMS>();

        if (commentsFromLMSCount != 0) {

            for (int i = 0; i < commentsFromLMSCount; i++) {
                string comment = scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".comment");
                string location = scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".location");
                DateTime timeStamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".timestamp") );

                StudentRecord.CommentsFromLMS newRecord = new StudentRecord.CommentsFromLMS();
                newRecord.comment = comment;
                newRecord.location = location;
                newRecord.timeStamp = timeStamp;

                studentRecord.commentsFromLMS.Add(newRecord);
            }
        }

        studentRecord.completionStatus = StringToCompletionStatusType (scormAPIWrapper.GetValue ("cmi.completion_status"));
        studentRecord.completionThreshold = ParseFloat(scormAPIWrapper.GetValue ("cmi.completion_threshold"));
        studentRecord.credit = StringToCreditType (scormAPIWrapper.GetValue ("cmi.credit"));
        studentRecord.entry = StringToEntryType (scormAPIWrapper.GetValue ("cmi.entry"));

        //Interactions
        int interactionCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions._count"));
        studentRecord.interactions = new List<StudentRecord.LearnerInteractionRecord>();

        if (interactionCount != 0) {

            for (int i = 0; i < interactionCount; i++) {
                string id = scormAPIWrapper.GetValue ("cmi.interactions."+i+".id");
                StudentRecord.InteractionType type = StringToInteractionType( scormAPIWrapper.GetValue ("cmi.interactions."+i+".type") );
                DateTime timestamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.interactions."+i+".timestamp") );
                float weighting = ParseFloat( scormAPIWrapper.GetValue ("cmi.interactions."+i+".weighting") );
                string response = scormAPIWrapper.GetValue ("cmi.interactions."+i+".learner_response");
                float latency = timeIntervalToSeconds ( scormAPIWrapper.GetValue ("cmi.interactions."+i+".latency") );
                string description = scormAPIWrapper.GetValue ("cmi.interactions."+i+".description");
                float estimate = 0;
                StudentRecord.ResultType result = StringToResultType(scormAPIWrapper.GetValue ("cmi.interactions."+i+".result"), out estimate);

                StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord();
                newRecord.id = id;
                newRecord.type = type;
                newRecord.timeStamp = timestamp;
                newRecord.weighting = weighting;
                newRecord.response = response;
                newRecord.latency = latency;
                newRecord.description = description;
                newRecord.result = result;
                newRecord.estimate = estimate;

                int interactionObjectivesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions."+i+".objectives._count"));
                newRecord.objectives = new List<StudentRecord.LearnerInteractionObjective>();

                if(interactionObjectivesCount != 0) {
                    for (int x = 0; x < interactionObjectivesCount; x++) {
                        StudentRecord.LearnerInteractionObjective newObjective = new StudentRecord.LearnerInteractionObjective();
                        newObjective.id = scormAPIWrapper.GetValue ("cmi.interactions."+i+".objectives."+x+".id");
                        newRecord.objectives.Add(newObjective);
                    }
                }

                int correctResponsesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions."+i+".correct_responses._count"));
                newRecord.correctResponses = new List<StudentRecord.LearnerInteractionCorrectResponse>();

                if(correctResponsesCount != 0) {
                    for (int x = 0; x < correctResponsesCount; x++) {
                        StudentRecord.LearnerInteractionCorrectResponse newCorrectResponse = new StudentRecord.LearnerInteractionCorrectResponse();
                        newCorrectResponse.pattern = scormAPIWrapper.GetValue ("cmi.interactions."+i+".correct_responses."+x+".pattern");
                        newRecord.correctResponses.Add(newCorrectResponse);
                    }
                }

                studentRecord.interactions.Add(newRecord);
            }
        }

        studentRecord.launchData = scormAPIWrapper.GetValue ("cmi.launch_data");
        studentRecord.learnerID = scormAPIWrapper.GetValue ("cmi.learner_id");
        studentRecord.learnerName = scormAPIWrapper.GetValue ("cmi.learner_name");
        //learner_preference
        StudentRecord.LearnerPreference learnerPreference = new StudentRecord.LearnerPreference ();
        learnerPreference.audioLevel =  ParseFloat (scormAPIWrapper.GetValue ("cmi.learner_preference.audio_level"));
        learnerPreference.langauge = scormAPIWrapper.GetValue ("cmi.learner_preference.language");
        learnerPreference.deliverySpeed = ParseFloat (scormAPIWrapper.GetValue ("cmi.learner_preference.delivery_speed"));
        learnerPreference.audioCaptioning = ParseInt (scormAPIWrapper.GetValue ("cmi.learner_preference.audio_captioning"));
        studentRecord.learnerPreference = learnerPreference;

        studentRecord.location = scormAPIWrapper.GetValue ("cmi.location");

        //Objectives
        int objectivesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.objectives._count"));
        studentRecord.objectives = new List<StudentRecord.Objectives> ();

        if (objectivesCount != 0) {
            for (int i = 0; i < objectivesCount; i++) {
                string id = scormAPIWrapper.GetValue ("cmi.objectives."+i+".id");

                StudentRecord.LearnerScore objectivesScore = new StudentRecord.LearnerScore();
                objectivesScore.scaled = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.scaled"));
                objectivesScore.raw = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.raw"));
                objectivesScore.max = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.max"));
                objectivesScore.min = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.min"));

                StudentRecord.SuccessStatusType successStatus = StringToSuccessStatusType(scormAPIWrapper.GetValue ("cmi.objectives."+i+".success_status"));
                StudentRecord.CompletionStatusType completionStatus = StringToCompletionStatusType(scormAPIWrapper.GetValue ("cmi.objectives."+i+".completion_status"));
                float progressMeasure = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".progress_measure"));
                string description = scormAPIWrapper.GetValue ("cmi.objectives."+i+".description");

                StudentRecord.Objectives newRecord = new StudentRecord.Objectives();
                newRecord.id = id;
                newRecord.score = objectivesScore;
                newRecord.successStatus = successStatus;
                newRecord.completionStatus = completionStatus;
                newRecord.progressMeasure = progressMeasure;
                newRecord.description = description;

                studentRecord.objectives.Add(newRecord);
            }
        }

        studentRecord.maxTimeAllowed = timeIntervalToSeconds (scormAPIWrapper.GetValue ("cmi.max_time_allowed"));
        studentRecord.mode = StringToModeType (scormAPIWrapper.GetValue ("cmi.mode"));
        studentRecord.progressMeasure = ParseFloat (scormAPIWrapper.GetValue ("cmi.progress_measure"));
        studentRecord.scaledPassingScore = ParseFloat(scormAPIWrapper.GetValue ("cmi.scaled_passing_score"));
        //Score
        studentRecord.learnerScore = new StudentRecord.LearnerScore ();
        studentRecord.learnerScore.scaled = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.scaled"));
        studentRecord.learnerScore.raw = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.raw"));
        studentRecord.learnerScore.max = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.max"));
        studentRecord.learnerScore.min = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.min"));

        studentRecord.successStatus = StringToSuccessStatusType (scormAPIWrapper.GetValue ("cmi.success_status"));
        studentRecord.suspendData = scormAPIWrapper.GetValue ("cmi.suspend_data");
        studentRecord.timeLimitAction = StringToTimeLimitActionType (scormAPIWrapper.GetValue ("cmi.time_limit_action"));
        studentRecord.totalTime = timeIntervalToSeconds (scormAPIWrapper.GetValue ("cmi.total_time"));

        return studentRecord;
    }