From 9a884eb38e54ef453c46e7318e44c1d315616e58 Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Thu, 29 Oct 2020 15:23:19 +0800
Subject: [PATCH] 统计波次信息

---
 Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs    |    1 +
 Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs |   47 ++++++++++++++++++++++++++++++++++++++++-------
 ProjectSettings/EditorBuildSettings.asset           |    6 +++---
 3 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs b/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
index 8b2610b..774a92f 100644
--- a/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
+++ b/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using KTGMGemClient;
 using UnityEngine;
 
 public class TDAA_SDKManager : MonoBehaviour
@@ -41,6 +42,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 +251,7 @@
             {
                 { "Guide", step.ToString()}
             };
-            OnEvent("引导步数统计",  dic);
+            OnEvent("引导步数统计", dic);
 
             guideStep = step;
             PlayerPrefs.SetInt(guideStepStr, step);
@@ -238,7 +266,7 @@
         {
             { "OnClickRestartBtn", 1}
         };
-        OnEvent("重新开始按钮次数",  dic);
+        OnEvent("重新开始按钮次数", dic);
     }
 
     //7.每一轮游戏中成功使用技能宝石的次数
@@ -249,7 +277,7 @@
         {
             { "使用次数", count+"次"}
         };
-        OnEvent("每一轮游戏中成功使用技能宝石的次数",  dic);
+        OnEvent("每一轮游戏中成功使用技能宝石的次数", dic);
     }
 
     //8.每一轮游戏中成功开启的塔位置数量
@@ -260,7 +288,7 @@
         {
             { "购买次数", towerCount+"次"}
         };
-        OnEvent("每一轮游戏中成功开启的塔位置数量",  dic);
+        OnEvent("每一轮游戏中成功开启的塔位置数量", dic);
     }
 
     //9.每一轮游戏中成功购买塔的数量
@@ -271,7 +299,7 @@
         {
             { "购买次数", buyCount+"次"}
         };
-        OnEvent("每一轮游戏中成功购买塔的数量",  dic);
+        OnEvent("每一轮游戏中成功购买塔的数量", dic);
     }
 
     //10.玩家在结算界面点击【对pvp感兴趣】按钮次数
@@ -282,7 +310,7 @@
         {
             { "OnClickPVPBtn", 1}
         };
-        OnEvent("对pvp感兴趣",  dic);
+        OnEvent("对pvp感兴趣", dic);
     }
 
 
@@ -307,12 +335,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);
         }
     }
 
diff --git a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
index 59b28ed..67ac753 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
@@ -78,6 +78,7 @@
 
         if (GameConfig.IsNewbie)
         {
+            Debug.Log("开始新手引导");
             Pause();
             uiStartMssk.gameObject.SetActive(false);
             countDownTextNew.text = "";
diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset
index c0d9aec..b156d66 100644
--- a/ProjectSettings/EditorBuildSettings.asset
+++ b/ProjectSettings/EditorBuildSettings.asset
@@ -9,11 +9,11 @@
     path: Assets/Scenes/TestTalkingData.unity
     guid: 415e09a546f94cf4b883227ff1be6086
   - enabled: 1
-    path: Assets/Scenes/MainManuScene.unity
-    guid: 520ddc4fdac3ea246b57984ad40aea6c
-  - enabled: 1
     path: Assets/Scenes/LoadingScene.unity
     guid: 587e6361681b8c54f92c0bc9bbfa2cb7
+  - enabled: 1
+    path: Assets/Scenes/MainManuScene.unity
+    guid: 520ddc4fdac3ea246b57984ad40aea6c
   - enabled: 0
     path: Assets/Scenes/Levels/Battle/GemBattle.unity
     guid: 31be1c7e41e144742a462aa0c605346c

--
Gitblit v1.9.1