From 551101abeb1a997da1444ba4ed3059b4d878fb4a Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Tue, 17 Nov 2020 10:38:47 +0800
Subject: [PATCH] 拖拽点击UI后释放异常BUG 停止CommonDebugHelper输出

---
 Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs                |   16 +++++++++++++---
 Assets/Scripts/Common/GameConfig.cs                                |    2 +-
 Assets/Scripts/TowerDefense/Input/EndlessTowerDefenseTouchInput.cs |    5 +++--
 Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs                |   22 +++++++++++-----------
 4 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/Assets/Scripts/Common/GameConfig.cs b/Assets/Scripts/Common/GameConfig.cs
index 1c81dec..62b67ae 100644
--- a/Assets/Scripts/Common/GameConfig.cs
+++ b/Assets/Scripts/Common/GameConfig.cs
@@ -24,7 +24,7 @@
 
         public static string LoginUrl = "http://172.16.1.52:9000/user/login";
 
-        public static bool OpenDebug = true;
+        public static bool OpenDebug = false;
 
         /// <summary>
         /// PVE无尽模式,是否可以点击购买新的宝石
diff --git a/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs b/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
index 7759e88..b66b5a8 100644
--- a/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
+++ b/Assets/Scripts/GameAnalytics_SDK/TDAA_SDKManager.cs
@@ -74,7 +74,7 @@
 
     public void Reset()
     {
-        Debug.LogError("清除了数据");
+        CommonDebugHelper.Debug("清除了数据");
         //PlayerPrefs.DeleteAll();
         isFirstStart = PlayerPrefs.GetInt(firstStart) == 0;
         statisticsStep = PlayerPrefs.GetInt(statisticsStr);
@@ -162,7 +162,7 @@
         {
             OnRegister();
 
-            Debug.LogError("注册人数统计");
+            CommonDebugHelper.Debug("注册人数统计");
             //只记录一次
             Dictionary<string, object> dic = new Dictionary<string, object>
             {
@@ -229,7 +229,7 @@
             // };
             //dic[key] = 1;
 
-            Debug.LogError("漏斗流统计:" + key);
+           CommonDebugHelper.Debug("漏斗流统计:" + key);
 
             OnEvent(key, dic);
             statisticsStep = step;
@@ -247,7 +247,7 @@
     {
         if (step > guideStep)
         {
-            Debug.LogError("引导步数统计:" + step);
+            CommonDebugHelper.Debug("引导步数统计:" + step);
             Dictionary<string, object> dic = new Dictionary<string, object>
             {
                 { "Guide", step.ToString()}
@@ -262,7 +262,7 @@
     //5.每次游玩过程中,点击【重新开始】按钮的次数,每次重新开始记做一轮
     public void OnClickRestartBtn()
     {
-        Debug.LogError("重新开始按钮次数");
+        CommonDebugHelper.Debug("重新开始按钮次数");
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { "OnClickRestartBtn", 1}
@@ -273,7 +273,7 @@
     //7.每一轮游戏中成功使用技能宝石的次数
     public void OnUseSkill(int count)
     {
-        Debug.LogError("每一轮游戏中成功使用技能宝石的次数:" + count);
+        CommonDebugHelper.Debug("每一轮游戏中成功使用技能宝石的次数:" + count);
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { "使用次数", count+"次"}
@@ -284,7 +284,7 @@
     //8.每一轮游戏中成功开启的塔位置数量
     public void OnOpenTower(int towerCount)
     {
-        Debug.LogError("每一轮游戏中成功开启的塔位置数量:" + towerCount);
+        CommonDebugHelper.Debug("每一轮游戏中成功开启的塔位置数量:" + towerCount);
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { "购买次数", towerCount+"次"}
@@ -295,7 +295,7 @@
     //9.每一轮游戏中成功购买塔的数量
     public void OnClickTowerBuyBtn(int buyCount)
     {
-        Debug.LogError("每一轮游戏中成功购买塔的数量:" + buyCount);
+        CommonDebugHelper.Debug("每一轮游戏中成功购买塔的数量:" + buyCount);
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { "购买次数", buyCount+"次"}
@@ -306,7 +306,7 @@
     //10.玩家在结算界面点击【对pvp感兴趣】按钮次数
     public void OnClickPVPBtn()
     {
-        Debug.LogError("对pvp感兴趣");
+        CommonDebugHelper.Debug("对pvp感兴趣");
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { "OnClickPVPBtn", 1}
@@ -341,7 +341,7 @@
             maxWave = wave;
             PlayerPrefs.SetInt(maxWaveStr, maxWave);
 
-            Debug.LogError($"玩家最高打到第{level}关{wave}波");
+            CommonDebugHelper.Debug($"玩家最高打到第{level}关{wave}波");
             Dictionary<string, object> dic = new Dictionary<string, object>
             {
                 { "MaxWave", $"第{level}关{wave}波"}
@@ -357,7 +357,7 @@
     /// <param name="wave">第几波</param>
     public void WaveDone(int level, int wave)
     {
-        Debug.Log($"玩家达到第{level}关{wave}波");
+        CommonDebugHelper.Debug($"玩家达到第{level}关{wave}波");
         Dictionary<string, object> dic = new Dictionary<string, object>
         {
             { $"第{level}关{wave}波", 1}
diff --git a/Assets/Scripts/TowerDefense/Input/EndlessTowerDefenseTouchInput.cs b/Assets/Scripts/TowerDefense/Input/EndlessTowerDefenseTouchInput.cs
index e475034..d44d7e5 100644
--- a/Assets/Scripts/TowerDefense/Input/EndlessTowerDefenseTouchInput.cs
+++ b/Assets/Scripts/TowerDefense/Input/EndlessTowerDefenseTouchInput.cs
@@ -4,6 +4,7 @@
 using UnityEngine;
 using UnityInput = UnityEngine.Input;
 using State = TowerDefense.UI.HUD.EndlessGameUI.State;
+using KTGMGemClient;
 
 namespace TowerDefense.Input
 {
@@ -253,10 +254,10 @@
             // River: 为了开始拖动后可以直接显示GhostTower
             m_GameUI.TryMoveGhost(pointer, false);
 
-            Debug.LogError("OnStartDrag");
+            CommonDebugHelper.Debug("OnStartDrag");
             if (m_GameUI.HasTower)
             {
-                Debug.LogError("m_GameUI.HasTower:" + m_GameUI.HasTower);
+                CommonDebugHelper.Debug("m_GameUI.HasTower:" + m_GameUI.HasTower);
 
                 EndlessUIStart.instance.SetDarkGround(true);
 
diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
index 3d2856b..19430d9 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -891,9 +891,13 @@
                             allTowerP.Add(m_listTower[i].gridPosition);
                         }
                     }
+                    if (m_CurrentArea != null)
+                    {
+                        (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(allTowerP);
+                        (m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP);
+                    }
 
-                (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(allTowerP);
-                    (m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP);
+
                 }
                 else if (m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Fire || m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Bomb)
                 {
@@ -1024,7 +1028,13 @@
                 TryPlaceTower(pointerInfo);
             else if (isFreeAttackGrid(pointerInfo) && !bSkill)
             {
-                if (!TryPlaceTower(pointerInfo, false, true)) return;
+                if (!TryPlaceTower(pointerInfo, false, true))
+                {
+                   CancelPlaceTower(pointerInfo);
+
+                    Debug.Log("这里需要返回原位");
+                    return;
+                }
 
                 // 删除towerToMove,确保塔防数据不再出现多个
                 if (towerToMove != null)

--
Gitblit v1.9.1