From df8c6633500f6c1c752f8a60025cda0e9909644c Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Thu, 17 Dec 2020 14:53:22 +0800 Subject: [PATCH] Merge branch 'master' of http://47.95.218.140:8090/r/GemBattle into master --- Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs b/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs index 0df0ca1..f8b98e3 100644 --- a/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs +++ b/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs @@ -31,6 +31,7 @@ public Text DoubleHitText; public Image OneTimeKillObj; + private bool isShowing; public Text OneTimeKillText; @@ -66,6 +67,7 @@ // Start is called before the first frame update private void Start() { + isShowing = false; Init(); EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessAgentDead, AgentDead); EventCenter.Ins.Add((int)KTGMGemClient.EventType.EndlessOneHit, OnHit); @@ -173,6 +175,7 @@ DOTween.To(() => canvasGroup.alpha, (float v) => canvasGroup.alpha = v, 0, 0.3f); } + /// <summary> /// 显示一次性击杀飘字 /// </summary> @@ -180,10 +183,24 @@ /// <param name="score"></param> private void ShowOneTimeKill(int count, int score) { - Image obj = Instantiate(OneTimeKillObj); - obj.transform.SetParent(GameObject.Find("Panel").transform, false); - obj.sprite = Resources.Load<Sprite>($"UI/DoubleHit/hit_{count}"); - Destroy(obj.gameObject, 2.05f); + if (!isShowing) + { + isShowing = true; + Image obj = Instantiate(OneTimeKillObj); + obj.transform.SetParent(GameObject.Find("Panel").transform, false); + obj.sprite = Resources.Load<Sprite>($"UI/DoubleHit/hit_{count}"); + StartCoroutine(KillImage(obj.gameObject)); + } + + //Destroy(obj.gameObject, 2.05f); + } + + IEnumerator KillImage(GameObject obj) + { + yield return new WaitForSeconds(2.05f); + Destroy(obj); + + isShowing = false; } /// <summary> -- Gitblit v1.9.1