|
@@ -135,83 +135,83 @@ export default {
|
|
HomeFadeIn,
|
|
HomeFadeIn,
|
|
},
|
|
},
|
|
setup () {
|
|
setup () {
|
|
- const isShowFadeInMask = ref(false)
|
|
|
|
|
|
+ const isShowFadeInMask = ref(true)
|
|
const progress = ref(0)
|
|
const progress = ref(0)
|
|
- // onMounted(() => {
|
|
|
|
- // /**
|
|
|
|
- // * 加载unity
|
|
|
|
- // */
|
|
|
|
- // window.addEventListener("load", function () {
|
|
|
|
- // if ("serviceWorker" in navigator) {
|
|
|
|
- // navigator.serviceWorker.register("ServiceWorker.js")
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
+ /**
|
|
|
|
+ * 加载unity
|
|
|
|
+ */
|
|
|
|
+ window.addEventListener("load", function () {
|
|
|
|
+ if ("serviceWorker" in navigator) {
|
|
|
|
+ navigator.serviceWorker.register("ServiceWorker.js")
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
|
|
- // var canvas = document.querySelector("#unity-canvas")
|
|
|
|
|
|
+ var canvas = document.querySelector("#unity-canvas")
|
|
|
|
|
|
- // var buildUrl = "unity/Build"
|
|
|
|
- // var loaderUrl = buildUrl + "/SHIndustryMuseum_2.10.loader.js"
|
|
|
|
- // var config = {
|
|
|
|
- // dataUrl: buildUrl + "/SHIndustryMuseum_2.10.data.unityweb",
|
|
|
|
- // frameworkUrl: buildUrl + "/SHIndustryMuseum_2.10.framework.js.unityweb",
|
|
|
|
- // codeUrl: buildUrl + "/SHIndustryMuseum_2.10.wasm.unityweb",
|
|
|
|
- // streamingAssetsUrl: "StreamingAssets",
|
|
|
|
- // companyName: "DefaultCompany",
|
|
|
|
- // productName: "SHIndustryMuseum",
|
|
|
|
- // productVersion: "0.1",
|
|
|
|
- // }
|
|
|
|
|
|
+ var buildUrl = "unity/Build"
|
|
|
|
+ var loaderUrl = buildUrl + "/SHIndustryMuseum_2.10.loader.js"
|
|
|
|
+ var config = {
|
|
|
|
+ dataUrl: buildUrl + "/SHIndustryMuseum_2.10.data.unityweb",
|
|
|
|
+ frameworkUrl: buildUrl + "/SHIndustryMuseum_2.10.framework.js.unityweb",
|
|
|
|
+ codeUrl: buildUrl + "/SHIndustryMuseum_2.10.wasm.unityweb",
|
|
|
|
+ streamingAssetsUrl: "StreamingAssets",
|
|
|
|
+ companyName: "DefaultCompany",
|
|
|
|
+ productName: "SHIndustryMuseum",
|
|
|
|
+ productVersion: "0.1",
|
|
|
|
+ }
|
|
|
|
|
|
- // // By default Unity keeps WebGL canvas render target size matched with
|
|
|
|
- // // the DOM size of the canvas element (scaled by window.devicePixelRatio)
|
|
|
|
- // // Set this to false if you want to decouple this synchronization from
|
|
|
|
- // // happening inside the engine, and you would instead like to size up
|
|
|
|
- // // the canvas DOM size and WebGL render target sizes yourself.
|
|
|
|
- // // config.matchWebGLToCanvasSize = false;
|
|
|
|
- // if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
|
|
|
- // // Mobile device style: fill the whole browser client area with the game canvas:
|
|
|
|
- // var meta = document.createElement('meta')
|
|
|
|
- // meta.name = 'viewport'
|
|
|
|
- // meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes'
|
|
|
|
- // document.getElementsByTagName('head')[0].appendChild(meta)
|
|
|
|
- // }
|
|
|
|
|
|
+ // By default Unity keeps WebGL canvas render target size matched with
|
|
|
|
+ // the DOM size of the canvas element (scaled by window.devicePixelRatio)
|
|
|
|
+ // Set this to false if you want to decouple this synchronization from
|
|
|
|
+ // happening inside the engine, and you would instead like to size up
|
|
|
|
+ // the canvas DOM size and WebGL render target sizes yourself.
|
|
|
|
+ // config.matchWebGLToCanvasSize = false;
|
|
|
|
+ if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
|
|
|
+ // Mobile device style: fill the whole browser client area with the game canvas:
|
|
|
|
+ var meta = document.createElement('meta')
|
|
|
|
+ meta.name = 'viewport'
|
|
|
|
+ meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes'
|
|
|
|
+ document.getElementsByTagName('head')[0].appendChild(meta)
|
|
|
|
+ }
|
|
|
|
|
|
- // var script = document.createElement("script")
|
|
|
|
- // script.src = loaderUrl
|
|
|
|
- // script.onload = () => {
|
|
|
|
- // createUnityInstance(canvas, config, (paramProgress) => {
|
|
|
|
- // progress.value = Math.round(paramProgress * 100)
|
|
|
|
- // if (paramProgress > 0.95) {
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // isShowFadeInMask.value = false
|
|
|
|
- // }, 1000)
|
|
|
|
- // }
|
|
|
|
- // }).then((unityInstance) => {
|
|
|
|
- // window.gUnityInst = unityInstance
|
|
|
|
- // utils.loadUnitySceneGeneral()
|
|
|
|
- // }).catch((message) => {
|
|
|
|
- // alert(message)
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
- // window.onClickEnterprise = function (id) {
|
|
|
|
- // if (window.handleClickEnterprise) {
|
|
|
|
- // window.handleClickEnterprise(id)
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // window.onClickPlanet = function (id) {
|
|
|
|
- // if (window.handleClickPlanet) {
|
|
|
|
- // window.handleClickPlanet(id)
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // window.onMovedPlanet = function (id) {
|
|
|
|
- // if (window.handleMovedPlanet) {
|
|
|
|
- // window.handleMovedPlanet(id)
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // document.body.appendChild(script)
|
|
|
|
- // /**
|
|
|
|
- // * end of unity
|
|
|
|
- // */
|
|
|
|
- // })
|
|
|
|
|
|
+ var script = document.createElement("script")
|
|
|
|
+ script.src = loaderUrl
|
|
|
|
+ script.onload = () => {
|
|
|
|
+ createUnityInstance(canvas, config, (paramProgress) => {
|
|
|
|
+ progress.value = Math.round(paramProgress * 100)
|
|
|
|
+ if (paramProgress > 0.95) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ isShowFadeInMask.value = false
|
|
|
|
+ }, 1000)
|
|
|
|
+ }
|
|
|
|
+ }).then((unityInstance) => {
|
|
|
|
+ window.gUnityInst = unityInstance
|
|
|
|
+ utils.loadUnitySceneGeneral()
|
|
|
|
+ }).catch((message) => {
|
|
|
|
+ console.error('shabi', message)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ window.onClickEnterprise = function (id) {
|
|
|
|
+ if (window.handleClickEnterprise) {
|
|
|
|
+ window.handleClickEnterprise(id)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ window.onClickPlanet = function (id) {
|
|
|
|
+ if (window.handleClickPlanet) {
|
|
|
|
+ window.handleClickPlanet(id)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ window.onMovedPlanet = function (id) {
|
|
|
|
+ if (window.handleMovedPlanet) {
|
|
|
|
+ window.handleMovedPlanet(id)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ document.body.appendChild(script)
|
|
|
|
+ /**
|
|
|
|
+ * end of unity
|
|
|
|
+ */
|
|
|
|
+ })
|
|
|
|
|
|
const isShowNavBar = ref(true)
|
|
const isShowNavBar = ref(true)
|
|
const activeNavItemIdx = ref(0)
|
|
const activeNavItemIdx = ref(0)
|