/// <summary> /// Turns pausing on or off. /// Pausing will freeze the camera video and all trackables will remain in their current state. /// Autorotation will be disabled during video background freezing. /// </summary> public void Pause(bool pause) { if (pause) { // lock orientation mAutoRotationState = new AutoRotationState { autorotateToLandscapeLeft = Screen.autorotateToLandscapeLeft, autorotateToLandscapeRight = Screen.autorotateToLandscapeRight, autorotateToPortrait = Screen.autorotateToPortrait, autorotateToPortraitUpsideDown = Screen.autorotateToPortraitUpsideDown, setOnPause = true }; Screen.autorotateToLandscapeLeft = false; Screen.autorotateToLandscapeRight = false; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; } else { // enable autorotation again if it was disabled before: if (mAutoRotationState.setOnPause) { Screen.autorotateToLandscapeLeft = mAutoRotationState.autorotateToLandscapeLeft; Screen.autorotateToLandscapeRight = mAutoRotationState.autorotateToLandscapeRight; Screen.autorotateToPortrait = mAutoRotationState.autorotateToPortrait; Screen.autorotateToPortraitUpsideDown = mAutoRotationState.autorotateToPortraitUpsideDown; } } mPaused = pause; }
internal void Pause(bool pause) { if (pause) { AutoRotationState state = new AutoRotationState { autorotateToLandscapeLeft = Screen.autorotateToLandscapeLeft, autorotateToLandscapeRight = Screen.autorotateToLandscapeRight, autorotateToPortrait = Screen.autorotateToPortrait, autorotateToPortraitUpsideDown = Screen.autorotateToPortraitUpsideDown, setOnPause = true }; this.mAutoRotationState = state; Screen.autorotateToLandscapeLeft = false; Screen.autorotateToLandscapeRight = false; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; } else if (this.mAutoRotationState.setOnPause) { Screen.autorotateToLandscapeLeft = this.mAutoRotationState.autorotateToLandscapeLeft; Screen.autorotateToLandscapeRight = this.mAutoRotationState.autorotateToLandscapeRight; Screen.autorotateToPortrait = this.mAutoRotationState.autorotateToPortrait; Screen.autorotateToPortraitUpsideDown = this.mAutoRotationState.autorotateToPortraitUpsideDown; } this.mPaused = pause; }
/// <summary> /// Turns pausing on or off. /// Pausing will freeze the camera video and all trackables will remain in their current state. /// Autorotation will be disabled during video background freezing. /// </summary> public void Pause(bool pause) { if (pause) { // lock orientation mAutoRotationState = new AutoRotationState { autorotateToLandscapeLeft = Screen.autorotateToLandscapeLeft, autorotateToLandscapeRight = Screen.autorotateToLandscapeRight, autorotateToPortrait = Screen.autorotateToPortrait, autorotateToPortraitUpsideDown = Screen.autorotateToPortraitUpsideDown, setOnPause = true }; Screen.autorotateToLandscapeLeft = false; Screen.autorotateToLandscapeRight = false; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; } else { // enable autorotation again if it was disabled before: if (mAutoRotationState.setOnPause) { Screen.autorotateToLandscapeLeft = mAutoRotationState.autorotateToLandscapeLeft; Screen.autorotateToLandscapeRight = mAutoRotationState.autorotateToLandscapeRight; Screen.autorotateToPortrait = mAutoRotationState.autorotateToPortrait; Screen.autorotateToPortraitUpsideDown = mAutoRotationState.autorotateToPortraitUpsideDown; } } mPaused = pause; }