- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试让 SCORM 1.2 与我们的 Unity 5 WebGL 项目配合使用。
我想我会逐步引入SCORM代码;这是我想要“翻译”的代码,以便它可以在 Unity 中运行:
var vault = {}; //vault 'namespace' helps ensure no conflicts with possible other "SCORM" variables
vault.UTILS = {}; //For holding UTILS functions
vault.debug = { isActive: true }; //Enable (true) or disable (false) for debug mode
vault.SCORM = { //Define the SCORM object
version: null, //Store SCORM version.
handleCompletionStatus: true, //Whether or not the wrapper should automatically handle the initial completion status
handleExitMode: true, //Whether or not the wrapper should automatically handle the exit mode
API:{handle: null, isFound: false}, //Create API child object
connection: { isActive: false }, //Create connection child object
data: { completionStatus: null, exitStatus: null}, //Create data child object
debug:{} //Create debug child object
};
当我按原样使用该代码时,Unity 告诉我“Utils”不是“Boo.Lang.Hash”的成员
好的。有人告诉我应该使用哈希表而不是普通的 javascript 对象。这是我到目前为止所得到的:
var vault:Hashtable = new Hashtable(); //vault 'namespace' helps ensure no conflicts with possible other "SCORM" variables
vault['UTILS'] = new Hashtable(); //For holding UTILS functions
vault['debug'] = new Hashtable(); //Enable (true) or disable (false) for debug mode
vault['debug']['isActive'] = true;
vault['SCORM'] = { //Define the SCORM object
version: null, //Store SCORM version.
handleCompletionStatus: true, //Whether or not the wrapper should automatically handle the initial completion status
handleExitMode: true, //Whether or not the wrapper should automatically handle the exit mode
API:{handle: null, isFound: false}, //Create API child object
connection: { isActive: false }, //Create connection child object
data: { completionStatus: null, exitStatus: null}, //Create data child object
debug:{} //Create debug child object
};
但是现在 Unity 抛出以下错误:
Type 'Object' does not support slicing
....在 vault['debug']['isActive'] = true;
行。
那么 - 如何向嵌套在变量中的哈希表添加属性?
最佳答案
我最终遵循了此页面的建议:
https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
它建议将外部 .js 文件正常加载到包含的 html 文件中(您必须设置自定义 WebGL html 模板才能执行此操作),然后您可以使用 C# 调用这些 .js 函数:
Application.ExternalCall("functionName", "parameter");
您还可以从外部 .js 文件调用 GameObjects 脚本组件中的 C# 函数:
SendMessage (GameObjectName, 'functionName', 'parameter');
因此,我将所有直接 SCORM 交互封装在 SCORM.js 文件中 - 它使所有 LMSSetValue('cmi.objectives... 和 LMSGetValue("cmi.core.lesson_status... 更新和管理哪些目标之前已经完成。Unity 只是告诉 SCORM 它应该初始化哪些目标。一切正常。
已排序!
关于javascript - 转换 SCORM.js 以与 Unity 5 配合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39575267/
自定义限流注解 先介绍一下 @Retention 和 @Target 这两个元注解 @Retention: 指定注解的生命周期(源码、class文件、运行时),其参考值见类的定义:java.lang.
在 Ubuntu 13.10 中使用 PyCharm Community Edition 和 IdeaVim 时,键盘经常停止接受输入,我必须重新启动 IDE。当我单击不同的文本区域时,光标仍然会移动
我正在开发一个Java项目,我试图让useDelimiter删除除“=”和“,”之间的文本之外的所有内容。例如,在文件的第一行我想保留“ThermostatNight”。 文本文件如下所示: E
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
目录 1、加入 remember-me 2、原理分析 自动登录是我们在软件开发时一个非常常见的功能,例如我们登录 QQ 邮箱: 很多网站我们在登录的时
我是开发 Android 应用程序的菜鸟。我想问一下。我的 PreferenceActivity 如何希望在不返回 MainActivity 并再次转到 PreferenceActivity 的情况下
1. 前言 大家好,我是安果! 我们都知道 Python 可以用来开发桌面应用,一旦功能开发完成,最后打包的可执行文件体积大,并且使用 Python 开发桌面应用周期相对较长 假如想快速开
我正在为命令行应用程序编写一个非常简单的 GUI 工具。它只有 2 个按钮。 连接并退出。 在 applicationDidFinishLaunching 中,我运行以下命令 NSPipe *pipe
我也在 LibGDX forums 上发布了这个问题. 嘿那里!在我的论文中,我正在编写一个 DSL 来描述图片的外观。这些图片将由 libGDX 根据 DSL-Input 绘制。目前,jetbrai
准备 SpringBoot 工程 1.新建 SpringBoot 项目,默认的端口是 8080 ,新建 Controller 和 Mapping @RestControllerpublic cla
我有类似的问题 this one 以下是我使用的: CDH4.4(配置单元 0.10) protobuf-java-.2.4.1.jar elephant-bird-hive-4.6-SNAPSHOT
我想使用 angularjs 和 angular-ui(特别是 ui-select2 功能)实现对选择输入的读/写访问控制。 场景很简单:通过使用 ng-readonly 属性,我可以控制用户是否可以
我是一名优秀的程序员,十分优秀!