| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | 
							- using System;
 
- using System.Collections;
 
- using UnityEngine;
 
- using FairyGUI;
 
- using UI.ActivityGetYuanXiao;
 
- namespace GFGGame
 
- {
 
-     public class YuanXiaoItem
 
-     {
 
-         private int _type;
 
-         private int _score;
 
-         private GComponent _com;
 
-         private GObject _catcher;
 
-         private ActivityGetYuanXiaoView _baseView;
 
-         private GTweener _tweener;
 
-         public YuanXiaoItem CreateItem(GComponent com, GObject catcher, ActivityGetYuanXiaoView baseView)
 
-         {
 
-             _com = com;
 
-             _catcher = catcher;
 
-             _baseView = baseView;
 
-             return this;
 
-         }
 
-         public void Init(int type)
 
-         {
 
-             SetVisible(true);
 
-             _type = type;
 
-             UI_YuanXiaoItem item = UI_YuanXiaoItem.Proxy(_com);
 
-             item.m_c1.selectedIndex = _type - 1;
 
-             UI_YuanXiaoItem.ProxyEnd();
 
-         }
 
-         public void Move(Vector3 start, Vector3 end, float time, Action action = null)
 
-         {
 
-             Vector3 startPos = start;
 
-             Vector3 endPos = end;
 
-             _com.position = startPos;
 
-             Timers.inst.Remove(HandleCollider);
 
-             Timers.inst.AddUpdate(HandleCollider);
 
-             _tweener = _com.TweenMoveY(endPos.y, time);
 
-             _tweener.SetEase(EaseType.QuadIn).OnComplete(()=>
 
-             {
 
-                 Timers.inst.Remove(HandleCollider);
 
-                 action?.Invoke();
 
-             });
 
-         }
 
-         private void HandleCollider(object param = null)
 
-         {
 
-             if(CheckCollider(_com, _catcher))
 
-             {
 
-                 Timers.inst.Remove(HandleCollider);
 
-                 _baseView.GetYuanXiao(this);
 
-             }
 
-         }
 
-         private bool CheckCollider(GObject obj1, GObject obj2)
 
-         {
 
-             Vector3 pos1 = obj1.LocalToGlobal(Vector2.zero);
 
-             Vector3 pos2 = obj2.LocalToGlobal(Vector2.zero);
 
-             bool collisionX = pos1.x + obj1.width >= pos2.x
 
-                 && pos2.x + obj2.width >= pos1.x;
 
-             bool collisionY = pos1.y + obj1.height >= pos2.y
 
-                 && pos2.y + obj2.height >= pos1.y;
 
-             return collisionX && collisionY;
 
-         }
 
-         public bool GetVisible()
 
-         {
 
-             return _com.visible;
 
-         }
 
-         public void SetVisible(bool visible)
 
-         {
 
-             _com.visible = visible;
 
-             if (!visible)
 
-             {
 
-                 _tweener.Kill(false);
 
-             }
 
-         }
 
-         public int GetYuanXiaoType()
 
-         {
 
-             return _type;
 
-         }
 
-         public void SetScore(int score)
 
-         {
 
-             _score = score;
 
-         }
 
-         public int GetScore()
 
-         {
 
-             return _score;
 
-         }
 
-         public void Destroy()
 
-         {
 
-             _tweener.Kill(false);
 
-             Timers.inst.Remove(HandleCollider);
 
-             _com.Dispose();
 
-         }
 
-         public void SetPause(bool pause = true)
 
-         {
 
-             if (_com.visible)
 
-             {
 
-                 _tweener.SetPaused(pause);
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |