From 0df19f41bd178984131c2f1b59bae330fbf23d24 Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Mon, 14 Dec 2020 11:05:08 +0800 Subject: [PATCH] 安卓报错BUG --- Assets/Scripts/UI/FinalPanel/FinalPanel.cs | 139 ++++++++++++++++++++++++++------------------- 1 files changed, 80 insertions(+), 59 deletions(-) diff --git a/Assets/Scripts/UI/FinalPanel/FinalPanel.cs b/Assets/Scripts/UI/FinalPanel/FinalPanel.cs index 66d5534..3a89838 100644 --- a/Assets/Scripts/UI/FinalPanel/FinalPanel.cs +++ b/Assets/Scripts/UI/FinalPanel/FinalPanel.cs @@ -26,6 +26,7 @@ closeBtn = transform.Find("BackGround").GetComponent<Button>(); closeBtn.onClick.AddListener(() => { + goonText.DOKill(); gameObject.SetActive(false); GameConfig.NextSceneName = endlessGameScene; SceneManager.LoadScene(loadingScene); @@ -69,6 +70,9 @@ TextMeshProUGUI rankUpbj; GameObject newPlayerImage;//新用户提示 + GameObject httpCountDownPanel; + Text goonText; + /// <summary> /// 入口函数 /// </summary> @@ -76,8 +80,11 @@ /// <param name="myScore">789220</param> public void SetData(string waveInfo, int myScore) { + AudioSourceManager.Ins.StopBGAudio();//进来后停止播放BGM + _waveInfo = waveInfo; _myScore = myScore; + isFirstStart = true;//首次启动下载到数据执行动效 _data = new SmallList<FinalPanelItemData>(); Debug.Log($"_myScore:{_myScore} _waveInfo:{_waveInfo}"); @@ -125,9 +132,9 @@ _limitUp = 100; finalHttp.Init(GetHttpData, _limit);//重置状态,设置回调和拉取的所有数据 - itemFirst = transform.Find("ItemPanel/FinalPanelItemFirst").GetComponent<FinalPanelItem>(); - itemSecond = transform.Find("ItemPanel/FinalPanelItemSecond").GetComponent<FinalPanelItem>(); - itemThird = transform.Find("ItemPanel/FinalPanelItemThird").GetComponent<FinalPanelItem>(); + itemFirst = transform.Find("ItemPanel/ItemMask/FinalPanelItemFirst").GetComponent<FinalPanelItem>(); + itemSecond = transform.Find("ItemPanel/ItemMask/FinalPanelItemSecond").GetComponent<FinalPanelItem>(); + itemThird = transform.Find("ItemPanel/ItemMask/FinalPanelItemThird").GetComponent<FinalPanelItem>(); httpCountDownPanel = transform.Find("HttpCountDownPanel").gameObject; httpCountDownPanel.SetActive(false); @@ -139,6 +146,7 @@ endPs = transform.Find("Effect_UI_JieSuanShengLi/03").GetComponent<ParticleSystem>(); + goonText = transform.Find("Image_HScore/GoOnText").GetComponent<Text>(); //PlayerPrefs.DeleteKey("GemBattlePlayerNickName"); playerNickName = PlayerPrefs.GetString(playerPrefs_NickName); @@ -172,62 +180,15 @@ private void StartHttp() { - //OpenHttpCountDown(true); Debug.Log($"_myScore:{_myScore} _waveInfo:{_waveInfo}"); finalHttp.SendPost(playerNickName, _myScore, 1, _waveInfo); - } - - #region 联网倒计时判断 - bool isSending; - int sendCount; - GameObject httpCountDownPanel; - private void OpenHttpCountDown(bool isOn) - { - if (isOn) - { - isSending = true; - sendCount = 0; - StartCoroutine("HttpCountDown"); - } - else - { - isSending = false; - StopCoroutine("HttpCountDown"); - } - } - IEnumerator HttpCountDown() - { - while (isSending) - { - yield return new WaitForSeconds(1.0f); - sendCount++; - Debug.Log($"等待了{sendCount}秒"); - if (sendCount > 10) - { - Debug.Log("等了10秒了,连接失败"); - if (!httpCountDownPanel.activeSelf) httpCountDownPanel.SetActive(true); - - isSending = false; - - break; - } - } - } - #endregion - - - private void Close() - { - gameObject.SetActive(false); - GameConfig.NextSceneName = endlessGameScene; - SceneManager.LoadScene(loadingScene); } private void GetHttpData(List<HttpGetInfo> allHttpGetInfoLis, int myrank, HttpGetInfo mydataHttpInfo) { scroller = transform.Find("Scroller").GetComponent<EnhancedScroller>(); scroller.Delegate = this; - + playPSItem = new List<FinalPanelItem>(); RefreshHttpData(allHttpGetInfoLis, myrank, mydataHttpInfo); if (allHttpGetInfoLis != null) @@ -238,10 +199,13 @@ } PlayDoTween(); + isFirstStart = false; } private void PlayDoTween() { + AudioSourceManager.Ins.Play(AudioEnum.End); + Sequence agentTweenSeq = DOTween.Sequence(); //先出现 Image tsTiele = transform.Find("Image_Tiele").GetComponent<Image>(); @@ -249,22 +213,29 @@ agentTweenSeq.Join(tsTiele.DOFade(1, 0.3f)); Image Image1 = transform.Find("Image1").GetComponent<Image>(); - agentTweenSeq.Append(Image1.transform.DOScale(Vector3.one, 0.2f));//变化图片大小 - agentTweenSeq.Join(Image1.DOFade(1, 0.2f)); + float imageTime = 0.3f; + agentTweenSeq.Append(Image1.transform.DOScale(Vector3.one, imageTime).SetEase(Ease.InOutBack));//变化图片大小 + agentTweenSeq.Join(Image1.DOFade(1, imageTime)); agentTweenSeq.Join(waveText.DOText(_waveInfo, 0.2f)); Image Image2 = transform.Find("Image2").GetComponent<Image>(); - agentTweenSeq.Append(Image2.transform.DOScale(Vector3.one, 0.2f));//变化图片大小 - agentTweenSeq.Join(Image2.DOFade(1, 0.2f)); + agentTweenSeq.Append(Image2.transform.DOScale(Vector3.one, imageTime).SetEase(Ease.InOutBack));//变化图片大小 + agentTweenSeq.Join(Image2.DOFade(1, imageTime)); Image Image3 = transform.Find("Image3").GetComponent<Image>(); - agentTweenSeq.Append(Image3.transform.DOScale(Vector3.one, 0.2f));//变化图片大小 - agentTweenSeq.Join(Image3.DOFade(1, 0.2f)); + + agentTweenSeq.Append(Image3.transform.DOScale(Vector3.one, imageTime).SetEase(Ease.InOutBack));//变化图片大小 + agentTweenSeq.Join(Image3.DOFade(1, imageTime)); + agentTweenSeq.AppendCallback(() => + { + Debug.Log("开始播放声音"); + AudioSourceManager.Ins.Play(AudioEnum.FinalScore); + }); agentTweenSeq.Join(DOTween.To(delegate (float value) { var temp = Math.Floor(value); scoreText.text = temp + ""; - }, 0, _myScore, 1.0f)); + }, 0, _myScore, 1.4f)); agentTweenSeq.AppendCallback(StartLoadLargeData); tsLight = transform.Find("ImageLight"); @@ -309,12 +280,32 @@ if (_data.Count > 0) { scrollerCanvasGroup.alpha = 1; - itemCanvasGroup.alpha = 1; + Debug.Log("开始展示排行榜"); + } + if (playPSItem.Count > 0) + { + itemCanvasGroup.alpha = 1; + float duration = 0.1f; + for (int i = 0; i < playPSItem.Count; i++) + { + playPSItem[i].PlayDoTween(duration); + yield return new WaitForSeconds(duration); + } image_HScore.SetActive(true); + goonFade = true; + ShowGoOnText(); } yield break; + } + + bool goonFade; + private void ShowGoOnText() + { + goonText.DOFade(goonFade ? 0 : 1, 0.8f).SetEase(Ease.InOutQuad).OnComplete(ShowGoOnText); + goonText.transform.DOScale(goonFade ? 0.9f : 1.1f, 0.8f); + goonFade = !goonFade; } /// <summary> @@ -361,6 +352,7 @@ /// </summary> protected void RotateLight() { + Debug.Log("开始旋转"); isRotate = true; offect = 0; } @@ -427,6 +419,8 @@ } List<HttpGetInfo> _allHttpGetInfoLis; + List<FinalPanelItem> playPSItem;//特效list + bool isFirstStart; private void RefreshHttpData(List<HttpGetInfo> allHttpGetInfoLis, int myrank, HttpGetInfo mydataHttpInfo) { _allHttpGetInfoLis = allHttpGetInfoLis; @@ -469,6 +463,11 @@ data.index = 1; itemFirst.gameObject.SetActive(true); itemFirst.SetData(data); + if (isFirstStart) + { + itemFirst.SetPos(); + playPSItem.Add(itemFirst); + } //itemFirst.CheckRank(tmpRankUp); } else @@ -485,6 +484,11 @@ data.index = 2; itemSecond.gameObject.SetActive(true); itemSecond.SetData(data); + if (isFirstStart) + { + itemSecond.SetPos(); + playPSItem.Add(itemSecond); + } //itemFirst.CheckRank(tmpRankUp); } else @@ -500,6 +504,11 @@ data.index = 3; itemThird.gameObject.SetActive(true); itemThird.SetData(data); + if (isFirstStart) + { + itemThird.SetPos(); + playPSItem.Add(itemThird); + } //itemFirst.CheckRank(tmpRankUp); } else @@ -518,6 +527,18 @@ _data.Add(data); } scroller.ReloadData(); + + if (isFirstStart) + { + Transform container = transform.Find("Scroller/Container"); + FinalPanelItem[] items = container.GetComponentsInChildren<FinalPanelItem>(); + for (int i = 0; i < items.Length; i++) + { + playPSItem.Add(items[i]); + items[i].SetPos(); + } + } + } } -- Gitblit v1.9.1