Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Setup.cs 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using UnityEngine;
  2. using UnityEngine.SceneManagement;
  3. public class Setup : MonoBehaviour
  4. {
  5. void Start()
  6. {
  7. Main.Global.版本號比對="false";
  8. float screenWidth = Screen.width;
  9. float screenHeight = Screen.height;
  10. if (Screen.orientation == ScreenOrientation.LandscapeLeft)
  11. {
  12. Main.Global.螢幕方向="橫";
  13. Main.Global.rate = screenHeight / screenWidth;
  14. }
  15. else if (Screen.orientation == ScreenOrientation.Portrait)
  16. {
  17. Main.Global.螢幕方向="直";
  18. Main.Global.rate = screenWidth / screenHeight;
  19. }
  20. if (Main.Global.rate > 0.55f)
  21. {
  22. Main.Global.固高=1600f;
  23. Main.Global.固寬=1000f;
  24. Main.Global.螢幕格式="胖";
  25. if (Main.Global.rate>(Main.Global.固寬/Main.Global.固高))
  26. {
  27. if (Main.Global.螢幕方向=="直")
  28. {
  29. Main.Global.固比 = 1f;
  30. Main.Global.固比1 = 0f;
  31. }
  32. else
  33. {
  34. Main.Global.固比 = 0f;
  35. Main.Global.固比1 = 1f;
  36. }
  37. }
  38. else
  39. {
  40. if (Main.Global.螢幕方向=="直")
  41. {
  42. Main.Global.固比 = 0f;
  43. Main.Global.固比1 = 1f;
  44. }
  45. else
  46. {
  47. Main.Global.固比 = 1f;
  48. Main.Global.固比1 = 0f;
  49. }
  50. }
  51. }
  52. else
  53. {
  54. Main.Global.螢幕格式="瘦";
  55. Main.Global.固高=1900f;
  56. Main.Global.固寬=900f;
  57. if ((Main.Global.固寬/Main.Global.固高)<Main.Global.rate)
  58. {
  59. if (Main.Global.螢幕方向=="直")
  60. {
  61. Main.Global.固比 = 1f;
  62. Main.Global.固比1 = 0f;
  63. }
  64. else
  65. {
  66. Main.Global.固比 = 0f;
  67. Main.Global.固比1 = 1f;
  68. }
  69. }
  70. else
  71. {
  72. if (Main.Global.螢幕方向=="直")
  73. {
  74. Main.Global.固比 = 0f;
  75. Main.Global.固比1 = 1f;
  76. }
  77. else
  78. {
  79. Main.Global.固比 = 1f;
  80. Main.Global.固比1 = 0f;
  81. }
  82. }
  83. }
  84. Debug.Log(Screen.orientation);
  85. change_Secen(1);
  86. }
  87. public void change_Secen(int _screenNum)
  88. {
  89. SceneManager.LoadScene(_screenNum);
  90. }
  91. }