From 452c75675679c44cc39b04bdb7d330d7c5c14d5c Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Tue, 29 Dec 2020 10:48:06 +0800
Subject: [PATCH] 增加多SDK支持。常规使用SDKChannel.KTGM 偶哈游的是空SDK

---
 Assets/Scripts/UI/FlyImage.cs |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/Assets/Scripts/UI/FlyImage.cs b/Assets/Scripts/UI/FlyImage.cs
index d138533..9bf81ea 100644
--- a/Assets/Scripts/UI/FlyImage.cs
+++ b/Assets/Scripts/UI/FlyImage.cs
@@ -1,5 +1,8 @@
-using System.Collections.Generic;
+using System.Security.AccessControl;
+using System.Collections.Generic;
 using DG.Tweening;
+using KTGMGemClient;
+using TowerDefense.Level;
 using UnityEngine;
 using UnityEngine.UI;
 
@@ -25,6 +28,13 @@
         ts = transform.GetComponent<RectTransform>();
     }
     private Image tmpImage;
+    private bool isBroadCast;
+    private int tmpCurrency;
+    public void Init(bool isBC, int currency)
+    {
+        isBroadCast = isBC;
+        tmpCurrency = currency;
+    }
     /// <summary>
     /// 设置终点
     /// </summary>
@@ -32,7 +42,8 @@
     /// <param name="useBezier">是否使用贝塞尔</param>
     public void SetDestination(Sprite sp, Vector3 startP, Vector3 endP, bool useBezier)
     {
-        tmpImage.sprite = sp;
+        if (sp != null)
+            tmpImage.sprite = sp;
         transform.position = startP;
         ts.localPosition += RandomPos();
         if (useBezier)
@@ -56,28 +67,29 @@
         }
     }
 
-    bool isUp;
+    bool isLeft;
     private Vector3 RandomPos()
     {
         Vector3 tmpV = Vector3.zero;
-        tmpV.x -= UnityEngine.Random.Range(10, 20);
+        tmpV.y += UnityEngine.Random.Range(30, 50);
         int a = UnityEngine.Random.Range(-20, 20);
-        isUp = a > 0;
-        tmpV.z += a;
+        isLeft = a > 0;
+        tmpV.x += a;
         return tmpV;
     }
 
     private Vector3 GetOffect()
     {
         Vector3 tmpV = Vector3.zero;
-        tmpV.x -= UnityEngine.Random.Range(10, 15);
-        if (isUp)
+        if (isLeft)
         {
-            tmpV.z += UnityEngine.Random.Range(20, 40);
+            tmpV.x -= UnityEngine.Random.Range(80, 150);
+            tmpV.y += UnityEngine.Random.Range(500, 600);
         }
         else
         {
-            tmpV.z -= UnityEngine.Random.Range(20, 40);
+            tmpV.x += UnityEngine.Random.Range(500, 600);
+            tmpV.y += UnityEngine.Random.Range(80, 150);
         }
 
         return tmpV;
@@ -88,7 +100,7 @@
     /// </summary>
     private void Bezier_Move()
     {
-        if (index + 2 >= point.Count)
+        if (index + 3 >= point.Count)
         {
             //到终点了
             Close();
@@ -98,15 +110,23 @@
         {
             transform.DOMove(point[index], 0.01f).OnComplete(Bezier_Move);
 
-            index += 2;
+            index += 3;
         }
     }
 
     private void Close()
     {
-        //Debug.Log("到终点了,可以消失了");
+        //Debug.Log("到终点了,可以消失了" + EndlessLevelManager.instance.DropCoin);
 
         gameObject.SetActive(false);
+
+        if (isBroadCast)
+        {
+            EndlessLevelManager.instance.Currency.AddCurrency(tmpCurrency);
+            EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayGetGoldPS);
+        }
+
+        //Core.Utilities.Poolable.TryPool(gameObject);
     }
 
     /// <summary>

--
Gitblit v1.9.1