From aadfae81e6a511cd2c062ab0b05f3ee3419f1a7f Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Wed, 23 Dec 2020 20:15:14 +0800
Subject: [PATCH] 选中BUFF塔播放相应的特效

---
 Assets/Scripts/Guide/GuidePanelNew.cs |  145 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 108 insertions(+), 37 deletions(-)

diff --git a/Assets/Scripts/Guide/GuidePanelNew.cs b/Assets/Scripts/Guide/GuidePanelNew.cs
index 67a1dfe..7779bd8 100644
--- a/Assets/Scripts/Guide/GuidePanelNew.cs
+++ b/Assets/Scripts/Guide/GuidePanelNew.cs
@@ -25,7 +25,7 @@
     Vector2 rimOffset = new Vector2(30, 30);//边框要比按钮大一些
 
     Vector2 towerBuyBtnPos;//动态生成按钮抠图位置
-    Vector2 skillBtnPos = new Vector2(459, 44.6f);
+    Vector2 skillBtnPos = new Vector2(459, 121f);
 
     private Image warningImg;//大波敌人来袭提示
 
@@ -39,8 +39,13 @@
     ImageTowerPos towerPos3;//塔位标识
 
     Image tmpMask;//自身的阻挡射线Panel
+    //ParticleSystem finishPS;
+    Button finishBtn;
+    Image finishImg;
+    Canvas skillCanvasGroup;
     void Awake()
     {
+
         tmpMask = transform.GetComponent<Image>();
         tipsUI = transform.Find("Tips").gameObject;
         tipsUI.transform.SetAsLastSibling();//把tips放在最下面
@@ -90,12 +95,12 @@
         wood1 = transform.Find("Image_Wood1").GetComponent<ImageWood>();
         wood1.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
         wood1PS1 = wood1.transform.Find("Mu/Particle System").GetComponent<ParticleSystem>();
-        wood1PS2 = wood1.transform.Find("Mu_02/Particle System").GetComponent<ParticleSystem>();
+        //wood1PS2 = wood1.transform.Find("Mu_02/Particle System").GetComponent<ParticleSystem>();
 
         wood2 = transform.Find("Image_Wood2").GetComponent<ImageWood2>();
         wood2.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
         wood2PS1 = wood2.transform.Find("Mu/Particle System").GetComponent<ParticleSystem>();
-        wood2PS2 = wood2.transform.Find("Mu_02/Particle System").GetComponent<ParticleSystem>();
+        //wood2PS2 = wood2.transform.Find("Mu_02/Particle System").GetComponent<ParticleSystem>();
 
         wood1.gameObject.SetActive(false);
         wood2.gameObject.SetActive(false);
@@ -103,13 +108,13 @@
         fire = transform.Find("Image_Fire").GetComponent<ImageFire1>();
         fire.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
         firePS1 = fire.transform.Find("Huo/Particle System").GetComponent<ParticleSystem>();
-        firePS2 = fire.transform.Find("Huo_02/Particle System").GetComponent<ParticleSystem>();
+        //firePS2 = fire.transform.Find("Huo_02/Particle System").GetComponent<ParticleSystem>();
         fire.gameObject.SetActive(false);
 
         water = transform.Find("Image_Water").GetComponent<ImageWater>();
         water.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
         waterPS1 = water.transform.Find("Shui/Particle System").GetComponent<ParticleSystem>();
-        waterPS2 = water.transform.Find("Shui_02/Particle System").GetComponent<ParticleSystem>();
+        //waterPS2 = water.transform.Find("Shui_02/Particle System").GetComponent<ParticleSystem>();
         water.gameObject.SetActive(false);
 
         towerPos = transform.Find("Image_TowerPos").GetComponent<ImageTowerPos>();
@@ -137,6 +142,14 @@
 
         skillBtn = GameObject.Find("UICamera/BottomCanvas/Panel/Energy/FireSkillBg/SkillBtn").GetComponent<Button>();
         skillBtn.interactable = false;
+
+        finishBtn = transform.Find("FinishImageBtn").GetComponent<Button>();
+        finishImg = finishBtn.transform.Find("FinishImage").GetComponent<Image>();
+        finishImg.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
+        finishBtn.onClick.AddListener(OnClickFinish);
+        finishBtn.gameObject.SetActive(false);
+        //finishPS = transform.Find("Effect_UI_YinDaoJieShu/Particle System (3)").GetComponent<ParticleSystem>();
+        towerBuyBtn.gameObject.SetActive(false);
     }
 
 
@@ -183,6 +196,8 @@
     {
         //关闭对话框
         SetGuideUI(false);
+        towerBuyBtn.gameObject.SetActive(true);
+
         //开箱
         boxPanel.ChangeType(GuideBoxType.Wood, Step1Finish);
     }
@@ -197,15 +212,15 @@
 
 
     ImageWood wood1;
-    ParticleSystem wood1PS1, wood1PS2;//出现的特效
+    ParticleSystem wood1PS1;//出现的特效
     ImageWood2 wood2;//两个用来合成的mu元素
-    ParticleSystem wood2PS1, wood2PS2;
+    ParticleSystem wood2PS1;
 
     ImageFire1 fire;//火元素
-    ParticleSystem firePS1, firePS2;
+    ParticleSystem firePS1;
 
     ImageWater water;//水元素
-    ParticleSystem waterPS1, waterPS2;
+    ParticleSystem waterPS1;
 
     /// <summary>
     /// 步骤2:购买---购买---合成---上阵  事件广播结束,不走回调
@@ -214,6 +229,7 @@
     {
         strArray = str;
         tmpMask.enabled = false;
+
         AddButtonListener(towerBuyBtn, Step2_1);
         Image btnImg = towerBuyBtn.GetComponent<Image>();
         InitRectGuidance(btnImg, 159, 73.5f, Vector2.one);
@@ -227,9 +243,6 @@
     private void Step2_1()
     {
         Wood1Appear();
-        RemoveButtonListener(towerBuyBtn);
-        AddButtonListener(towerBuyBtn, Step2_2);
-        StartCoroutine(ShowRimTip(strArray[1]));
     }
 
     private void Wood1Appear()
@@ -240,7 +253,10 @@
             wood1.transform.Find("Image_2").gameObject.SetActive(false);
             wood1.enabled = false;
             wood1PS1.Play();
-            wood1PS2.Play();
+            //wood1PS2.Play();
+            RemoveButtonListener(towerBuyBtn);
+            AddButtonListener(towerBuyBtn, Step2_2);
+            StartCoroutine(ShowRimTip(strArray[1]));
         }
     }
 
@@ -251,26 +267,32 @@
     {
         Wood2Appear();
 
-        offectBackground.SetActive(true);
-        wood1.enabled = true;
-        wood2.enabled = true;
-        ShowDragPath(wood2.GetStartP, wood1.GetRect);
-        RimWood2();
-        image_Tip_Rect.gameObject.SetActive(false);
+
 
         //StartCoroutine(ShowRimTip(strArray[2]));
     }
 
     private void Wood2Appear()
     {
-        wood2.gameObject.SetActive(true);
-        wood2PS1.Play();
-        wood2PS2.Play();
-        //fire2.enabled = false;
-        DestoryButtonListener(towerBuyBtn);
-        SetRimActive(false);
-        CloseGuidance();
-        tmpMask.enabled = true;
+        if (!wood2.gameObject.activeSelf)
+        {
+            wood2.gameObject.SetActive(true);
+            wood2PS1.Play();
+            // wood2PS2.Play();
+            //fire2.enabled = false;
+            DestoryButtonListener(towerBuyBtn);
+            towerBuyBtn.gameObject.SetActive(false);
+
+            SetRimActive(false);
+            CloseGuidance();
+            tmpMask.enabled = true;
+            offectBackground.SetActive(true);
+            wood1.enabled = true;
+            wood2.enabled = true;
+            ShowDragPath(wood2.GetStartP, wood1.GetRect);
+            RimWood2();
+            image_Tip_Rect.gameObject.SetActive(false);
+        }
     }
 
 
@@ -325,7 +347,18 @@
         StopShowDragPath(true);
     }
 
-
+    /// <summary>
+    /// 关闭技能X1的显示优先级
+    /// </summary>
+    public void CloseSkillImage()
+    {
+        GameObject go1 = GameObject.Find("UICamera/BottomCanvas/Panel/Energy/FireSkillBg/SkillCount1");
+        if (go1 != null)
+        {
+            skillCanvasGroup = go1.GetComponent<Canvas>();
+            skillCanvasGroup.overrideSorting = false;
+        }
+    }
 
     /// <summary>
     ///  步骤3 :对话---出兵后杀光---对话---展示火鸡
@@ -348,6 +381,8 @@
     {
         //关闭对话框
         SetGuideUI(false);
+        towerBuyBtn.gameObject.SetActive(true);
+
         //开箱
         boxPanel.ChangeType(GuideBoxType.Fire, cb);
     }
@@ -367,7 +402,6 @@
         InitRectGuidance(btnImg, 159, 73.5f, Vector2.one);
         SetRimPos(towerBuyBtn);
         StartCoroutine(ShowRimTip(strArray[0]));
-
     }
 
     /// <summary>
@@ -376,8 +410,6 @@
     private void Step4_1()
     {
         FireAppear();
-        RemoveButtonListener(towerBuyBtn);
-        Step4_2();
     }
 
     private void FireAppear()
@@ -389,6 +421,10 @@
             fire.enabled = true;
             firePS1.Play();
             firePS1.Play();
+            RemoveButtonListener(towerBuyBtn);
+            towerBuyBtn.gameObject.SetActive(false);
+
+            Step4_2();
         }
     }
 
@@ -473,6 +509,8 @@
         }
         else if (currentIndex == 2)
         {
+            tmpMask.enabled = true;
+
             SetRimActive(false);
             StopShowDragPath(true);
             CloseGuidance();
@@ -494,6 +532,8 @@
     {
         //关闭对话框
         SetGuideUI(false);
+        towerBuyBtn.gameObject.SetActive(true);
+
         //开箱
         boxPanel.ChangeType(GuideBoxType.Water, cb);
     }
@@ -521,8 +561,6 @@
     private void Step6_1()
     {
         WaterAppear();
-        RemoveButtonListener(towerBuyBtn);
-        Step6_2();
     }
 
     private void WaterAppear()
@@ -533,7 +571,11 @@
             //fire.transform.Find("Image_2").gameObject.SetActive(false);
             water.enabled = true;
             waterPS1.Play();
-            waterPS2.Play();
+            //waterPS2.Play();
+            RemoveButtonListener(towerBuyBtn);
+            towerBuyBtn.gameObject.SetActive(false);
+
+            Step6_2();
         }
     }
     /// <summary>
@@ -576,7 +618,6 @@
         {
             colorCount++;
             warningImg.DOFade(colorCount % 2, 1.0f).OnComplete(SetWarningColor);
-            CommonDebugHelper.Debug($"执行了{colorCount}次");
         }
         else
         {
@@ -589,6 +630,8 @@
     public void Step7Talk(string[] str, Action ac)
     {
         callBack = ac;
+        GameObject.Find("UICamera/MainUI/BloodUI").SetActive(false);
+
         SetGuideUI(true);
         StartShowWord(str, GuideEnergyUp);
     }
@@ -614,18 +657,46 @@
         StartCoroutine(ShowRimTip("释放技能"));
     }
 
+    string[] laterStr;
     public void SkillRelease(string[] str, Action ac)
     {
+
+        GameObject.Find("UICamera/MainUI/BloodUI").SetActive(true);
+
         RemoveButtonListener(skillBtn.gameObject);
         SetRimActive(false);
         CloseGuidance();
+        callBack = ac;
 
-        SetGuideUI(true);
-        StartShowWord(str, ac);
+        laterStr = str;
+        Invoke("LaterShow", 2f);
     }
+
+    private void LaterShow()
+    {
+        SetGuideUI(true);
+        StartShowWord(laterStr, ShowFinishPanel);
+
+    }
+
+    private void ShowFinishPanel()
+    {
+        SetGuideUI(false);
+        //显示引导结束面板,再次点击按钮关闭
+        finishBtn.gameObject.SetActive(true);
+        finishImg.transform.DOScale(Vector3.one, 0.5f);
+    }
+
+    private void OnClickFinish()
+    {
+        callBack?.Invoke();
+    }
+
 
     public void FinishGuide()
     {
+        if (skillCanvasGroup != null)
+            skillCanvasGroup.overrideSorting = true;
         towerBuyBtn.gameObject.SetActive(true);
     }
 

--
Gitblit v1.9.1