using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class LogoZoom : MonoBehaviour { public bool isDark=true; GameObject logo; public Sprite darkSp; ScreenOrientation orientation; int width = Screen.width; void Start() { orientation = Screen.orientation; logo= GameObject.Find("PottingLogo"); if (isDark) { Image bg = GameObject.Find("PottingBg").GetComponent(); logo.GetComponent().sprite = darkSp; bg.color = new Color((18 / 255f), (18 / 255f), (18/ 255f), (255 / 255f)); } if (orientation == ScreenOrientation.LandscapeLeft) { width = Screen.height; } Zoom(); Invoke("NextScene", 3f); } void Zoom() { if (orientation == ScreenOrientation.Portrait || orientation == ScreenOrientation.PortraitUpsideDown) { float logow = width / 3; float zoom = 1.4238f; float logoh = logow / zoom; logo.transform.GetComponent().sizeDelta = new Vector2(logow, logoh); } else { float logoh = width / 5; float zoom = 1.4238f; float logow = logoh * zoom; logo.transform.GetComponent().sizeDelta = new Vector2(logow, logoh); } } /// /// 加载游戏场景 /// void NextScene() { SceneManager.LoadScene("PottingMobScene"); } // Update is called once per frame void Update() { if (orientation!= Screen.orientation) { orientation = Screen.orientation; Zoom(); } } }