12345678910111213141516171819202122232425262728293031323334353637383940 |
- using UnityEngine;
- using System.Collections;
- public class FullScreenUITexture : MonoBehaviour
- {
- private UITexture uiTexture;
- private UISprite uiSprite;
- void Start()
- {
- uiTexture = GetComponent<UITexture>();
- uiSprite = GetComponent<UISprite>();
- if (uiTexture != null)
- {
- uiTexture.width = (int)(Screen.height * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width)*1.05f);
- uiTexture.height = (int)(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 1.05f);
- }
- if (uiSprite != null)
- {
- uiSprite.width = (int)(Screen.height * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 1.05f);
- uiSprite.height = (int)(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 1.05f);
- }
- }
- void Update()
- {
- if (uiTexture != null)
- {
- uiTexture.width = (int)(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.height) * 1.05f);
- uiTexture.height = (int)(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 1.05f);
- }
- if (uiSprite != null)
- {
- uiSprite.width = (int)(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.height) * 1.05f);
- uiSprite.height = (int)(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 1.05f);
- }
- }
- }
|