Esempio n. 1
0
        IEnumerator Processing()
        {
//			MergeUserAccount.instance.PermissionPause (true);

            proceed = false;
//			#if UNITY_IOS || UNITY_ANDROID
            if (cameraAccessPop)
            {
                bool isCameraPermit = false;
                                #if UNITY_IOS && !UNITY_EDITOR
                isCameraPermit = MergeIOSBridge.CheckCamera();
                                #endif
                                #if UNITY_ANDROID && !UNITY_EDITOR
                isCameraPermit = MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                                #endif
                if (!isCameraPermit)
                {
//					Debug.LogWarning( "Should Do First Cam" );
                    Page_CameraAccess.gameObject.SetActive(true);
                    Page_CameraAccess.doneButton += Btn_DoneAction;
                    yield return(new WaitUntil(() => proceed));

                    Page_CameraAccess.doneButton -= Btn_DoneAction;
                    proceed = false;
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestCamera();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.CAMERA);
                    yield return(new WaitForSeconds(.1f));
                                        #endif
                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif
                    PlayerPrefs.SetString("MCSDK_cameraAccessPop", "done");
                    Page_CameraAccess.gameObject.SetActive(false);
                }
            }
                        #if UNITY_IOS && !UNITY_EDITOR
            cameraDisabledPop = !MergeIOSBridge.CheckCamera();
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            cameraDisabledPop = !MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                        #endif
                        #if  !UNITY_EDITOR
            if (cameraDisabledPop)
            {
                Debug.LogWarning("Should Do Cam Disabled");
                Page_CameraDisabled.gameObject.SetActive(true);
                Page_CameraDisabled.doneButton += OpenPhoneSetting;
                Temp_CheckCamera = true;
                yield return(new WaitUntil(() => proceed));

                Temp_CheckCamera = false;
                Page_CameraDisabled.doneButton -= OpenPhoneSetting;
                proceed = false;
                yield return(null);

                Page_CameraDisabled.gameObject.SetActive(false);
            }
                        #endif

                        #if UNITY_IOS && !UNITY_EDITOR
            int photoState = MergeIOSBridge.CheckPhoto();
            if (photoState == 2)
            {
                photoAccessPop = true;
            }
            else
            {
                photoAccessPop = false;
            }
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            if (MergeAndroidBridge.WasDeniedOnce(AndroidPermission.READ_EXTERNAL_STORAGE))
            {
                photoAccessPop = false;
            }
            else
            {
                photoAccessPop = !MergeAndroidBridge.HasPermission(AndroidPermission.READ_EXTERNAL_STORAGE);
            }
                        #endif
            if (photoAccessPop)
            {
                skip    = false;
                proceed = false;
//				Debug.LogWarning( "Should Do Photo" );
                //pop Cam
                Page_PhotoAccess.gameObject.SetActive(true);
                Page_PhotoAccess.doneButton   += Btn_DoneAction;
                Page_PhotoAccess.actionButton += SkipAction;
                Invoke("EnablePhotoSkip", 3f);
                yield return(new WaitUntil(() => (proceed || skip)));

                CancelInvoke("EnablePhotoSkip");
                proceed = false;
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestPhoto();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.READ_EXTERNAL_STORAGE);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif
                }
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    //currently Do nothing since not recording Mic.
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.RECORD_AUDIO);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #endif
                }
                Page_PhotoAccess.doneButton   -= Btn_DoneAction;
                Page_PhotoAccess.actionButton -= SkipAction;
                PlayerPrefs.SetString("MCSDK_photoAccessPop", "done");
                Page_PhotoAccess.gameObject.SetActive(false);
            }
//			if ( MergeUserAccount.instance.conf.userSignInActive && ( Application.internetReachability != NetworkReachability.NotReachable ) )
//			{
//				if ( MergeUserAccount.instance.ShouldOpenSignInPage )
//				{
//					skip = false;
//					proceed = false;
//					if ( PlayerPrefs.GetString( "UserAccountActionBtn" ) != "" )
//					{
//						userAccountSkipBtn.SetActive( true );
//					}
//					Debug.LogWarning( "Should Do User Account" );
//					Page_UserAccount.gameObject.SetActive( true );
//					Page_UserAccount.doneButton += Btn_DoneAction;
//					Page_UserAccount.actionButton += SkipAction;
//					yield return new WaitUntil( () => ( proceed || skip ) );
//					proceed = false;
//					if ( !skip )
//					{
//						MergeUserAccount.instance.signInClose += Btn_DoneAction;
//						MergeUserAccount.instance.PopSignIn();
//						yield return new WaitUntil( () => proceed );
//						MergeUserAccount.instance.signInClose -= Btn_DoneAction;
//						yield return new WaitForSeconds( .25f );
//					}
//					Page_UserAccount.doneButton -= Btn_DoneAction;
//					Page_UserAccount.actionButton -= SkipAction;
//					Page_UserAccount.gameObject.SetActive( false );
//					PlayerPrefs.SetString( "UserAccountActionBtn", "done" );
//				}
//			}
//			#endif
//			Debug.LogWarning( "All If Done" );
//			MergeUserAccount.instance.PermissionPause( false );
            DoneProcess();
            PlayerPrefs.Save();
            MergeCubeSDK.instance.InitVuforia();

            yield return(null);
        }
        IEnumerator Processing()
        {
            proceed = false;
            if (cameraAccessPop)
            {
                bool isCameraPermit = false;
                                #if UNITY_IOS && !UNITY_EDITOR
                isCameraPermit = MergeIOSBridge.CheckCamera();
                                #endif
                                #if UNITY_ANDROID && !UNITY_EDITOR
                isCameraPermit = MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                                #endif
                if (!isCameraPermit)
                {
//					Debug.LogWarning ("Should Do First Cam");
                    Page_CameraAccess.gameObject.SetActive(true);
                    Page_CameraAccess.doneButton += Btn_DoneAction;
                    yield return(new WaitUntil(() => proceed));

                    Page_CameraAccess.doneButton -= Btn_DoneAction;
                    proceed = false;
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestCamera();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.CAMERA);
                    yield return(new WaitForSeconds(.1f));
                                        #endif
                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif

                    PlayerPrefs.SetString("MCSDK_cameraAccessPop", "done");
                    Page_CameraAccess.gameObject.SetActive(false);
                }
            }
                        #if UNITY_IOS && !UNITY_EDITOR
            cameraDisabledPop = !MergeIOSBridge.CheckCamera();
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            cameraDisabledPop = !MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                        #endif
                        #if  !UNITY_EDITOR
            if (cameraDisabledPop)
            {
//				Debug.LogWarning ("Should Do Cam Disabled");
                Page_CameraDisabled.gameObject.SetActive(true);
                Page_CameraDisabled.doneButton += OpenPhoneSetting;
                Temp_CheckCamera = true;
                yield return(new WaitUntil(() => proceed));

                Temp_CheckCamera = false;
                Page_CameraDisabled.doneButton -= OpenPhoneSetting;
                proceed = false;
                yield return(null);

                Page_CameraDisabled.gameObject.SetActive(false);
            }
                        #endif

                        #if UNITY_IOS && !UNITY_EDITOR
            int photoState = MergeIOSBridge.CheckPhoto();
            if (photoState == 2)
            {
                photoAccessPop = true;
            }
            else
            {
                photoAccessPop = false;
            }
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            if (MergeAndroidBridge.WasDeniedOnce(AndroidPermission.READ_EXTERNAL_STORAGE))
            {
                photoAccessPop = false;
            }
            else
            {
                photoAccessPop = !MergeAndroidBridge.HasPermission(AndroidPermission.READ_EXTERNAL_STORAGE);
            }
                        #endif
            if (photoAccessPop)
            {
                skip    = false;
                proceed = false;
//				Debug.LogWarning ("Should Do Photo");
                //pop Cam
                Page_PhotoAccess.gameObject.SetActive(true);
                Page_PhotoAccess.doneButton   += Btn_DoneAction;
                Page_PhotoAccess.actionButton += SkipAction;
                yield return(new WaitUntil(() => (proceed || skip)));

                proceed = false;
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestPhoto();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.READ_EXTERNAL_STORAGE);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif
                }
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    //currently Do nothing since not recording Mic.
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.RECORD_AUDIO);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #endif
                }
                Page_PhotoAccess.doneButton   -= Btn_DoneAction;
                Page_PhotoAccess.actionButton -= SkipAction;
                PlayerPrefs.SetString("MCSDK_photoAccessPop", "done");
                Page_PhotoAccess.gameObject.SetActive(false);
            }
//			Debug.LogWarning ("All If Done");

            DoneProcess();
            PlayerPrefs.Save();
            MergeCubeSDK.instance.InitVuforia();
            yield return(null);
        }