Browse Source

UnityApp集成到采集平台

develop
徐振升 5 years ago
parent
commit
e6dae46f95
  1. 3
      src/app/ui/unity/unity.component.html
  2. 54
      src/app/ui/unity/unity.component.ts
  3. 2
      src/assets/unityApp/Build/UnityLoader.js
  4. BIN
      src/assets/unityApp/Build/unityApp.data.unityweb
  5. 4
      src/assets/unityApp/Build/unityApp.json
  6. BIN
      src/assets/unityApp/Build/unityApp.wasm.code.unityweb
  7. BIN
      src/assets/unityApp/Build/unityApp.wasm.framework.unityweb
  8. BIN
      src/assets/unityApp/StreamingAssets/aa/WebGL/WebGL/defaultlocalgroup_assets_all_7fdf93a829050ac71d2572c28097dc6c.bundle
  9. 2
      src/assets/unityApp/StreamingAssets/aa/WebGL/catalog.json
  10. 1
      src/assets/unityApp/StreamingAssets/aa/WebGL/link.xml
  11. 2
      src/assets/unityApp/TemplateData/UnityProgress.js
  12. 6
      src/assets/unityApp/index.html

3
src/app/ui/unity/unity.component.html

@ -1,4 +1,3 @@
<div class="webgl-content">
<div id="unityContainer"></div>
<button (click)="CallUnity()">测试</button>
</div>
</div>

54
src/app/ui/unity/unity.component.ts

@ -19,31 +19,41 @@ export class UnityComponent implements OnInit {
//window.getCookie = this.getCookie.bind(this);
}
progressValue = 0;
// progressValue = 0;
ngOnInit(): void {
this.unityInstance = UnityLoader.instantiate('unityContainer', 'assets/unityApp/Build/unityApp.json', {onProgress: this.UnityProgress});
this.unityInstance = UnityLoader.instantiate('unityContainer', 'assets/unityApp/Build/unityApp.json');
//this.progressValue = 50;
}
UnityProgress(unityInstance, progress) {
if (!unityInstance.Module)
return;
console.log(progress);
if (progress == 1)
unityInstance.SendMessage("UnityWebGL", "CallUnity");
}
setCompanyId(){
this.unityInstance.SendMessage("UnityWebGL", "CallUnity");
}
CallUnity(): void {
console.log('==============================================');
this.unityInstance.SendMessage("UnityWebGL", "CallUnity");
}
// ngAfterViewInit ( ): void {
// }
// ///
// UnityProgress(unityInstance, progress) {
// if (!unityInstance.Module)
// return;
// this.progressValue = 100;
// console.log(this.progressValue);
// if (progress == 1)
// unityInstance.SendMessage("GameManager", "ShowMainView");
// }
// //发送单位id
// sendCompanyId(){
// var companyId = sessionStorage.getItem('companyId');
// this.unityInstance.SendMessage("GameManager","SetCompanyId",)
// }
// CallUnity(): void {
// console.log('修改progressValue的值为'+this.progressValue);
// }
public SendMessage(objectName: string, methodName: string): void {
this.unityInstance.SendMessage(objectName, methodName);
}
// public SendMessage(objectName: string, methodName: string): void {
// this.unityInstance.SendMessage(objectName, methodName);
// }
}

2
src/assets/unityApp/Build/UnityLoader.js

File diff suppressed because one or more lines are too long

BIN
src/assets/unityApp/Build/unityApp.data.unityweb

Binary file not shown.

4
src/assets/unityApp/Build/unityApp.json

@ -1,6 +1,6 @@
{
"companyName": "DefaultCompany",
"productName": "UnityCallAngular",
"productName": "2DPlanMakingTool",
"productVersion": "0.1",
"dataUrl": "unityApp.data.unityweb",
"wasmCodeUrl": "unityApp.wasm.code.unityweb",
@ -12,5 +12,5 @@
"cacheControl": {"default": "must-revalidate"},
"developmentBuild": false,
"multithreading": false,
"unityVersion": "2019.3.0f3"
"unityVersion": "2019.3.2f1"
}

BIN
src/assets/unityApp/Build/unityApp.wasm.code.unityweb

Binary file not shown.

BIN
src/assets/unityApp/Build/unityApp.wasm.framework.unityweb

Binary file not shown.

BIN
src/assets/unityApp/StreamingAssets/aa/WebGL/WebGL/defaultlocalgroup_assets_all_7fdf93a829050ac71d2572c28097dc6c.bundle

Binary file not shown.

2
src/assets/unityApp/StreamingAssets/aa/WebGL/catalog.json

File diff suppressed because one or more lines are too long

1
src/assets/unityApp/StreamingAssets/aa/WebGL/link.xml

@ -36,6 +36,7 @@
<type fullname="ExpandViewOneOrTwoItem" preserve="all" />
<type fullname="UIFloorControl" preserve="all" />
<type fullname="AssetLibItem" preserve="all" />
<type fullname="BooleanControl" preserve="all" />
<type fullname="ExpandView" preserve="all" />
<type fullname="FillingArea" preserve="all" />
<type fullname="WorkingArea" preserve="all" />

2
src/assets/unityApp/TemplateData/UnityProgress.js

@ -21,6 +21,4 @@ function UnityProgress(unityInstance, progress) {
unityInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
if (progress == 1)
unityInstance.logo.style.display = unityInstance.progress.style.display = "none";
console.log('1234567890');
unityInstance.SendMessage("UnityWebGL", "CallUnity");
}

6
src/assets/unityApp/index.html

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | UnityCallAngular</title>
<title>Unity WebGL Player | 2DPlanMakingTool</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
@ -14,11 +14,11 @@
</head>
<body>
<div class="webgl-content">
<div id="unityContainer" style="width: 960px; height: 600px"></div>
<div id="unityContainer" style="width: 1024px; height: 768px"></div>
<div class="footer">
<div class="webgl-logo"></div>
<div class="fullscreen" onclick="unityInstance.SetFullscreen(1)"></div>
<div class="title">UnityCallAngular</div>
<div class="title">2DPlanMakingTool</div>
</div>
</div>
</body>

Loading…
Cancel
Save