当前位置: 首页>>代码示例>>C#>>正文


C# ScreenOrientation类代码示例

本文整理汇总了C#中ScreenOrientation的典型用法代码示例。如果您正苦于以下问题:C# ScreenOrientation类的具体用法?C# ScreenOrientation怎么用?C# ScreenOrientation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScreenOrientation类属于命名空间,在下文中一共展示了ScreenOrientation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScreenUtils

 private ScreenUtils(int width, int height)
 {
     this.orientation = ScreenOrientation.Portrait;
     this.width = width;
     this.height = height;
     this.max_width = (width > height) ? width : height;
 }
开发者ID:g360230,项目名称:quran-phone,代码行数:7,代码来源:ScreenUtils.cs

示例2: RevMobIosBanner

	public RevMobIosBanner(string placementId, ScreenOrientation[] orientations, float x, float y, float width, float height) {
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
		this.orientations = orientations;
		this.placementId = placementId;
	}
开发者ID:uptopgames,项目名称:Minesweeper,代码行数:8,代码来源:RevMobIosBanner.cs

示例3: getOrthographicSize

    /// <summary>
    /// Determine size of the orthographic camera based on screen orientation.
    /// </summary>
    /// <returns>
    /// The orthographic camera size.
    /// </returns>
    /// <param name='orientation'>
    /// Screen orientation
    /// </param>
    private static float getOrthographicSize(ScreenOrientation orientation)
    {
        if (orientation == ScreenOrientation.Portrait || orientation == ScreenOrientation.PortraitUpsideDown)
            return 1.0f;

        if (Screen.width < Screen.height)
            return ((float)Screen.width)/((float)Screen.height);
        else
            return ((float)Screen.height)/((float)Screen.width);
    }
开发者ID:Bizounours,项目名称:metaioSDK,代码行数:19,代码来源:metaioDeviceCamera.cs

示例4: OrientationChanged

	void OrientationChanged(ScreenOrientation newOrientation)
	{
//		Debug.LogWarning("new orientation: " + newOrientation + " material: " + materialIndex);
		if (newOrientation == ScreenOrientation.Landscape) {
			ChangeMaterial(materialLandscape, materialIndex);
		}
		else if (newOrientation == ScreenOrientation.Portrait) {
			ChangeMaterial(materialPortrait, materialIndex);
		}
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:10,代码来源:OrientationMaterialChanger.cs

示例5: ActionOnOrientationChanged

	public void ActionOnOrientationChanged(ScreenOrientation newOrientation) 
	{
		if(newOrientation == ScreenOrientation.Landscape)
		{
			transform.localPosition = positionLandscape;
		}
		else
		{
			transform.localPosition = positionPortrait;
		}
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:11,代码来源:ObjectiveHintController.cs

示例6:

		public MenüSate(StateManager managerRef) // Constructor
		{
			#if UNITY_ANDROID || UNITY_IPHONE
			Screen.orientation = ScreenOrientation.AutoRotation;
			saveOri = Screen.orientation;
			#endif

			manager = managerRef;

			Application.LoadLevel ("Menue");
		}
开发者ID:Keyj1n,项目名称:BattlePong,代码行数:11,代码来源:MenüState.cs

示例7: UpdateScale

	void UpdateScale(ScreenOrientation orientation)
	{	
		if (screenWidth == Mathf.Max(Screen.width, Screen.height)) {
			return;
		}
		
		screenWidth = Mathf.Max(Screen.width, Screen.height);
		
		float myScaleFactor = screenWidth / referenceWidth;
		cachedTransform.localScale = originalScale * Mathf.Clamp(dpiScaleFactor / myScaleFactor, minScaleFactor, maxScaleFactor);
		//Debug.LogWarning("New Scale: " + dpiScaleFactor / myScaleFactor);
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:12,代码来源:ScaleUpByDpi.cs

示例8: SetRect

		public void SetRect(Rect screenRect, Rect rect, Rect landscapeRect, ScreenOrientation orientation) {

			this.screenRect = screenRect;
			this.rect = rect;
			this.orientation = orientation;
			
			this.sprite = Resources.Load<Sprite>("UI.Windows/DevicePreview/Images/" + this.GetMainImage());

			if (this.sprite != null) {
				/*
				if (orientation == ScreenOrientation.Landscape) {
					
					var textureWidth = this.sprite.texture.width;
					var textureHeight = this.sprite.texture.height;
					var border = this.sprite.border;
					var offsetRect = new Vector4(border.x / textureWidth * this.rect.width, border.y / textureHeight * this.rect.height, border.z / textureWidth * this.rect.width, border.w / textureHeight * this.rect.height);

					this.landscapeRect = new Rect(this.rect.x - offsetRect.x + offsetRect.z * 0.5f,
										          this.rect.y - offsetRect.y + offsetRect.w * 0.5f,
										          this.rect.width + offsetRect.z * 0.5f + offsetRect.z,
										          this.rect.height + offsetRect.w * 0.5f + offsetRect.w);

				} else {

					this.landscapeRect = landscapeRect;

				}*/

				if (orientation == ScreenOrientation.Landscape) {

					var offsetRect = this.sprite.border;
					this.deviceRect = new Rect(this.rect.x - offsetRect.x + offsetRect.z * 0.5f,
					                              this.rect.y - offsetRect.y + offsetRect.w * 0.5f,
					                              this.rect.width + offsetRect.z * 0.5f + offsetRect.z,
					                              this.rect.height + offsetRect.w * 0.5f + offsetRect.w);

				} else {

					this.rect = landscapeRect;
					var offsetRect = this.sprite.border;
					this.deviceRect = new Rect(this.rect.x - offsetRect.x + offsetRect.z * 0.5f,
					                           this.rect.y - offsetRect.y + offsetRect.w * 0.5f,
					                           this.rect.width + offsetRect.z * 0.5f + offsetRect.z,
					                           this.rect.height + offsetRect.w * 0.5f + offsetRect.w
					                           );

				}

			}

		}
开发者ID:RuFengLau,项目名称:Unity3d.UI.Windows,代码行数:51,代码来源:DeviceOutputBase.cs

示例9: Awake

	// Use this for initialization
	void Awake () {
		
		float Screenheight = (float)_targetCam.orthographicSize* 2.0f; 
		float Screenwidth = Screenheight * Screen.width / Screen.height;
		height = Screenheight ;
		width = Screenwidth;
		this.transform.localPosition = new Vector3(0,0,-0.8f);

		#if UNITY_EDITOR
		transform.localEulerAngles = new Vector3(90,180,0);
		transform.localScale = new Vector3(width/10, 1.0f, height/10);
		#elif UNITY_WEBPLAYER
		transform.localEulerAngles = new Vector3(90,180,0);
		transform.localScale = new Vector3(width/10, 1.0f, height/10);
		#endif

		orientation = Screen.orientation;

		Screen.sleepTimeout = SleepTimeout.NeverSleep;
		if (Screen.orientation == ScreenOrientation.Portrait||
		    Screen.orientation == ScreenOrientation.PortraitUpsideDown) {

			#if UNITY_ANDROID
			transform.localEulerAngles = new Vector3(0,270,90);
			transform.localScale = new Vector3(height/10, 1.0f, width/10);
			#elif UNITY_IOS
			if( Screen.orientation == ScreenOrientation.PortraitUpsideDown)
			{
				transform.localEulerAngles = new Vector3(0,270,90);
			}
			else
			{
				transform.localEulerAngles = new Vector3(0,90,270);
			}
			transform.localScale = new Vector3(-1*height/10, 1.0f, width/10);
			#endif
		} else if (Screen.orientation == ScreenOrientation.Landscape) {
			#if UNITY_ANDROID
			transform.localEulerAngles = new Vector3(90,180,0);
			transform.localScale = new Vector3(width/10, 1.0f, height/10);
			#elif UNITY_IOS
			transform.localEulerAngles = new Vector3(-90,0,0);
			transform.localScale = new Vector3(-1*width/10, 1.0f, height/10);
			
			#endif
		}
	}
开发者ID:flicknewb,项目名称:ARG-Zombies-Scaffolding,代码行数:48,代码来源:CameraPlaneController.cs

示例10: SetResolution

			public bool SetResolution(int width, int height, float ppi, ScreenOrientation orientation, IDeviceOutput deviceOutput) {

				var result = false;

				this.orientation = orientation;
				this.deviceOutput = deviceOutput;

				this.ppi = ppi;
				this.currentWidth = width;
				this.currentHeight = height;
				
				this.tempScreenshot = new Texture2D(width, height, TextureFormat.RGB24, false);

				this.tempRenderTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
				/*
				if (this.previewCamera == null) {

					var go = new GameObject("__TempCamera");
					this.previewCamera = go.AddComponent<DevicePreviewCamera>();

				}

				this.previewCamera.Initialize(this.tempRenderTexture, () => {

					this.root.Repaint();
					GameObject.DestroyImmediate(this.previewCamera.gameObject);

				});*/

				var size = new Vector2(this.width, this.height);
				var imageSize = new Vector2(this.currentWidth, this.currentHeight);
				var factor = this.GetFactor(imageSize, size);
				var k = Screen.dpi / this.ppi;

				if (factor / k < 1f) {

					result = true;

				}

				this.isActive = true;

				this.Update();

				return result;

			}
开发者ID:RuFengLau,项目名称:Unity3d.UI.Windows,代码行数:47,代码来源:DevicePreviewWindow.cs

示例11: GetProjectionGL

    // Returns the QCAR projection matrix
    public static Matrix4x4 GetProjectionGL(float nearPlane, float farPlane, ScreenOrientation screenOrientation)
    {
        float[] projMatrixArray = new float[16];
        IntPtr projMatrixPtr = Marshal.AllocHGlobal(
                    Marshal.SizeOf(typeof(float)) * projMatrixArray.Length);

        QCARWrapper.Instance.GetProjectionGL(nearPlane, farPlane, projMatrixPtr,
                    (int)screenOrientation);

        Marshal.Copy(projMatrixPtr, projMatrixArray, 0, projMatrixArray.Length);
        Matrix4x4 projMatrix = Matrix4x4.identity;
        for (int i = 0; i < 16; i++)
            projMatrix[i] = projMatrixArray[i];

        Marshal.FreeHGlobal(projMatrixPtr);

        return projMatrix;
    }
开发者ID:JSungMin,项目名称:AugmentedRealityExample,代码行数:19,代码来源:QCARUnityImpl.cs

示例12: ResetOrientation

    /// <summary>
    ///  Method to approraitiatly rotate the device and screen orientation
    /// </summary>
    private void ResetOrientation()
    {
        Vector3 cardboardRot = Cardboard.SDK.transform.GetChild (0).rotation.eulerAngles;
        if ( (cardboardRot.z + ScreenRotationThreshold > 360f) || (0f > cardboardRot.z - ScreenRotationThreshold) ) {
            currOrient = ScreenOrientation.LandscapeLeft;
        } else if ( (cardboardRot.z - ScreenRotationThreshold < 270f) && (270f < cardboardRot.z + ScreenRotationThreshold) ) {
            currOrient = ScreenOrientation.Portrait;
        } else if ( (cardboardRot.z - ScreenRotationThreshold < 90f) && (90f < cardboardRot.z + ScreenRotationThreshold) ) {
            currOrient = ScreenOrientation.PortraitUpsideDown;
        } else if ( (cardboardRot.z - ScreenRotationThreshold < 180f) && (180f < cardboardRot.z + ScreenRotationThreshold) ) {
            currOrient = ScreenOrientation.LandscapeRight;
        }

        if (NaviMobileManager.Instance.canUserResetOrientation)
            Screen.orientation = currOrient;

        NaviMobileManager.Instance.SendCurrentSize ();
    }
开发者ID:vmohan7,项目名称:Navi,代码行数:21,代码来源:GyroManager.cs

示例13: SetRect

		public void SetRect(Rect groupRect, Rect screenRect, Rect rect, Rect landscapeRect, ScreenOrientation orientation) {

			this.groupRect = groupRect;
			this.screenRect = screenRect;
			this.rect = rect;
			this.orientation = orientation;

			if (this.sprite == null) {
				
				var filepath = "UI.Windows/DevicePreview/Images/" + this.GetMainImage();
				this.sprite = UnityEditor.UI.Windows.CoreUtilities.Load<Sprite>(filepath);

			}

			if (this.sprite != null) {

				var imageSize = this.sprite.rect.size;
				var offsetRect = this.sprite.border;
				var offset = this.GetOffset();

				var cx = (imageSize.x - offsetRect.x - offsetRect.z) * 0.5f + offsetRect.x + offset.x;
				var cy = (imageSize.y - offsetRect.y - offsetRect.w) * 0.5f + offsetRect.y + offset.y;
				
				offset = new Vector2((cx - imageSize.x * 0.5f) * 0.5f, (imageSize.y * 0.5f - cy) * 0.5f);
				this.rect.center -= offset;

				if (orientation == ScreenOrientation.Portrait) {

					var imageContentRect = new Rect(offsetRect.x, offsetRect.y, imageSize.x - offsetRect.z - offsetRect.x, imageSize.y - offsetRect.w - offsetRect.y);
					var k = this.rect.height / imageContentRect.height;
					this.deviceRect = new Rect(this.groupRect.x + this.rect.center.x - imageSize.x * 0.5f * k, this.groupRect.y + this.rect.center.y - imageSize.y * 0.5f * k, imageSize.x * k, imageSize.y * k);

				} else {

					var imageContentRect = new Rect(offsetRect.y, offsetRect.x, imageSize.y - offsetRect.w - offsetRect.y, imageSize.x - offsetRect.z - offsetRect.x);
					var k = this.rect.width / imageContentRect.width;
					this.deviceRect = new Rect(this.groupRect.y + this.rect.center.x - imageSize.x * 0.5f * k, -this.groupRect.x + this.rect.center.y - imageSize.y * 0.5f * k, imageSize.x * k, imageSize.y * k);

				}

			}

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:43,代码来源:DeviceOutputBase.cs

示例14: Update

    // Process the camera image and tracking data for this frame
    public void Update(ScreenOrientation counterRotation)
    {
        // enable "fake tracking" if running in the free editor version
        // that does not support native plugins
        if (!QCARRuntimeUtilities.IsQCAREnabled())
        {
            UpdateTrackablesEditor();
            return;
        }

        // Prepare the camera image container
        UpdateImageContainer();

        if (QCARRuntimeUtilities.IsPlayMode())
        {
            CameraDeviceImpl cameraDeviceImpl = (CameraDeviceImpl)CameraDevice.Instance;
            if (cameraDeviceImpl.WebCam.DidUpdateThisFrame)
            {
                InjectCameraFrame();
            }
        }

        // Draw the video background or update the video texture
        // Also retrieve registered camera images for this frame
        QCARWrapper.Instance.UpdateQCAR(mImageHeaderData, mNumImageHeaders,
            mDrawVideobackground ? 0 : 1,
            mLastProcessedFrameStatePtr, (int)counterRotation);

        FrameState frameState = (FrameState)Marshal.PtrToStructure(mLastProcessedFrameStatePtr, typeof(FrameState));
        // Reinitialize the trackable data container if required:
        InitializeTrackableContainer(frameState.numTrackableResults);

        // Handle the camera image data
        UpdateCameraFrame();

        // Handle the trackable data
        UpdateTrackers(frameState);

        if (QCARRuntimeUtilities.IsPlayMode())
        {
            // read out the index of the last processed frame
            CameraDeviceImpl cameraDeviceImpl = (CameraDeviceImpl)CameraDevice.Instance;
            cameraDeviceImpl.WebCam.SetFrameIndex(frameState.frameIndex);
        }
    }
开发者ID:negimochi,项目名称:vuforia_test,代码行数:46,代码来源:QCARManagerImpl.cs

示例15: SetOrientation

 public static void SetOrientation(this IWebDriver driver, ScreenOrientation orientation)
 {
     ((IRotatable) driver).Orientation = orientation;
 }
开发者ID:tokarthik,项目名称:ProtoTest.Golem,代码行数:4,代码来源:WebDriverExtensions.cs


注:本文中的ScreenOrientation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。