Comparing version 1.0.17 to 1.0.18
107
JS/ab3d.js
@@ -26,6 +26,3 @@ | ||
development(); | ||
} else if (param.edition == "localDebugging") { | ||
localDebugging(); | ||
} | ||
else { | ||
} else { | ||
release(); | ||
@@ -35,5 +32,5 @@ } | ||
function release() { | ||
db.cacheFile(param.host + "AB3DEngine.data").then((data) => { | ||
db.cacheFile(param.host + "AB3DEngine.wasm").then((wasm) => { | ||
script.setAttribute('src', param.host + 'AB3DEngine.loader.js'); | ||
db.cacheFile(param.assetsUrl + "AB3DEngine.data").then((data) => { | ||
db.cacheFile(param.assetsUrl + "AB3DEngine.wasm").then((wasm) => { | ||
script.setAttribute('src', param.assetsUrl + 'AB3DEngine.loader.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
@@ -53,25 +50,5 @@ script.onload = () => { | ||
unityInstance.parentNode = parentNode; | ||
db.cacheFile(param.host + "library").then((library) => { | ||
AB3D.interface = new Interface(unityInstance, db, library, param.succeed); | ||
unityInstance.Invoke = function (prama, register) { | ||
if (register) { | ||
for (const re of register) { | ||
console.log(re); | ||
Event.addEvent(re.code, re.callBack); | ||
} | ||
} | ||
unityInstance.SendMessage("Interface", "Reflect", JSON.stringify(prama)); | ||
} | ||
unityInstance.Untie = function (register) { | ||
for (const re of register) { | ||
Event.removeEvent(re.code, re.callBack); | ||
} | ||
} | ||
unityInstance.Register = function (register) { | ||
if (register) { | ||
for (const re of register) { | ||
Event.addEvent(re.code, re.callBack); | ||
} | ||
} | ||
} | ||
db.cacheFile(param.assetsUrl + "library").then((library) => { | ||
prama.assetsUrl = library; | ||
AB3D.interface = new Interface(unityInstance, param); | ||
}) | ||
@@ -85,4 +62,2 @@ }).catch((message) => { | ||
} | ||
function development() { | ||
@@ -107,23 +82,2 @@ script.setAttribute('src', 'http://192.168.1.111/unity/resource/AB3DEngine.loader.js'); | ||
AB3D.interface = new Interface(unityInstance, param); | ||
// unityInstance.Invoke = function (prama, register) { | ||
// if (register) { | ||
// for (const re of register) { | ||
// Event.addEvent(re.code, re.callBack); | ||
// } | ||
// } | ||
// unityInstance.SendMessage("Interface", "Reflect", JSON.stringify(prama)); | ||
// } | ||
// unityInstance.Untie = function (register) { | ||
// for (const re of register) { | ||
// Event.removeEvent(re.code, re.callBack); | ||
// } | ||
// } | ||
// unityInstance.Register = function (register) { | ||
// if (register) { | ||
// for (const re of register) { | ||
// Event.addEvent(re.code, re.callBack); | ||
// } | ||
// } | ||
// } | ||
}).catch((message) => { | ||
@@ -134,50 +88,3 @@ alert(message); | ||
} | ||
function localDebugging() { | ||
db.cacheFile(param.host + "http://192.168.1.111/unity/resource/AB3DEngine.data").then((data) => { | ||
db.cacheFile(param.host + "http://192.168.1.111/unity/resource/AB3DEngine.wasm").then((wasm) => { | ||
script.setAttribute('src', param.host + 'http://192.168.1.111/unity/resource/AB3DEngine.loader.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
script.onload = () => { | ||
createUnityInstance(canvas, { | ||
dataUrl: data, | ||
frameworkUrl: param.host + "http://192.168.1.111/unity/resource/AB3DEngine.framework.js", | ||
codeUrl: wasm, | ||
streamingAssetsUrl: "StreamingAssets", | ||
companyName: "DefaultCompany", | ||
productName: "EnvironmentEditor", | ||
productVersion: "0.1", | ||
// matchWebGLToCanvasSize: false, //取消注释以分别控制WebGL画布的渲染大小和DOM元素的大小。 | ||
// devicePixelRatio: 1, // 取消注释将覆盖在高DPI显示上的低DPI渲染。 | ||
}).then((unityInstance) => { | ||
unityInstance.parentNode = parentNode; | ||
var db = new IndexDBCache(); | ||
AB3D.interface = new Interface(unityInstance, db, param.host, param.succeed); | ||
unityInstance.Invoke = function (prama, register) { | ||
if (register) { | ||
for (const re of register) { | ||
Event.addEvent(re.code, re.callBack); | ||
} | ||
} | ||
unityInstance.SendMessage("Interface", "Reflect", JSON.stringify(prama)); | ||
} | ||
unityInstance.Untie = function (register) { | ||
for (const re of register) { | ||
Event.removeEvent(re.code, re.callBack); | ||
} | ||
} | ||
unityInstance.Register = function (register) { | ||
if (register) { | ||
for (const re of register) { | ||
Event.addEvent(re.code, re.callBack); | ||
} | ||
} | ||
} | ||
}).catch((message) => { | ||
alert(message); | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
export default AB3D |
{ | ||
"name": "abengine", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"description": "引入 npm i ABengine", | ||
@@ -5,0 +5,0 @@ "main": "ab3d.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124675
705