36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class IpadScaler : MonoBehaviour
|
|
{
|
|
public Camera scrollCamera;
|
|
public Camera guiCamera;
|
|
public List<CanvasScaler> scalers;
|
|
public List<PanelIpadSwapper> panelIpadSwappers;
|
|
|
|
// Start is called before the first frame update
|
|
private void Start()
|
|
{
|
|
float ratio = (float)Screen.width / Screen.height;
|
|
|
|
if (ratio < 1.4f)
|
|
{
|
|
scalers.ForEach(scaler => scaler.referenceResolution = new Vector2(scaler.referenceResolution.x, 800f));
|
|
scrollCamera.orthographicSize = 1.47f;
|
|
guiCamera.rect = new Rect(0, 0.19f, 1f, 0.59f);
|
|
panelIpadSwappers.ForEach(swapper => swapper.SetIpadPanels());
|
|
}
|
|
else if (ratio < 1.5)
|
|
{
|
|
scalers.ForEach(scaler => scaler.referenceResolution = new Vector2(scaler.referenceResolution.x, 800f));
|
|
scrollCamera.orthographicSize = 1.35f;
|
|
guiCamera.rect = new Rect(0, 0.165f, 1f, 0.64f);
|
|
panelIpadSwappers.ForEach(swapper => swapper.SetAlternateIpadPanels());
|
|
}
|
|
}
|
|
}
|
|
} |