using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using UnityEngine.EventSystems; using System.Collections; using System.Collections.Generic; public class FlowerCard : MonoBehaviour { #region 变量 public int SelectIndex; public int ScrollSelectIndex; public bool SelectLock; public float LeftBorder; public float RightBorder; public Transform SeleItem; public Transform ScrollSeleItem; public List ItemList; public List InfoList; public ScrollRectPlus ScrollRect; #endregion public void RegistValue() { InfoList = new List(); ItemList = new List(); SelectIndex = -1; ScrollRect = ManaReso.Get("H_Scrr"); ScrollRect.DragEvent += OnDrag; ScrollRect.EndDragEvent += OnEndDrag; MoveVec moveVec = ScrollRect.content.CreateMoveVec(); moveVec.OnStart += () => { SelectLock = true; }; moveVec.OnFinish += () => { SelectLock = false; }; } public void Add(FlowerInfo flowerInfo) { Transform tra = ManaReso.GetFlowerItemH(); tra.CreateTweenScale(new Vector3(1, 1, 1), new Vector3(1.25f, 1.25f, 1), 0.25f, true, true, Curve.EaseOutQuad); Image image = tra.transform.GetChild(0).GetComponent(); image.sprite = flowerInfo.Sprite; Vector2 newSize = flowerInfo.Sprite.rect.size; newSize.x *= 0.2f; newSize.y *= 0.2f; image.rectTransform.sizeDelta = newSize; Button button = tra.GetComponent