ChallengeOptionView.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. /* 界面-挑战关卡选择 */
  6. public class ChallengeOptionView : JCUnityLib.ViewBase, MenuBackInterface
  7. {
  8. void Start() {
  9. PersistenHandler.ins?.menuBackCtr.views.Add(this);
  10. TopBarView.NeedShowIt(this);
  11. }
  12. void OnDestroy() {
  13. PersistenHandler.ins?.menuBackCtr.views.Remove(this);
  14. TopBarView.DontNeedShowIt(this);
  15. }
  16. public void StartGame(int gameType) {
  17. AudioMgr.ins.PlayBtn();
  18. if (GlobalDataTemp.pkMatchType == PKMatchType.OnlinePK) {
  19. int newGameType = 0;
  20. if (gameType == 3) newGameType = 10;
  21. else if (gameType == 4) newGameType = 11;
  22. else if (gameType == 5) newGameType = 12;
  23. GlobalDataTemp.matchGameType = newGameType;
  24. ViewMgr.Instance.ShowView<PKMatchView>();
  25. return;
  26. }
  27. if (GlobalDataTemp.pkMatchType == PKMatchType.LocalPK) {
  28. if (gameType == 3) gameType = 6;
  29. else if (gameType == 4) gameType = 7;
  30. else if (gameType == 5) gameType = 8;
  31. }
  32. GlobalData.pkMatchType = GlobalDataTemp.pkMatchType;
  33. GameMgr.gameType = gameType;
  34. SceneManager.LoadScene("GameChallenge", LoadSceneMode.Single);
  35. }
  36. public void back() {
  37. AudioMgr.ins.PlayBtn();
  38. ViewMgr.Instance.DestroyView<ChallengeOptionView>();
  39. }
  40. public bool OnMenuBack() {
  41. ViewMgr.Instance.DestroyView<ChallengeOptionView>();
  42. return true;
  43. }
  44. }