using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; /* 界面-挑战关卡选择 */ public class ChallengeOptionView : MonoBehaviour, MenuBackInterface { void Start() { HomeMgr.CacheView(this); PersistenHandler.ins?.menuBackCtr.views.Add(this); TopBarView.NeedShowIt(this); } void OnDestroy() { HomeMgr.RemoveCacheView(this); PersistenHandler.ins?.menuBackCtr.views.Remove(this); TopBarView.DontNeedShowIt(this); } public void StartGame(int gameType) { AudioMgr.ins.PlayBtn(); if (GlobalDataTemp.pkMatchType == PKMatchType.OnlinePK) { int newGameType = 0; if (gameType == 3) newGameType = 10; else if (gameType == 4) newGameType = 11; else if (gameType == 5) newGameType = 12; GlobalDataTemp.matchGameType = newGameType; JCUnityLib.CanvasUtils.PlusSortOrder( gameObject, GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKMatchView")), 1 ); return; } if (GlobalDataTemp.pkMatchType == PKMatchType.LocalPK) { if (gameType == 3) gameType = 6; else if (gameType == 4) gameType = 7; else if (gameType == 5) gameType = 8; } GlobalData.pkMatchType = GlobalDataTemp.pkMatchType; GameMgr.gameType = gameType; SceneManager.LoadScene("GameChallenge", LoadSceneMode.Single); } public void back() { AudioMgr.ins.PlayBtn(); Destroy(this.gameObject); } public bool OnMenuBack() { Destroy(gameObject); return true; } }