This commit is contained in:
corn
2026-06-07 22:59:32 +08:00
commit a62ff7379b
7171 changed files with 10015624 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OrientationChecker : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnEnable() {
if(Screen.orientation == ScreenOrientation.Portrait)
{
this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
}
if(Screen.orientation == ScreenOrientation.PortraitUpsideDown)
{
this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
}
if(Screen.orientation == ScreenOrientation.LandscapeLeft)
{
this.gameObject.transform.GetChild(1).gameObject.SetActive(true);
}
if(Screen.orientation == ScreenOrientation.LandscapeRight)
{
this.gameObject.transform.GetChild(1).gameObject.SetActive(true);
}
}
void OnDisable() {
if(Screen.orientation == ScreenOrientation.Portrait)
{
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
}
if(Screen.orientation == ScreenOrientation.PortraitUpsideDown)
{
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
}
if(Screen.orientation == ScreenOrientation.LandscapeLeft)
{
this.gameObject.transform.GetChild(1).gameObject.SetActive(false);
}
if(Screen.orientation == ScreenOrientation.LandscapeRight)
{
this.gameObject.transform.GetChild(1).gameObject.SetActive(false);
}
}
}