void LoopAdditiveScene(bool loadImageInEnd = true) { currentAddSceneID++; if (currentAddSceneID < assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath.Length) { Loading loadingScene = loadingManager.AddALoading(4); loadingScene.LoadingAnimation(SceneManager.LoadSceneAsync(assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath[currentAddSceneID], LoadSceneMode.Additive), "正在加载"); loadingScene.OnLoadedEvent.AddListener(() => { LoopAdditiveScene(); }); } else if (currentAddSceneID == assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath.Length) { GlobalDebug.Addline("All Additive Scene Loaded!"); Debug.Log("All Additive Scene Loaded!"); if (loadImageInEnd) { imageCache.LoopLoadAndCacheImageFromServer(); } appBridge.Unity2App("unityLoadDone"); appBridge.Unity2App("unityReady"); Debug.Log("unityLoadDone"); GlobalDebug.Addline("unityLoadDone"); } }
/// <summary> /// 竖屏进入户型 /// </summary> /// <param name="inName"></param> public void OnlyEnterHXNK(string inName) { GlobalDebug.Addline("Portrait EnterHXNK"); foreach (SenceInteractiveInfo s in sceneInteractiveManger.senceInteractiveInfoGroup) { if (inName == s.huXingType.hxName) { if (s.huXingType.hxMeshRoot != null) { appBridge.Unity2App("unityOpenRoomType", currentSelectHuXingType.huXingID); Debug.Log("unityOpenRoomType:" + currentSelectHuXingType.huXingID); GlobalDebug.Addline("unityOpenRoomType:" + currentSelectHuXingType.huXingID); hxScene = s; for (int i = 0; i < hxSceneHuXingTypeFinal.Length; i++) { if (hxSceneHuXingTypeFinal[i].hxName == s.huXingType.hxName) { currentSelectHuXingType = hxSceneHuXingTypeFinal[i]; } } if (hxScene.meshRoot != null) { hxScene.meshRoot.transform.position = new Vector3(0, 500, 0); hxScene.cameraUniversalCenter.transform.position = new Vector3(0, 500, 0); } sceneInteractiveManger.ChangeInteractiveScene(hxScene, true); // triggerVR.AlphaPlayBackward(); // triggerEnterFangJian.AlphaPlayBackward(); // triggerFCZ.transform.localPosition = new Vector3(0, 100, 0); triggerFCZ.AlphaPlayForward(); // triggerEnterFangJian.transform.localPosition = new Vector3(-500, 0, 0); triggerEnterHX.AlphaPlayBackward(); triggerHuXingThumbnail.AlphaPlayBackward(); xfGUI.triggerOutDoorThumbnail.AlphaPlayBackward(); huXingInfoLabel.DisplayHuXingInfoLabel(currentSelectHuXingType.GetHuXingTypeInfo()); pmtImagePlayer.netTexture2DGroup = currentSelectHuXingType.netTexture2DGroup; DisplayHuXingFloorScrollMenu(); huXingCameraBG.transform.parent = hxScene.cameraUniversalCenter.cameras[0].transform; huXingCameraBG.transform.localPosition = new Vector3(0, 0, 90); huXingCameraBG.transform.rotation = new Quaternion(); huXingCameraBG.transform.localScale = new Vector3(250, 140, 1); appBridge.Unity2App("unityOpenRoomTypeDone"); Debug.Log("unityOpenRoomTypeDone"); GlobalDebug.Addline("unityOpenRoomTypeDone"); } } } }
void Start() { //在Unload场景会自动执行清空资源操作,之后再加载Start场景 if (autoUnloadAndReset) { AppBridge.needSendUnloadMessageToUnity = true; StartCoroutine(UnloadUnusedAssetsIE()); } else if (AppBridge.needSendUnloadMessageToUnity) { AppBridge.needSendUnloadMessageToUnity = false; appBridge.Unity2App("unityUnloadDone"); Debug.Log("unityUnloadDone"); GlobalDebug.Addline("unityUnloadDone"); GlobalDebug.Clear(); if (serverProjectInfo != null) { serverProjectInfo.LoadServerProjectInfo("http://mfq.meifangquan.com/", "http://mfq.meifangquan.com/", "201700000259", "0"); } } }
IEnumerator FinishOnLineTalk_IE() { yield return(new WaitForSeconds(0.3f)); remoteManger.DisConnect(); yield return(new WaitForSeconds(0.2f)); if (!hasFinishExitOnlineTalk) { appBridge.Unity2App("unityCloseRemote", "0"); string logStr = "unityCloseRemote"; Debug.Log(logStr); GlobalDebug.Addline(logStr); hasFinishExitOnlineTalk = true; } }
IEnumerator IEWaitChangeOrientationDone(ScreenOrientation toOrientation) { yield return(new WaitForSeconds(0.5f)); if (toOrientation == ScreenOrientation.Portrait) { appBridge.Unity2App("unityChangeOrientationDone", "0"); Debug.Log("unityChangeOrientationDone Portrait"); GlobalDebug.Addline("unityChangeOrientationDone Portrait"); } else if (toOrientation == ScreenOrientation.LandscapeLeft) { appBridge.Unity2App("unityChangeOrientationDone", "1"); Debug.Log("unityChangeOrientationDone Landscape"); GlobalDebug.Addline("unityChangeOrientationDone Landscape"); } isChangeOrientation = false; }
//全屏 public void Landscape() { leftWarning.AlphaPlayBackward(); rightWarning.AlphaPlayForward(); Screen.orientation = ScreenOrientation.LandscapeLeft; defaultGUIRoot.AlphaPlayForward(); mainBtnGroup.AlphaPlayForward(); triggerHXList.AlphaPlayForward(); triggerXFGroup.AlphaPlayForward(); triggerBackBtn.AlphaPlayForward(); triggerVRBtn.AlphaPlayForward(); triggerShare.AlphaPlayForward(); triggerEnterFangJianPortrait.AlphaPlayBackward(); appBridege.Unity2App("unityLandscape"); Debug.Log("unityLandscape"); GlobalDebug.Addline("unityLandscape"); }
public void OKCloseOnLineTalk() { exitOnlineTalk.AlphaPlayBackward(); GetComponent <CanveGroupFade>().AlphaPlayBackward(); remoteManger.DisConnect(); appBridge.Unity2App("unityCloseRemote"); Debug.Log("unityCloseRemote"); GlobalDebug.Addline("unityCloseRemote"); }
public void OpenVRGlass() { // leftViewImage.rectTransform.anchoredPosition = new Vector2(-0.25f * Screen.width, 0); // leftViewImage.rectTransform.sizeDelta = new Vector2(-0.5f * Screen.width, 0); // rightViewImage.rectTransform.anchoredPosition = new Vector2(0.25f * Screen.width, 0); // rightViewImage.rectTransform.sizeDelta = new Vector2(-0.5f * Screen.width, 0); // rightViewImage defaultGUI.AlphaPlayBackward(); CameraUniversal inCamera = globalManager.GetComponent <SceneInteractiveManger>().currentActiveSenceInteractiveInfo.cameraUniversalCenter.currentCamera; Input.gyro.enabled = true; cameraUniversal = inCamera; // cameraUniversal.GetComponent<Camera>().enabled = false; leftEyeCamera.enabled = true; rightEyeCamera.enabled = true; this.transform.parent = inCamera.transform; this.transform.localPosition = Vector3.zero; this.transform.localRotation = Quaternion.identity; moveUI.AlphaPlayForward(); zhunxUI.AlphaPlayForward(); leftEyeCamera.cullingMask = inCamera.GetComponent <Camera>().cullingMask; rightEyeCamera.cullingMask = inCamera.GetComponent <Camera>().cullingMask; orginCameraClearFlags = cameraUniversal.GetComponent <Camera> ().clearFlags; orginBackgroundColor = cameraUniversal.GetComponent <Camera> ().backgroundColor; cameraUniversal.GetComponent <Camera>().cullingMask = 0; cameraUniversal.GetComponent <Camera> ().clearFlags = CameraClearFlags.SolidColor; cameraUniversal.GetComponent <Camera> ().backgroundColor = Color.white; vrViewCanveGroupFade.AlphaPlayForward(); appBridge.Unity2App("unityVRState", "1"); }
IEnumerator UnloadUnusedAssetsIE() { yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); AsyncOperation a = Resources.UnloadUnusedAssets(); while (!a.isDone) { yield return(new WaitForEndOfFrame()); } appBridge.Unity2App("unityUnloadDone"); Debug.Log("unityUnloadDone"); GlobalDebug.Addline("unityUnloadDone"); SceneManager.LoadSceneAsync(0); }
void LoopAdditiveScene(bool loadImageInEnd = true) { //是否需要打断加载 if (needBreakLoad) { GlobalDebug.Addline("Break Add Scene"); Debug.Log("Break Add Scene"); unload.LoadUnloadScene(); return; } currentAddSceneID++; if (currentAddSceneID < assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath.Length) { /* * Loading loadingScene = loadingManager.AddALoading(4); * loadingScene.LoadingAnimation(SceneManager.LoadSceneAsync(assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath[currentAddSceneID], LoadSceneMode.Additive), "正在加载"); * loadingScene.OnLoadedEvent.AddListener(() => { LoopAdditiveScene(); }); */ if (assetBundleManager.serverProjectAssetBundlesInfo.sceneTypeSet != null && assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath.Length == assetBundleManager.serverProjectAssetBundlesInfo.sceneTypeSet.Length) { if (assetBundleManager.serverProjectAssetBundlesInfo.sceneTypeSet[currentAddSceneID] == 8) { Debug.Log("跳过360场景 " + assetBundleManager.serverProjectAssetBundlesInfo.sceneAssetBundle[currentAddSceneID]); //跳过360场景,开始加载下个场景 LoopAdditiveScene(); } else { Loading loadingScene = loadingManager.AddALoading(4); loadingScene.LoadingAnimation(SceneManager.LoadSceneAsync(assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath[currentAddSceneID], LoadSceneMode.Additive), "正在加载"); loadingScene.OnLoadedEvent.AddListener(() => { LoopAdditiveScene(); }); } } else { Loading loadingScene = loadingManager.AddALoading(4); loadingScene.LoadingAnimation(SceneManager.LoadSceneAsync(assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath[currentAddSceneID], LoadSceneMode.Additive), "正在加载"); loadingScene.OnLoadedEvent.AddListener(() => { LoopAdditiveScene(); }); } } else if (currentAddSceneID == assetBundleManager.serverProjectAssetBundlesInfo.needExportScenePath.Length) { GlobalDebug.Addline("All Additive Scene Loaded!"); Debug.Log("All Additive Scene Loaded!"); //已完成循环加载场景 isLoopingAddSource = false; if (loadImageInEnd) { //如果还要下载图片 isLoopingAddSource = true; imageCache.LoopLoadAndCacheImageFromServer(); } if (appBridge.appProjectInfo.sceneLoadMode == "2") { defaultGUI.mainBtnGroup.GetComponent <ButtonGroup>().imageButtonGroup[4].SetBtnState(true, 0); } if (onLoadDone != null) { onLoadDone.Invoke("OnLoadDone"); } appBridge.Unity2App("unityLoadDone"); appBridge.Unity2App("unityReady"); Debug.Log("unityLoadDone"); GlobalDebug.Addline("unityLoadDone"); } }