From 452c75675679c44cc39b04bdb7d330d7c5c14d5c Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Tue, 29 Dec 2020 10:48:06 +0800
Subject: [PATCH] 增加多SDK支持。常规使用SDKChannel.KTGM 偶哈游的是空SDK

---
 Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs |   54 ++++++++++++++----------------------------------------
 1 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs b/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs
index 0de726f..b494e57 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs
@@ -30,7 +30,7 @@
 
         public Text DoubleHitText;
 
-        public Image OneTimeKillObj;
+        public DoubleHitImg OneTimeKillObj;
 
         public Text OneTimeKillText;
 
@@ -67,40 +67,29 @@
         private void Start()
         {
             Init();
-            EventCenter.Ins.Add<Agent>((int)KTGMGemClient.EventType.EndlessAgentDead, AgentDead);
+            EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessAgentDead, AgentDead);
             EventCenter.Ins.Add((int)KTGMGemClient.EventType.EndlessOneHit, OnHit);
             EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessOneTimeKillCount, OnTimeKill);
             canvasGroup = DoubleHit.GetComponent<CanvasGroup>();
         }
 
         /// <summary>
-        /// 一次性击杀
+        /// /// 一次性击杀
         /// </summary>
         /// <param name="count"></param>
         private void OnTimeKill(int count)
         {
-            Debug.Log($"--------------------- 一次性击杀个数:{count} ---------------------");
             if (count >= 10)
             {
-                AddScore(500);
-                ShowOneTimeKill(10, 500);
-            }
-            else if (count >= 8)
-            {
-                AddScore(200);
-                ShowOneTimeKill(8, 200);
-            }
-            else if (count >= 5)
-            {
-                AddScore(100);
-                ShowOneTimeKill(5, 100);
+                AddScore(0);
+                ShowOneTimeKill();
             }
         }
 
-        private void AgentDead(Agent agent)
+        private void AgentDead(int point)
         {
             if (EndlessGameUI.instance.state == EndlessGameUI.State.GameOver) return;
-            AddScore(agent.EnemyData.point);
+            AddScore(point);
         }
 
         // Update is called once per frame
@@ -117,6 +106,7 @@
                 else
                     remainTime -= Time.deltaTime;
             }
+
         }
 
         /// <summary>
@@ -134,17 +124,17 @@
             // 策划说先写死吧
             if (DoubleHitCount == 50)
             {
-                AddScore(200);
+                AddScore(0);
                 FloatDoubleHitReward(200);
             }
             else if (DoubleHitCount == 100)
             {
-                AddScore(500);
+                AddScore(0);
                 FloatDoubleHitReward(500);
             }
             else if (DoubleHitCount == 200)
             {
-                AddScore(1500);
+                AddScore(0);
                 FloatDoubleHitReward(1500);
             }
         }
@@ -174,32 +164,16 @@
             DOTween.To(() => canvasGroup.alpha, (float v) => canvasGroup.alpha = v, 0, 0.3f);
         }
 
+
         /// <summary>
         /// 显示一次性击杀飘字
         /// </summary>
         /// <param name="count"></param>
-        /// <param name="score"></param>
-        private void ShowOneTimeKill(int count, int score)
+        private void ShowOneTimeKill()
         {
-            // OneTimeKillText.text = $"{count}连杀 +{score}";
-            // OneTimeKillObj.transform.localScale = Vector3.zero;
-            // OneTimeKillObj.SetActive(true);
-            // CanvasGroup cg = OneTimeKillObj.GetComponent<CanvasGroup>();
-            // DOTween.To(() => OneTimeKillObj.transform.localScale, (Vector3 v) => OneTimeKillObj.transform.localScale = v, Vector3.one, 0.2f);
-            // Tween t1 = DOTween.To(() => cg.alpha, (float v) => cg.alpha = v, 0f, 0.2f).SetDelay(2f);
-            // t1.OnComplete(OnShowOneTimeKillComplete);
-            Image obj = Instantiate(OneTimeKillObj);
-            obj.transform.SetParent(GameObject.Find("Panel").transform, false);
-            obj.sprite = Resources.Load<Sprite>($"UI/DoubleHit/hit_{count}");
-            Animator animator = obj.GetComponent<Animator>();
-            AnimatorClipInfo[] animatorClipInfos = animator.GetCurrentAnimatorClipInfo(0);
-            Destroy(obj.gameObject, animatorClipInfos[0].clip.length);
+            OneTimeKillObj.SetkillCount();
         }
 
-        private void OnShowOneTimeKillComplete()
-        {
-            // OneTimeKillObj.SetActive(false);
-        }
 
         /// <summary>
         /// 飘连击奖励分数

--
Gitblit v1.9.1