SetUpView1.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.SceneManagement;
  6. /* 设置界面1 */
  7. public class SetUpView1 : MonoBehaviour, MenuBackInterface
  8. {
  9. void Awake() {
  10. if (CommonConfig.needToExamine) {
  11. transform.Find("Items/GameSetup").GetComponentInChildren<TextAutoLanguage>().SetText(1234560);
  12. transform.Find("BtnQuitGame").GetComponentInChildren<TextAutoLanguage>().SetText(1234561);
  13. }
  14. }
  15. void Start()
  16. {
  17. PersistenHandler.ins?.menuBackCtr.views.Add(this);
  18. }
  19. void OnDestroy()
  20. {
  21. PersistenHandler.ins?.menuBackCtr.views.Remove(this);
  22. }
  23. public bool OnMenuBack() {
  24. Destroy(gameObject);
  25. return true;
  26. }
  27. public void GoToGameSetupView() {
  28. AudioMgr.ins.PlayBtn();
  29. GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView"), Vector3.zero, new Quaternion());
  30. }
  31. public void GoToGameCourse() {
  32. AudioMgr.ins.PlayBtn();
  33. GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/CourseView"));
  34. }
  35. public void AboutUs() {
  36. AudioMgr.ins.PlayBtn();
  37. GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AboutUsView"), transform);
  38. }
  39. public void GoToUserAgreement() {
  40. AudioMgr.ins.PlayBtn();
  41. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
  42. o.GetComponent<AgreementView>().EnterUserAgreement();
  43. }
  44. public void GoToPrivacyAgreement() {
  45. AudioMgr.ins.PlayBtn();
  46. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
  47. o.GetComponent<AgreementView>().EnterPrivacyAgreement();
  48. }
  49. public void QuitGame() {
  50. AudioMgr.ins.PlayBtn();
  51. Application.Quit();
  52. }
  53. public void QuitLogin()
  54. {
  55. AudioMgr.ins.PlayBtn();
  56. PlayerPrefs.DeleteKey("IdAndToken");
  57. SceneManager.LoadScene("Login", LoadSceneMode.Single);
  58. if (UserPlayer.ins != null) UserPlayer.ins.Close();
  59. }
  60. public void Back() {
  61. AudioMgr.ins.PlayBtn();
  62. Destroy(this.gameObject);
  63. }
  64. }