Example #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;
    }
    ///<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;
    }