public void EndDrag() { if (_inArea) { var model = _draggingRoot.CurDraggingCard.Model; var card = _poolMgr.Spwan(SizeType.MiniCard.ToString(), _content); card.GetComponent <ICard>().Init(model); card.GetComponent <IAreaAction>().Init(_poolMgr, _draggingRoot); DragCardBase dragCard = card.GetComponent <DragCardBase>(); dragCard.Init(_poolMgr, _draggingRoot); dragCard.AddEndListener(EndDrag); _poolMgr.Despwan(SizeType.MiniCard.ToString(), _draggingRoot.CurDraggingCardTrans); _draggingRoot.Clear(); } _inArea = false; }
private void UpdateCard() { for (int i = 0; i < _countMax; i++) { if (i < _models.Count) { Transform cardTrans = _poolMg.Spwan(((CardType)_models[i].Type).ToString(), transform); ICard card = cardTrans.GetComponent <ICard>(); card.Init(_models[i]); DragCardBase dragCard = cardTrans.GetComponent <DragCardBase>(); dragCard.Init(_poolMg, _draggingRoot); dragCard.AddEndListener(() => _onEnd()); cardTrans.GetComponent <IAreaAction>().Init(_poolMg, _draggingRoot); } } }