GameStartView.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. /* 界面-游戏开始 */
  6. public class GameStartView : JCUnityLib.ViewBase, MenuBackInterface
  7. {
  8. public static GameStartView ins;
  9. void Start() {
  10. ins = this;
  11. PersistenHandler.ins?.menuBackCtr.views.Add(this);
  12. TopBarView.NeedShowIt(this);
  13. }
  14. void OnDestroy() {
  15. if (ins == this) ins = null;
  16. PersistenHandler.ins?.menuBackCtr.views.Remove(this);
  17. TopBarView.DontNeedShowIt(this);
  18. }
  19. public bool OnMenuBack() {
  20. ViewMgr.Instance.DestroyView<GameStartView>();
  21. return true;
  22. }
  23. public void GoTo(string target) {
  24. AudioMgr.ins.PlayBtn();
  25. switch (target)
  26. {
  27. case "闯关":
  28. GlobalDataTemp.pkMatchType = PKMatchType.None;
  29. ViewMgr.Instance.ShowView<ChallengeOptionView>();
  30. break;
  31. case "限时":
  32. GlobalData.pkMatchType = PKMatchType.None;
  33. GameMgr.gameType = 1;
  34. SceneManager.LoadScene("Game", LoadSceneMode.Single);
  35. break;
  36. case "PK":
  37. GlobalDataTemp.pkMatchType = PKMatchType.LocalPK;
  38. ViewMgr.Instance.ShowView<RoleSelectView>();
  39. break;
  40. default:
  41. break;
  42. }
  43. }
  44. public void Back() {
  45. AudioMgr.ins.PlayBtn();
  46. ViewMgr.Instance.DestroyView<GameStartView>();
  47. }
  48. }