PlaySceneManager.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class PlaySceneManager : MonoBehaviour {
  6. [SerializeField]
  7. private GameObject MenuObj;
  8. private bool systemMenu;
  9. [SerializeField]
  10. private Toggle WF_toggle;
  11. // Use this for initialization
  12. void Start () {
  13. WF_toggle.isOn = Screen.fullScreen;
  14. }
  15. // Update is called once per frame
  16. void Update () {
  17. if (Input.GetKeyUp(KeyCode.Escape))
  18. {
  19. systemMenu = !systemMenu;
  20. MenuFlag(systemMenu);
  21. // Debug.Log(systemMenu);
  22. }
  23. }
  24. public void MenuFlag(bool flag)
  25. {
  26. MenuObj.SetActive(flag);
  27. systemMenu = flag;
  28. if (flag) Time.timeScale = 0; else Time.timeScale = 1;
  29. }
  30. public void pressQuit()
  31. {
  32. Application.Quit();
  33. }
  34. private void FullWindowChange()
  35. {
  36. Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, WF_toggle.isOn);
  37. }
  38. public void BackToTitle()
  39. {
  40. Time.timeScale = 1;
  41. GameManager.instance.SwitchScene("title");
  42. }
  43. }