123456789101112131415161718192021222324252627282930 |
- using System;
- using UnityEngine;
- [ExecuteInEditMode]
- [RequireComponent(typeof(Camera))]
- [AddComponentMenu("NGUI/UI/Orthographic Camera")]
- public class UIOrthoCamera : MonoBehaviour
- {
- private void Start()
- {
- this.mCam = base.GetComponent<Camera>();
- this.mTrans = base.transform;
- this.mCam.orthographic = true;
- }
- private void Update()
- {
- float num = this.mCam.rect.yMin * (float)UICamera.ScreenHeight;
- float num2 = this.mCam.rect.yMax * (float)UICamera.ScreenHeight;
- float num3 = (num2 - num) * 0.5f * this.mTrans.lossyScale.y;
- if (!Mathf.Approximately(this.mCam.orthographicSize, num3))
- {
- this.mCam.orthographicSize = num3;
- }
- }
- private Camera mCam;
- private Transform mTrans;
- }
|