Unity-SCORM Integration Kit
1.0
Integrate Unity3d Projects with your LMS via SCORM
|
Scorm API wrapper. Forms the 'Bridge' between the Unity3D code and the scorm.js code that communicates with teh LMS. More...
Classes | |
class | APICallResult |
This holds the values of the result of the SCORM API Callback from scorm.js More... | |
Public Member Functions | |
ScormAPIWrapper (string obj, string callback) | |
Initializes a new instance of the ScormAPIWrapper class. More... | |
void | Initialize () |
Start up the SCORM API Wrapper. More... | |
void | SetCallbackValue (string input) |
Add a response to a javascript call to the queue. More... | |
string | GetValue (string identifier) |
Get a value from the javascript API More... | |
bool | SetValue (string identifier, string value) |
Set a value on the javascript API More... | |
void | Commit () |
Call the commit function in the javascript layer More... | |
void | Terminate () |
Call the terminate function in the javascript layer More... | |
void | Log (string text) |
Send a log command up to the parent GameObject. The actual implementation of the Log function is up to your own code. More... | |
Public Attributes | |
bool | IsScorm2004 |
Allows interoperability bewteen SCORM 2004 and 1.2 (Not yet implemented) More... | |
Scorm API wrapper. Forms the 'Bridge' between the Unity3D code and the scorm.js code that communicates with teh LMS.
In order for Unity3D to communicate with the LMS, it needs to do so via the scorm.js code located in the HTML that 'wraps' the Unity3D webplayer. Unity allows us to run extrenal calls to the enclosing HTML wrapper via UnityEngine.Application.ExternalCall(). In turn, the HTML wrapper can call Unity3D function via GetUnity().SendMessage(). However, this kind of communication is asynchronous, which makes it difficult to get return values from a call to the HTML wrapper back into the calling Unity3D function. (E.g. if you call a GetValue() to the LMS via scorm.js, how do you get the result?
This ScormAPI wrapper class allows calls to scorm.js appear to be synchronous by doing the following:
ScormAPIWrapper.ScormAPIWrapper | ( | string | obj, |
string | callback | ||
) |
Initializes a new instance of the ScormAPIWrapper class.
obj | Callback object name. |
callback | Callback function name. |
void ScormAPIWrapper.Commit | ( | ) |
Call the commit function in the javascript layer
string ScormAPIWrapper.GetValue | ( | string | identifier | ) |
Get a value from the javascript API
Implements the interface to the SCORM API, and looks syncronous to the caller. TODO: (This is where you would implement the 2004/1.2 conversion)
identifier | The dot notation identifier of the data model element to get |
void ScormAPIWrapper.Initialize | ( | ) |
Start up the SCORM API Wrapper.
This will check with the Javascript layer to see if it's executing in a 1.2 or 2004 LMS
void ScormAPIWrapper.Log | ( | string | text | ) |
Send a log command up to the parent GameObject. The actual implementation of the Log function is up to your own code.
text | the text to log |
void ScormAPIWrapper.SetCallbackValue | ( | string | input | ) |
Add a response to a javascript call to the queue.
The ScormManager will add messages from the javascript layer to the queue, which will be processed by the other thread.
bool ScormAPIWrapper.SetValue | ( | string | identifier, |
string | value | ||
) |
Set a value on the javascript API
Implements the interface to the SCORM API, and looks syncronous to the caller.
identifier | The dot notation identifier of the data model element to set. |
value | Value to set |
void ScormAPIWrapper.Terminate | ( | ) |
Call the terminate function in the javascript layer
bool ScormAPIWrapper.IsScorm2004 |
Allows interoperability bewteen SCORM 2004 and 1.2 (Not yet implemented)