From 0cf6de61440ba15668f66da5a2262132cb5c5ae5 Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Mon, 02 Nov 2020 20:50:12 +0800
Subject: [PATCH] 宝石飞动效

---
 Assets/Scripts/TowerDefense/UI/EndlessDropReward.cs |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/EndlessDropReward.cs b/Assets/Scripts/TowerDefense/UI/EndlessDropReward.cs
index 9766aed..00f4c4a 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessDropReward.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessDropReward.cs
@@ -6,6 +6,8 @@
 using TowerDefense.Level;
 using System;
 using Protobuf;
+using DG.Tweening;
+
 
 /**
  * 无尽模式道具掉落管理器
@@ -65,28 +67,70 @@
 
         public event Action<EndlessDrop> ClickDropEvent;
 
+        private bool isBox;//是否是宝箱
+        private GameObject propBtn;
+
         // Start is called before the first frame update
         private void Start()
         {
             ClickDropEvent += EndlessDropManager.instance.OnClickDrop;
+            propBtn = GameObject.Find("BottomUI/PropsObtained/PropButton");
         }
 
+        public GameObject drapIcon;
         public void OnClick()
         {
+            //GameObject obj;
+            FlyImage fly;
+            //GameObject ui = GameObject.Find("BottomUI");
+
+            if (Application.platform == RuntimePlatform.WindowsEditor)
+            {
+                //UnityEditor.EditorApplication.isPaused = true;
+            }
+            if (isBox)
+            {
+                for (int i = 0; i < 5; i++)
+                {
+                    fly = EndlessDropManager.instance.CreateIcon(transform.parent);
+                    fly.SetDestination(Icon.sprite, transform.position, (propBtn.transform as RectTransform).position, true);
+                }
+            }
+            else
+            {
+                fly = EndlessDropManager.instance.CreateIcon(transform.parent);
+                fly.SetDestination(Icon.sprite, transform.position, (propBtn.transform as RectTransform).position, false);
+            }
             if (ClickDropEvent != null)
                 ClickDropEvent(DropData);
+
+
         }
 
         public void SetIcon()
         {
             string resId = "";
+            Vector3 scale = Icon.rectTransform.localScale;
 
             if (DropData.Reward.id == 0)
+            {
                 resId = $"{path}{(int)DropData.Reward.type}";
+                isBox = true;
+            }
             else
+            {
                 resId = $"{path}{(int)DropData.Reward.type}_{DropData.Reward.id}";
+                scale *= 1.5f;
+                isBox = false;
+
+            }
             Icon.sprite = Resources.Load<Sprite>(resId);
             Icon.SetNativeSize();
+
+            //Debug.Log("开始缩放");
+            Icon.rectTransform.localScale = scale * 0.5f;
+            Icon.rectTransform.DOScale(scale, 0.5f);
+
         }
 
         /// <summary>
@@ -96,5 +140,7 @@
         {
             LightParticle.Play();
         }
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1