Unity-SCORM Integration Kit
1.0
Integrate Unity3d Projects with your LMS via SCORM
|
The main interface between your Unity3D code and the SCORM API (via the ScormManager and the ScormAPIWrapper). More...
Public Member Functions | |
void | ScormValueCallback (string value) |
Used for the Javascript layer to communicate back to the Unity layer. More... | |
void | LogMessage (object text) |
Log a message. More... | |
Static Public Member Functions | |
static void | Initialize () |
Read the student data in from the LMS More... | |
static bool | CheckThread () |
Check that the running thread is not the Unity Thread More... | |
static void | Commit () |
Call the final Commit. It is the responsibility of the users of this class to write data to the LMS as you go (i.e. call SetValue()) More... | |
static void | Terminate () |
Close the course. Be sure to call Commit first if you want to save your data. More... | |
static void | DoLogMessage (object text) |
For local logging and debugging from this class More... | |
static StudentRecord.CompletionStatusType | GetCompletionStatus () |
Gets the completion status. More... | |
static void | SetCompletionStatus (StudentRecord.CompletionStatusType value) |
Sets the completion status. More... | |
static string | GetVersion () |
Gets the version. More... | |
static List< StudentRecord.CommentsFromLearner > | GetCommentsFromLearner () |
Gets the comments from learner. More... | |
static void | AddCommentFromLearnerByFields (string commentText, string location) |
static List< StudentRecord.CommentsFromLMS > | GetCommentsFromLMS () |
Gets the comments from LMS. More... | |
static void | AddCommentFromLearner (StudentRecord.CommentsFromLearner comment) |
Adds the comment from learner. More... | |
static void | UpdateCommentFromLearner (int index, StudentRecord.CommentsFromLearner comment) |
Updates the comment from learner. More... | |
static float | GetCompletionThreshold () |
Gets the completion thershold. More... | |
static StudentRecord.CreditType | GetCredit () |
Gets the credit. More... | |
static StudentRecord.EntryType | GetEntry () |
Gets the entry. More... | |
static void | SetExit (StudentRecord.ExitType value) |
Sets the exit. More... | |
static List< StudentRecord.LearnerInteractionRecord > | GetInteractions () |
Gets the interactions. More... | |
static void | AddInteraction (StudentRecord.LearnerInteractionRecord interaction) |
Adds to the interactions. More... | |
static string | GetNextInteractionId () |
static void | UpdateInteraction (int index, StudentRecord.LearnerInteractionRecord interaction) |
Updates the interaction. More... | |
static string | GetLaunchData () |
Gets the launch data. More... | |
static string | GetLearnerId () |
Gets the learner identifier. More... | |
static string | GetLearnerName () |
Gets the name of the learner. More... | |
static StudentRecord.LearnerPreference | GetLearnerPreference () |
Gets the learner preference. More... | |
static void | SetLearnerPreference (StudentRecord.LearnerPreference learnerPreference) |
Sets the learner preference. More... | |
static float | GetLearnerPreferenceAudioLevel () |
Gets the learner preference audio level. More... | |
static void | SetLearnerPreferenceAudioLevel (float value) |
Sets the learner preference audio level. More... | |
static string | GetLearnerPreferenceLanguage () |
Gets the learner preference language. More... | |
static void | SetLearnerPreferenceLanguage (string value) |
Sets the learner preference language. More... | |
static float | GetLearnerPreferenceDeliverySpeed () |
Gets the learner preference delivery speed. More... | |
static void | SetLearnerPreferenceDeliverySpeed (float value) |
Sets the learner preference delivery speed. More... | |
static int | GetLearnerPreferenceAudioCaptioning () |
Gets the learner preference audio captioning. More... | |
static void | SetLearnerPreferenceAudioCaptioning (int value) |
Sets the learner preference audio captioning. More... | |
static string | GetLocation () |
Gets the location. More... | |
static void | SetLocation (string value) |
Sets the location. More... | |
static List< StudentRecord.Objectives > | GetObjectives () |
static void | AddObjective (StudentRecord.Objectives objective) |
Adds the objective. More... | |
static void | UpdateObjective (int index, StudentRecord.Objectives objective) |
Updates the objective. More... | |
static float | GetMaxTimeAllowed () |
Gets the max time allowed. More... | |
static StudentRecord.ModeType | GetMode () |
Gets the mode. More... | |
static float | GetProgressMeasure () |
Gets the progress measure. More... | |
static void | SetProgressMeasure (float value) |
Sets the progress measure. More... | |
static float | GetScaledPassingScore () |
Gets the scaled passing score. More... | |
static StudentRecord.LearnerScore | GetScore () |
Gets the score. More... | |
static void | SetScore (StudentRecord.LearnerScore learnerScore) |
Sets the score. More... | |
static float | GetScoreScaled () |
Gets the score scaled. More... | |
static void | SetScoreScaled (float value) |
Sets the score scaled. More... | |
static float | GetScoreRaw () |
Gets the score raw. More... | |
static void | SetScoreRaw (float value) |
Sets the score raw. More... | |
static float | GetScoreMax () |
Gets the score max. More... | |
static void | SetScoreMax (float value) |
Sets the score max. More... | |
static float | GetScoreMin () |
Gets the score minimum. More... | |
static void | SetScoreMin (float value) |
Sets the score minimum. More... | |
static void | SetSessionTime (float value) |
Sets the session time. More... | |
static StudentRecord.SuccessStatusType | GetSuccessStatus () |
Gets the success status. More... | |
static void | SetSuccessStatus (StudentRecord.SuccessStatusType value) |
Sets the success status. More... | |
static string | GetSuspendData () |
Gets the suspend data. More... | |
static void | SetSuspendData (string value) |
Sets the suspend data. More... | |
static StudentRecord.TimeLimitActionType | GetTimeLimitAction () |
Gets the time limit action. More... | |
static float | GetTotalTime () |
Gets the total time. More... | |
static string | CustomTypeToString (object value) |
Custom type to string. Basically changes "not_set" to an empty string. More... | |
static StudentRecord.ResultType | StringToResultType (string str, out float estimate) |
Convert string to the StudentRecord ResultType. Pass the estimate as an out parameter so that it can be set to a float value if needed. More... | |
static StudentRecord.InteractionType | StringToInteractionType (string str) |
Convert string to the StudentRecord InteractionType. More... | |
The main interface between your Unity3D code and the SCORM API (via the ScormManager and the ScormAPIWrapper).
|
static |
Adds the comment from learner.
comment | StudentRecord.CommentsFromLearner object. |
Usage:
StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner ();
comment.comment = "The comment";
comment.location = "The location (bookmark) in the SCO";
ScormManager.AddCommentFromLearner(comment);
|
static |
|
static |
Adds to the interactions.
interaction | Interaction (StudentRecord.LearnerInteractionRecord). |
Usage:
StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord();
newRecord.type = StudentRecord.InteractionType.other;
newRecord.timeStamp = DateTime.Now;
newRecord.weighting = 0.5f;
newRecord.response = "true";
newRecord.latency = 12f;
newRecord.description = "Is this easy to use?";
newRecord.result = StudentRecord.ResultType.correct;
newRecord.estimate = 1f; //Not used
ScormManager.AddInteraction (newRecord);
|
static |
Adds the objective.
Contains:
objective | StudentRecord.Objectives objective. |
Usage:
StudentRecord.Objectives newRecord = new StudentRecord.Objectives();
StudentRecord.LearnerScore newScore = new StudentRecord.LearnerScore ();
newScore.scaled = 0.8f;
newScore.raw = 80f;
newScore.max = 100f;
newScore.min = 0f;
newRecord.score = newScore;
newRecord.successStatus = StudentRecord.SuccessStatusType.passed;
newRecord.completionStatus = StudentRecord.CompletionStatusType.completed;
newRecord.progressMeasure = 1f;
newRecord.description = "The description of this objective";
ScormManager.AddObjective(newRecord);
|
static |
Check that the running thread is not the Unity Thread
Running some of the ScormManager function in the Unity thread will block the unity message queue resulting in deadlock. This checks to make sure that will not occur.
|
static |
Call the final Commit. It is the responsibility of the users of this class to write data to the LMS as you go (i.e. call SetValue())
Calls Commit on scorm.js. Launchs a seperate thread for the work - will fire "Scorm_Commit_Complete" when operation is complete.
|
static |
Custom type to string. Basically changes "not_set" to an empty string.
value | Value. |
|
static |
For local logging and debugging from this class
text | Text. |
|
static |
Gets the comments from learner.
The collection of comments made by the learner.
|
static |
Gets the comments from LMS.
The collection of comments made by the LMS.
|
static |
Gets the completion status.
cmi.completion_status (“completed”, “incomplete”, “not attempted”, “unknown”, RW) Indicates whether the learner has completed the SCO
|
static |
Gets the completion thershold.
cmi.completion_threshold (real(10,7) range (0..1), RO) Used to determine whether the SCO should be considered complete
|
static |
Gets the credit.
cmi.credit (“credit”, “no-credit”, RO) Indicates whether the learner will be credited for performance in the SCO
Usage:
StudentRecord.CreditType credit = ScormManager.GetCredit (); or
string credit = ScormManager.CustomTypeToString (ScormManager.GetCredit ());
|
static |
Gets the entry.
cmi.entry (ab_initio, resume, “”, RO) Asserts whether the learner has previously accessed the SCO
Usage:
StudentRecord.EntryType entry = ScormManager.GetEntry (); or
string entry = ScormManager.CustomTypeToString (ScormManager.GetEntry ());
|
static |
Gets the interactions.
Usage:
List<StudentRecord.LearnerInteractionRecord> interactions = ScormManager.GetInteractions ();
for (int i=0; i < interactions.Count; i++) {
string id = interactions[i].id;
string type = CustomTypeToString (interactions[i].type);
string timeStamp = String.Format("{0:s}", interactions[i].timeStamp);
string weighting = interactions[i].weighting.ToString();
string learnerResponse = interactions[i].response;
string result = CustomTypeToString (interactions[i].result);
string estimate = interaction.estimate.ToString();
string latency = secondsToTimeInterval(interactions[i].latency);
string description = interactions[i].description;
int objectivesCount = interactions[i].objectives.Count;
if(objectivesCount != 0) {
for (int x = 0; x < objectivesCount; i++) {
string objectiveId = interactions[i].objectives[x];
//Do something with the objective id here
}
}
int correctResponsesCount = interactions[i].correctResponses.Count;
if(correctResponsesCount != 0) {
for (int x = 0; x < correctResponsesCount; i++) {
string correctResponsePattern = interactions[i].correctResponses[x];
//Do something with the correct response pattern here
}
}
}
|
static |
Gets the launch data.
|
static |
Gets the learner identifier.
|
static |
Gets the name of the learner.
|
static |
Gets the learner preference.
Contains:
Usage:
StudentRecord.LearnerPreference learnerPreference = ScormManager.GetLearnerPreference;
int audioCaptioning = learnerPreference.audioCaptioning;
|
static |
Gets the learner preference audio captioning.
cmi.learner_preference.audio_captioning (“-1″, “0″, “1″, RW) Specifies whether captioning text corresponding to audio is displayed
|
static |
Gets the learner preference audio level.
cmi.learner_preference.audio_level (real(10,7), range (0..*), RW) Specifies an intended change in perceived audio level
|
static |
Gets the learner preference delivery speed.
cmi.learner_preference.delivery_speed (real(10,7), range (0..*), RW) The learner’s preferred relative speed of content delivery
|
static |
Gets the learner preference language.
cmi.learner_preference.language (language_type (SPM 250), RW) The learner’s preferred language for SCOs with multilingual capability
|
static |
Gets the location.
cmi.location (characterstring (SPM: 1000), RW) The learner’s current location in the SCO
|
static |
Gets the max time allowed.
cmi.max_time_allowed (timeinterval (second,10,2), RO) Amount of accumulated time the learner is allowed to use a SCO
|
static |
Gets the mode.
cmi.mode (“browse”, “normal”, “review”, RO) Identifies one of three possible modes in which the SCO may be presented to the learner
|
static |
|
static |
|
static |
Gets the progress measure.
cmi.progress_measure (real (10,7) range (0..1), RW) Measure of the progress the learner has made toward completing the SCO
|
static |
Gets the scaled passing score.
cmi.scaled_passing_score (real(10,7) range (-1 .. 1), RO) Scaled passing score required to master the SCO
|
static |
Gets the score.
Contains:
|
static |
Gets the score max.
cmi.score.max (real (10,7), RW) Maximum value in the range for the raw score
|
static |
Gets the score minimum.
cmi.score.min (real (10,7), RW) Minimum value in the range for the raw score
|
static |
Gets the score raw.
cmi.score.raw (real (10,7), RW) Number that reflects the performance of the learner relative to the range bounded by the values of min and max
|
static |
Gets the score scaled.
cmi.score.scaled (real (10,7) range (-1..1), RW) Number that reflects the performance of the learner
|
static |
Gets the success status.
cmi.success_status (“passed”, “failed”, “unknown”, RW) Indicates whether the learner has mastered the SCO
|
static |
Gets the suspend data.
cmi.suspend_data (characterstring (SPM: 64000), RW) Provides space to store and retrieve data between learner sessions
|
static |
Gets the time limit action.
cmi.time_limit_action (“exit,message”, “continue,message”, “exit,no message”, “continue,no message”, RO) Indicates what the SCO should do when cmi.max_time_allowed is exceeded
|
static |
Gets the total time.
cmi.total_time (timeinterval (second,10,2), RO) Sum of all of the learner’s session times accumulated in the current learner attempt
|
static |
Gets the version.
cmi._version (characterstring, RO) Represents the version of the data model
|
static |
Read the student data in from the LMS
Launches a seperate thread. Calls the javascript layer to read in all the data. Will fire "Scorm_Initialize_Complete" when the StudentRecord datamodel is ready to be manipulated
void ScormManager.LogMessage | ( | object | text | ) |
Log a message.
text | The string value to log. |
Simply sends the log data down to child objects, which should handle the logging tasks.
void ScormManager.ScormValueCallback | ( | string | value | ) |
Used for the Javascript layer to communicate back to the Unity layer.
value | A string in the format "value|number" where the number is the identifier of the Set or Get operation issued by the ScormAPIWrapper bridge, and the value is the result of that API call |
The javascript layer uses the name of the ScormManager object and the name of this function to return the results of an operation on the javascript API to the ScormAPIWrapper bridge. The number in the input string is used by the ScormAPIWrapper bridge to figure out what API call this message answers. This complexity is due to the asyncronous nature of the UNITY/Javascript interface.
|
static |
Sets the completion status.
cmi.completion_status (“completed”, “incomplete”, “not attempted”, “unknown”, RW) Indicates whether the learner has completed the SCO
value | StudentRecord.CompletionStatusType object. |
|
static |
Sets the exit.
value | The StudentRecord.ExitType value. |
Usage:
ScormManager.SetExit(StudentRecord.ExitType.suspend);
|
static |
Sets the learner preference.
learnerPreference | Learner preference. |
Usage:
StudentRecord.LearnerPreference learnerPreference = new StudentRecord.LearnerPreference();
learnerPreference.audioLevel = 1.1;
learnerPreference.deliverySpeed = 1f;
learnerPreference.audioCaptioning = 0;
learnerPreference.langauge = "";
ScormManager.SetLearnerPreference(learnerPreference);
|
static |
Sets the learner preference audio captioning.
value | integer Value. |
|
static |
Sets the learner preference audio level.
value | float Value. |
|
static |
Sets the learner preference delivery speed.
value | float Value. |
|
static |
Sets the learner preference language.
value | string Value. |
|
static |
Sets the location.
value | string location (bookmark) value. |
|
static |
Sets the progress measure.
value | float Value. |
|
static |
Sets the score.
learnerScore | Learner score. |
|
static |
Sets the score max.
value | floatValue. |
|
static |
Sets the score minimum.
value | float Value. |
|
static |
Sets the score raw.
value | float Value. |
|
static |
Sets the score scaled.
value | float Value. |
|
static |
Sets the session time.
cmi.session_time (timeinterval (second,10,2), WO) Amount of time that the learner has spent in the current learner session for this SCO
value | float session time in seconds. |
|
static |
Sets the success status.
value | StudentRecord.SuccessStatusType Value. |
|
static |
Sets the suspend data.
value | string Value. |
|
static |
Convert string to the StudentRecord InteractionType.
str | String. |
|
static |
Convert string to the StudentRecord ResultType. Pass the estimate as an out parameter so that it can be set to a float value if needed.
str | String. |
estimate | Estimate. |
|
static |
Close the course. Be sure to call Commit first if you want to save your data.
Will cause the browser to close the window, and signal to the LMS that the course is over. Be sure to save your data to the LMS by calling Commit first, then waiting for Scorm_Commit_Complete.
|
static |
Updates the comment from learner.
index | Index of the comment to update. |
comment | StudentRecord.CommentsFromLearner object. |
Usage:
int index = 1;
StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner ();
comment.comment = "The comment";
comment.location = "The location (bookmark) in the SCO";
ScormManager.UpdateCommentFromLearner(index, comment);
|
static |
Updates the interaction.
index | Index. |
interaction | Interaction (StudentRecord.LearnerInteractionRecord). |
Usage:
int index = 0; StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord();
newRecord.type = StudentRecord.InteractionType.other;
newRecord.timeStamp = DateTime.Now;
newRecord.weighting = 0.5f;
newRecord.response = "true";
newRecord.latency = 12f;
newRecord.description = "Is this easy to use?";
newRecord.result = StudentRecord.ResultType.correct;
newRecord.estimate = 1f; //Not used
ScormManager.UpdateInteraction (index, newRecord);
|
static |
Updates the objective.
index | Integer Index. |
objective | StudentRecord.Objectives objective. |
Usage:
StudentRecord.Objectives newRecord = new StudentRecord.Objectives();
StudentRecord.LearnerScore newScore = new StudentRecord.LearnerScore ();
newScore.scaled = 0.8f;
newScore.raw = 80f;
newScore.max = 100f;
newScore.min = 0f;
newRecord.score = newScore;
newRecord.successStatus = StudentRecord.SuccessStatusType.passed;
newRecord.completionStatus = StudentRecord.CompletionStatusType.completed;
newRecord.progressMeasure = 1f;
newRecord.description = "The description of this objective";
ScormManager.UpdateObjective(1, newRecord);