예제 #1
0
    ///<summary>
    ///Internal implementation of communication with the LMS
    ///</summary>
    ///<remarks>
    ///Read all the data from the LMS into the internal data structure. Runs in a seperate thread.
    ///Will fire "Scorm_Initialize_Complete" when the datamodel is ready to be manipulated
    ///</remarks> 
    private static void Initialize_imp(  )
    {
        if(!CheckThread())return;

        ScormBridge = new Unity_ScormBridge(ObjectName,"ScormValueCallback");
        ScormBridge.Initialize();

        try{
            if(ScormBridge.IsScorm2004)
            {
                StudentRecord = new Scorm2004.DataModel();
                ScormDeSerializer deserializer = new ScormDeSerializer(StudentRecord);
                StudentRecord = (Scorm2004.DataModel)deserializer.Deserialize(ScormBridge);
            }else
            {
                Scorm1_2.DataModel tempStudentRecord = new Scorm1_2.DataModel();
                ScormDeSerializer deserializer = new ScormDeSerializer(tempStudentRecord);
                tempStudentRecord = (Scorm1_2.DataModel)deserializer.Deserialize(ScormBridge);
                StudentRecord = ScormVersionConversion.DataModel.Translate(tempStudentRecord);
            }
        }catch(Exception e)
        {
            UnityEngine.Application.ExternalCall("DebugPrint", "***ERROR***" + e.Message +"<br/>" + e.StackTrace + "<br/>" + e.Source );
        }
        Initialized = true;
    }
        public static Scorm1_2.DataModel GetTestData1_2()
        {
            Scorm1_2.DataModel data = new Scorm1_2.DataModel();
            data.comments = "these are comments!";
            data.comments_from_lms = "these are commetns from the lms";
            data.core = new coreType();
            data.core.credit = Scorm1_2.credit.credit;
            data.core.entry = Scorm1_2.entry.ab_initio;
            data.core.lesson_location = "location data";
            data.core.lesson_mode = Scorm1_2.mode.review;
            data.core.lesson_status = lessonStatusType.passed;
            data.core.score = new Scorm1_2.scoreType();
            data.core.score.max = new decimal(12);
            data.core.score.min = new decimal(1);
            data.core.score.raw = new decimal(32);
            data.core.session_time = new Scorm1_2.TimeSpan(new System.TimeSpan(0, 0, 100,1));
            data.core.student_id = "sdasdf";
            data.core.student_name = "Jono";
            data.core.total_time = new Scorm1_2.TimeSpan(new System.TimeSpan(1, 1,1,0));
            data.interactions = new List<Scorm1_2.interactionType>();
            data.interactions.Add(new Scorm1_2.interactionType());
            data.interactions[0].id = "asdf";
            data.interactions[0].latency = "asdf";
            data.interactions[0].objectives = new List<Scorm1_2.objectiveIDType>();
            data.interactions[0].objectives.Add(new Scorm1_2.objectiveIDType("adsffa"));
            data.interactions[0].objectives.Add(new Scorm1_2.objectiveIDType("fdfa"));
            data.interactions[0].result = Scorm1_2.interactionTypeResult.correct;
            data.interactions[0].student_response = new studentResponseTypeStudentResponseFillIn();
            ((studentResponseTypeStudentResponseFillIn)data.interactions[0].student_response).Value = "asdf";
            data.interactions[0].time = new Scorm1_2.DateTime(System.DateTime.Now);
            data.interactions[0].type = Scorm1_2.interactionTypeType.fill_in;
            data.interactions[0].weighting = new decimal(1);

            data.interactions.Add(new Scorm1_2.interactionType());
            data.interactions[1].id = "otherid";
            data.interactions[1].latency = "lat";
            data.interactions[1].objectives = new List<Scorm1_2.objectiveIDType>();
            data.interactions[1].objectives.Add(new Scorm1_2.objectiveIDType("obj0"));
            data.interactions[1].objectives.Add(new Scorm1_2.objectiveIDType("obj1"));
            data.interactions[1].result = Scorm1_2.interactionTypeResult.unanticipated;
            data.interactions[1].student_response = new studentResponseTypeStudentResponseFillIn();
            ((studentResponseTypeStudentResponseFillIn)data.interactions[0].student_response).Value = "otherdata";
            data.interactions[1].time = new Scorm1_2.DateTime(System.DateTime.Now);
            data.interactions[1].type = Scorm1_2.interactionTypeType.fill_in;
            data.interactions[1].weighting = new decimal(14);

            data.launch_data = "asdfasdfasdfasfa";
            data.objectives = new List<Scorm1_2.objectiveType>();
            data.objectives.Add(new Scorm1_2.objectiveType());
            data.objectives[0].id = "asdf";
            data.objectives[0].score = new Scorm1_2.scoreType();
            data.objectives[0].score.max = new decimal(1);
            data.objectives[0].score.min = new decimal(0);
            data.objectives[0].score.raw = new decimal(.5);
            data.objectives[0].status = lessonStatusType.completed;

            data.objectives.Add(new Scorm1_2.objectiveType());
            data.objectives[1].id = "otehr id";
            data.objectives[1].score = new Scorm1_2.scoreType();
            data.objectives[1].score.max = new decimal(.1);
            data.objectives[1].score.min = new decimal(0.4);
            data.objectives[1].score.raw = new decimal(.58);
            data.objectives[1].status = lessonStatusType.incomplete;

            data.objectives.Add(new Scorm1_2.objectiveType());
            data.objectives[2].id = "otehr id2";
            data.objectives[2].score = new Scorm1_2.scoreType();
            data.objectives[2].score.max = new decimal(1.1);
            data.objectives[2].score.min = new decimal(10.4);
            data.objectives[2].score.raw = new decimal(1.58);
            data.objectives[2].status = lessonStatusType.passed;

            data.student_data = new studentDataType();
            data.student_data.mastery_score = new decimal(1);
            data.student_data.max_time_allowed = new Scorm1_2.TimeSpan(new System.TimeSpan(1,1,1,1));
            data.student_data.time_limit_action = Scorm1_2.timeLimitAction.continue_message;
            data.student_preference = new studentPreferenceType();
            data.student_preference.audio = new decimal(0);
            data.student_preference.text = Scorm1_2.learnerPreferenceAudioCaptioning.no_change;
            data.student_preference.language = "engl";
            data.student_preference.speed = 342;
            data.suspend_data = "asdfasdfadsf";

            return data;
        }
        public static Scorm1_2.DataModel GetTestData1_2()
        {
            Scorm1_2.DataModel data = new Scorm1_2.DataModel();
            data.comments          = "these are comments!";
            data.comments_from_lms = "these are commetns from the lms";
            data.core                 = new coreType();
            data.core.credit          = Scorm1_2.credit.credit;
            data.core.entry           = Scorm1_2.entry.ab_initio;
            data.core.lesson_location = "location data";
            data.core.lesson_mode     = Scorm1_2.mode.review;
            data.core.lesson_status   = lessonStatusType.passed;
            data.core.score           = new Scorm1_2.scoreType();
            data.core.score.max       = new decimal(12);
            data.core.score.min       = new decimal(1);
            data.core.score.raw       = new decimal(32);
            data.core.session_time    = new Scorm1_2.TimeSpan(new System.TimeSpan(0, 0, 100, 1));
            data.core.student_id      = "sdasdf";
            data.core.student_name    = "Jono";
            data.core.total_time      = new Scorm1_2.TimeSpan(new System.TimeSpan(1, 1, 1, 0));
            data.interactions         = new List <Scorm1_2.interactionType>();
            data.interactions.Add(new Scorm1_2.interactionType());
            data.interactions[0].id         = "asdf";
            data.interactions[0].latency    = "asdf";
            data.interactions[0].objectives = new List <Scorm1_2.objectiveIDType>();
            data.interactions[0].objectives.Add(new Scorm1_2.objectiveIDType("adsffa"));
            data.interactions[0].objectives.Add(new Scorm1_2.objectiveIDType("fdfa"));
            data.interactions[0].result           = Scorm1_2.interactionTypeResult.correct;
            data.interactions[0].student_response = new studentResponseTypeStudentResponseFillIn();
            ((studentResponseTypeStudentResponseFillIn)data.interactions[0].student_response).Value = "asdf";
            data.interactions[0].time      = new Scorm1_2.DateTime(System.DateTime.Now);
            data.interactions[0].type      = Scorm1_2.interactionTypeType.fill_in;
            data.interactions[0].weighting = new decimal(1);


            data.interactions.Add(new Scorm1_2.interactionType());
            data.interactions[1].id         = "otherid";
            data.interactions[1].latency    = "lat";
            data.interactions[1].objectives = new List <Scorm1_2.objectiveIDType>();
            data.interactions[1].objectives.Add(new Scorm1_2.objectiveIDType("obj0"));
            data.interactions[1].objectives.Add(new Scorm1_2.objectiveIDType("obj1"));
            data.interactions[1].result           = Scorm1_2.interactionTypeResult.unanticipated;
            data.interactions[1].student_response = new studentResponseTypeStudentResponseFillIn();
            ((studentResponseTypeStudentResponseFillIn)data.interactions[0].student_response).Value = "otherdata";
            data.interactions[1].time      = new Scorm1_2.DateTime(System.DateTime.Now);
            data.interactions[1].type      = Scorm1_2.interactionTypeType.fill_in;
            data.interactions[1].weighting = new decimal(14);

            data.launch_data = "asdfasdfasdfasfa";
            data.objectives  = new List <Scorm1_2.objectiveType>();
            data.objectives.Add(new Scorm1_2.objectiveType());
            data.objectives[0].id        = "asdf";
            data.objectives[0].score     = new Scorm1_2.scoreType();
            data.objectives[0].score.max = new decimal(1);
            data.objectives[0].score.min = new decimal(0);
            data.objectives[0].score.raw = new decimal(.5);
            data.objectives[0].status    = lessonStatusType.completed;

            data.objectives.Add(new Scorm1_2.objectiveType());
            data.objectives[1].id        = "otehr id";
            data.objectives[1].score     = new Scorm1_2.scoreType();
            data.objectives[1].score.max = new decimal(.1);
            data.objectives[1].score.min = new decimal(0.4);
            data.objectives[1].score.raw = new decimal(.58);
            data.objectives[1].status    = lessonStatusType.incomplete;

            data.objectives.Add(new Scorm1_2.objectiveType());
            data.objectives[2].id        = "otehr id2";
            data.objectives[2].score     = new Scorm1_2.scoreType();
            data.objectives[2].score.max = new decimal(1.1);
            data.objectives[2].score.min = new decimal(10.4);
            data.objectives[2].score.raw = new decimal(1.58);
            data.objectives[2].status    = lessonStatusType.passed;


            data.student_data = new studentDataType();
            data.student_data.mastery_score     = new decimal(1);
            data.student_data.max_time_allowed  = new Scorm1_2.TimeSpan(new System.TimeSpan(1, 1, 1, 1));
            data.student_data.time_limit_action = Scorm1_2.timeLimitAction.continue_message;
            data.student_preference             = new studentPreferenceType();
            data.student_preference.audio       = new decimal(0);
            data.student_preference.text        = Scorm1_2.learnerPreferenceAudioCaptioning.no_change;
            data.student_preference.language    = "engl";
            data.student_preference.speed       = 342;
            data.suspend_data = "asdfasdfadsf";



            return(data);
        }