| | |
| | | |
| | | if (EndlessGameUI.instance.state == EndlessGameUI.State.Building) |
| | | EndlessGameUI.instance.CancelGhostPlacement(); |
| | | |
| | | 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); |
| | | ShowGameOverPanel(); |
| | | //panelUI.SetPlayEffectAC(PlayEffect); |
| | | //GameObject.Find("UICamera/BottomCanvas").GetComponent<Canvas>().enabled = false; |
| | | CanvasGroup canvasGroup = GameObject.Find("UICamera/BottomCanvas/Panel").GetComponent<CanvasGroup>(); |
| | | canvasGroup.alpha = 0; |
| | | canvasGroup.interactable = false; |
| | | |
| | | EndlessUIStart.instance.GameOver(); |
| | | return; |
| | | |
| | | // RefreshFinalWave(); |
| | | // RefreshPropList(); |
| | | // SettlementUI.SetActive(true); |
| | | // PlayEffect(); |
| | | } |
| | | |
| | | private void ShowGameOverPanel() |
| | | { |
| | | EndlessRandomTower.instance.SetCountDown(false); |
| | | EndlessRandomTower.instance.SetPS(false); |
| | | |
| | | GameObject go = Instantiate(Resources.Load<GameObject>("Prefabs/GameOverPanel"), GameObject.Find("UICamera/BottomCanvas").transform); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.GameOverEnd, GameOverEnd); |
| | | } |
| | | |
| | | private void GameOverEnd() |
| | | { |
| | | EventCenter.Ins.Remove((int)KTGMGemClient.EventType.GameOverEnd, GameOverEnd); |
| | | ShowFinalPanel(); |
| | | } |
| | | |
| | | private void ShowFinalPanel() |
| | | { |
| | | GameObject go = Instantiate(Resources.Load<GameObject>("UI/Final/FinalPanel"), GameObject.Find("UICamera/BottomCanvas").transform); |
| | | FinalPanel panelUI = go.GetComponent<FinalPanel>(); |
| | | int level = EndlessLevelManager.instance.CurrentLevel; |
| | | int wave = EndlessLevelManager.instance.WaveManager.CurrentWaveIndex; |
| | | |
| | | if (GameConfig.IsNewbieStart) |
| | | { |
| | | //panelUI.SetData($"{EndlessLevelManager.instance.CurrentLevel - EndlessPortData.NewbieTotalLevel}关 {EndlessLevelManager.instance.WaveManager.CurrentWaveIndex}波", EndlessScoreData.CurrentSocre); |
| | | level = EndlessLevelManager.instance.CurrentLevel - EndlessPortData.NewbieTotalLevel; |
| | | Debug.Log($"新手开始玩的,实际关卡:{EndlessLevelManager.instance.CurrentLevel} 新手关卡:{EndlessPortData.NewbieTotalLevel}"); |
| | | } |
| | | else |
| | | { |
| | | //panelUI.SetData($"{EndlessLevelManager.instance.CurrentLevel}关 {EndlessLevelManager.instance.WaveManager.CurrentWaveIndex}波", EndlessScoreData.CurrentSocre); |
| | | } |
| | | panelUI.SetData($"{level}关 {wave}波", EndlessScoreData.CurrentSocre); |
| | | |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessCompletedPort, level, wave); |
| | | |
| | | } |
| | | |
| | | private void PlayEffect() |
| | |
| | | /// </summary> |
| | | protected void Victory() |
| | | { |
| | | ++GameConfig.GameCompletedCount; |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLevelCompleted); |
| | | EndlessUIStart.instance.Pause(); |
| | | |
| | | int showFavorite = PlayerPrefs.GetInt("GemBattleFavorite"); |
| | | ShowPanel(); |
| | | |
| | | if (showFavorite == 0) |
| | | { |
| | | GameObject go = Instantiate(Resources.Load<GameObject>("UI/Favorite/FavoritePanel"), this.transform.parent.parent); |
| | | FavoritePanelUI panelUI = go.GetComponent<FavoritePanelUI>(); |
| | | panelUI.SetAC(ShowPanel); |
| | | // int showFavorite = PlayerPrefs.GetInt("GemBattleFavorite"); |
| | | |
| | | } |
| | | else |
| | | { |
| | | ShowPanel(); |
| | | } |
| | | // 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() |
| | |
| | | protected void SafelyUnsubscribe() |
| | | { |
| | | LazyLoad(); |
| | | levelManager.LevelCompleted -= Victory; |
| | | if (levelManager != null) |
| | | levelManager.LevelCompleted -= Victory; |
| | | } |
| | | |
| | | /// <summary> |