ChallengeOptionView.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. /* 界面-挑战关卡选择 */
  6. public class ChallengeOptionView : MonoBehaviour
  7. {
  8. void Start() {
  9. HomeMgr.CacheView(this);
  10. }
  11. void OnDestroy() {
  12. HomeMgr.RemoveCacheView(this);
  13. }
  14. public void StartGame(int gameType) {
  15. AudioMgr.ins.PlayBtn();
  16. if (GlobalDataTemp.pkMatchType == PKMatchType.OnlinePK) {
  17. int newGameType = 0;
  18. if (gameType == 3) newGameType = 10;
  19. else if (gameType == 4) newGameType = 11;
  20. else if (gameType == 5) newGameType = 12;
  21. GlobalDataTemp.matchGameType = newGameType;
  22. GameObject.Instantiate(GameObject.Find("WindowViews").transform.Find("PKMatchView").gameObject).SetActive(true);
  23. return;
  24. }
  25. if (GlobalDataTemp.pkMatchType == PKMatchType.LocalPK) {
  26. if (gameType == 3) gameType = 6;
  27. else if (gameType == 4) gameType = 7;
  28. else if (gameType == 5) gameType = 8;
  29. }
  30. GlobalData.pkMatchType = GlobalDataTemp.pkMatchType;
  31. GameMgr.gameType = gameType;
  32. SceneManager.LoadScene("GameChallenge", LoadSceneMode.Single);
  33. }
  34. public void back() {
  35. AudioMgr.ins.PlayBtn();
  36. Destroy(this.gameObject);
  37. }
  38. }