| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using TowerDefense.UI.HUD; |
| | | using DG.Tweening; |
| | | using TowerDefense.Towers.Placement; |
| | |
| | | /// </summary> |
| | | protected EndlessLevelManager levelManager; |
| | | |
| | | // Start is called before the first frame update |
| | | private void Start() |
| | | /// <summary> |
| | | /// 最终波次文本 |
| | | /// </summary> |
| | | public Text FinalWaveText; |
| | | |
| | | /// <summary> |
| | | /// 道具列表UI |
| | | /// </summary> |
| | | public GameObject PropListUI; |
| | | |
| | | public GameObject SettlementUI; |
| | | |
| | | public GameObject EffectPrefabObject; |
| | | |
| | | private GameObject effectObj; |
| | | |
| | | public void Init() |
| | | { |
| | | LazyLoad(); |
| | | levelManager.LevelCompleted -= Victory; |
| | | levelManager.LevelCompleted += Victory; |
| | | } |
| | | |
| | |
| | | EndlessUIStart.bFirstLoaded = false; |
| | | EndlessUIStart.bGameStart = false; |
| | | |
| | | TowerPlacementGridEndless.GRID_OPENCASH = 100; |
| | | TowerPlacementGridEndless.GRID_OPENCASH = 200; |
| | | |
| | | SafelyUnsubscribe(); |
| | | SceneManager.LoadScene(menuSceneName); |
| | |
| | | |
| | | if (EndlessGameUI.instance.state == EndlessGameUI.State.Building) |
| | | EndlessGameUI.instance.CancelGhostPlacement(); |
| | | |
| | | gameObject.SetActive(true); |
| | | |
| | | GameObject go = Instantiate(Resources.Load<GameObject>("UI/Final/FinalPanel"), GameObject.Find("UICamera/BottomCanvas").transform); |
| | | FinalPanel panelUI = go.GetComponent<FinalPanel>(); |
| | | panelUI.SetData($"{EndlessLevelManager.instance.CurrentLevel}关 {EndlessLevelManager.instance.WaveManager.CurrentWaveIndex}波", EndlessScoreData.CurrentSocre); |
| | | //panelUI.SetPlayEffectAC(PlayEffect); |
| | | //GameObject.Find("UICamera/BottomCanvas").GetComponent<Canvas>().enabled = false; |
| | | |
| | | EndlessUIStart.instance.GameOver(); |
| | | return; |
| | | |
| | | // RefreshFinalWave(); |
| | | // RefreshPropList(); |
| | | // SettlementUI.SetActive(true); |
| | | // PlayEffect(); |
| | | } |
| | | |
| | | private void PlayEffect() |
| | | { |
| | | if (effectObj == null) |
| | | { |
| | | effectObj = Instantiate(EffectPrefabObject); |
| | | GameObject particleSystemObject = GameObject.Find("ParticleSystemObject"); |
| | | effectObj.transform.SetParent(particleSystemObject.transform, false); |
| | | effectObj.transform.localPosition = new Vector3(0, -51.6f, 36.6f); |
| | | effectObj.transform.localScale = new Vector3(6, 6, 6); |
| | | } |
| | | |
| | | ParticleSystem ps = effectObj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | ps.Play(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | protected void Victory() |
| | | { |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLevelCompleted); |
| | | EndlessUIStart.instance.Pause(); |
| | | |
| | | ShowPanel(); |
| | | |
| | | // int showFavorite = PlayerPrefs.GetInt("GemBattleFavorite"); |
| | | |
| | | // if (showFavorite == 0) |
| | | // { |
| | | // GameObject go = Instantiate(Resources.Load<GameObject>("UI/Favorite/FavoritePanel"), this.transform.parent.parent); |
| | | // FavoritePanelUI panelUI = go.GetComponent<FavoritePanelUI>(); |
| | | // panelUI.SetAC(ShowPanel); |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // ShowPanel(); |
| | | // } |
| | | } |
| | | |
| | | private void ShowPanel() |
| | | { |
| | | OpenEndGameScreen(true); |
| | | if (VictoryAudio != null && AudioSource != null) |
| | | AudioSource.PlayOneShot(VictoryAudio); |
| | | // if (VictoryAudio != null && AudioSource != null) |
| | | // AudioSource.PlayOneShot(VictoryAudio); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (levelManager == null && EndlessLevelManager.instanceExists) |
| | | levelManager = EndlessLevelManager.instance; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新最终波次信息 |
| | | /// </summary> |
| | | /// <param name="level">关卡等级</param> |
| | | /// <param name="wave">波次</param> |
| | | private void RefreshFinalWave() |
| | | { |
| | | int level = EndlessLevelManager.instance.CurrentLevel; |
| | | int wave = EndlessLevelManager.instance.WaveManager.CurrentWaveIndex; |
| | | |
| | | FinalWaveText.text = $"第{level}关,第{wave}波"; |
| | | } |
| | | |
| | | private void RefreshPropList() |
| | | { |
| | | EndlessSettlementPropList list = PropListUI.GetComponent<EndlessSettlementPropList>(); |
| | | list.RefreshList(); |
| | | } |
| | | } |
| | | } |