ChallengeOptionView.cs 1.3 KB

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