From f2f4e1e45981bb294a5221ade7b4646cc3e29d35 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Wed, 11 Nov 2020 18:56:44 +0800
Subject: [PATCH] 无尽模式分数

---
 Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs |   51 ++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs b/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
index 8b2610b..7759e88 100644
--- a/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
+++ b/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
@@ -1,9 +1,11 @@
 using System.Collections;
 using System.Collections.Generic;
+using KTGMGemClient;
 using UnityEngine;
 
 public class TDAA_SDKManager : MonoBehaviour
 {
+    //需要在PlayerSetting中添加宏 TDAA_CUSTOM
     private static TDAA_SDKManager _Ins;
     public static TDAA_SDKManager Ins
     {
@@ -41,6 +43,33 @@
 
         maxLevel = PlayerPrefs.GetInt(maxLevelStr);
         maxWave = PlayerPrefs.GetInt(maxWaveStr);
+        AddListener();
+    }
+
+    private void AddListener()
+    {
+        EventCenter.Ins.Add<int, int>((int)KTGMGemClient.EventType.EndlessCompletedPort, EndlessCompletedPort);
+        EventCenter.Ins.Add((int)KTGMGemClient.EventType.EndlessLevelCompleted, EndlessLevelCompleted);
+    }
+    /// <summary>
+    /// 无尽模式成功通过第*关,第*波
+    /// </summary>
+    /// <param name="Level"></param>
+    /// <param name="CurrentWaveIndex"></param>
+    private void EndlessCompletedPort(int level, int currentWaveIndex)
+    {
+        MaxWave(level, currentWaveIndex);
+        WaveDone(level, currentWaveIndex);
+    }
+
+    /// <summary>
+    /// 无尽模式完成
+    /// </summary>
+    private void EndlessLevelCompleted()
+    {
+        OnUseSkill(GameConfig.EndlessPortUseSkillTowerCount);
+        OnOpenTower(GameConfig.EndlessOpenAttackTowerCount);
+        OnClickTowerBuyBtn(GameConfig.EndlessBuyTowerCount);
     }
 
     public void Reset()
@@ -223,7 +252,7 @@
             {
                 { "Guide", step.ToString()}
             };
-            OnEvent("引导步数统计",  dic);
+            OnEvent("引导步数统计", dic);
 
             guideStep = step;
             PlayerPrefs.SetInt(guideStepStr, step);
@@ -238,7 +267,7 @@
         {
             { "OnClickRestartBtn", 1}
         };
-        OnEvent("重新开始按钮次数",  dic);
+        OnEvent("重新开始按钮次数", dic);
     }
 
     //7.每一轮游戏中成功使用技能宝石的次数
@@ -249,7 +278,7 @@
         {
             { "使用次数", count+"次"}
         };
-        OnEvent("每一轮游戏中成功使用技能宝石的次数",  dic);
+        OnEvent("每一轮游戏中成功使用技能宝石的次数", dic);
     }
 
     //8.每一轮游戏中成功开启的塔位置数量
@@ -260,7 +289,7 @@
         {
             { "购买次数", towerCount+"次"}
         };
-        OnEvent("每一轮游戏中成功开启的塔位置数量",  dic);
+        OnEvent("每一轮游戏中成功开启的塔位置数量", dic);
     }
 
     //9.每一轮游戏中成功购买塔的数量
@@ -271,7 +300,7 @@
         {
             { "购买次数", buyCount+"次"}
         };
-        OnEvent("每一轮游戏中成功购买塔的数量",  dic);
+        OnEvent("每一轮游戏中成功购买塔的数量", dic);
     }
 
     //10.玩家在结算界面点击【对pvp感兴趣】按钮次数
@@ -282,7 +311,7 @@
         {
             { "OnClickPVPBtn", 1}
         };
-        OnEvent("对pvp感兴趣",  dic);
+        OnEvent("对pvp感兴趣", dic);
     }
 
 
@@ -307,12 +336,17 @@
         }
         if (canSend)
         {
+            maxLevel = level;
+            PlayerPrefs.SetInt(maxLevelStr, maxLevel);
+            maxWave = wave;
+            PlayerPrefs.SetInt(maxWaveStr, maxWave);
+
             Debug.LogError($"玩家最高打到第{level}关{wave}波");
             Dictionary<string, object> dic = new Dictionary<string, object>
             {
                 { "MaxWave", $"第{level}关{wave}波"}
             };
-            OnEvent("玩家最高打到第x关y波",dic);
+            OnEvent("玩家最高打到第x关y波", dic);
         }
     }
 
@@ -323,7 +357,7 @@
     /// <param name="wave">第几波</param>
     public void WaveDone(int level, int wave)
     {
-        Debug.LogError($"玩家达到第{level}关{wave}波");
+        Debug.Log($"玩家达到第{level}关{wave}波");
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { $"第{level}关{wave}波", 1}
@@ -353,7 +387,6 @@
 
     private void OnDestroy()
     {
-        Debug.Log("onDestroy");
         TalkingDataPlugin.SessionStoped();
     }
 }

--
Gitblit v1.9.1