public void Remove(CardWidget cardWidget) { if (mCardActives.Remove(cardWidget)) { cardWidget.Reset(); cardWidget.gameObject.SetActive(false); mCardCache.Add(cardWidget); } }
void OnCardDragEnd(CardWidget cardWidget, PointerEventData pointerEventData) { SlotClearHighlights(); //check if pointer is in slot if (pointerEventData != null) { SlotInfo slot = null; var hit = pointerEventData.pointerCurrentRaycast; if (hit.isValid && hit.gameObject) { slot = GetSlot(hit.gameObject); } if (slot != null && !slot.isFilled) { //can we fill it? if (CanFill(cardWidget.cardData)) { if (!string.IsNullOrEmpty(sfxCorrect)) { M8.SoundPlaylist.instance.Play(sfxCorrect, false); } //fill slot and remove from deck slot.Fill(cardWidget.cardData); deckWidget.Remove(cardWidget); mCurScore += GameData.instance.GetScore(mErrorCount, mSlotCount > 1); mErrorCount = 0; } else //error { if (!string.IsNullOrEmpty(sfxWrong)) { M8.SoundPlaylist.instance.Play(sfxWrong, false); } slot.Error(); cardWidget.Return(); mErrorCount++; } } else { cardWidget.Return(); } } }
void OnCardDrag(CardWidget cardWidget, PointerEventData pointerEventData) { SlotClearHighlights(); var hit = pointerEventData.pointerCurrentRaycast; //highlight slot if pointer is inside if (hit.isValid && hit.gameObject) { var slot = GetSlot(hit.gameObject); if (slot != null) { slot.isHighlight = true; } } }
void OnCardDragEnd(CardWidget cardWidget, PointerEventData pointerEventData) { dragEndCallback?.Invoke(cardWidget, pointerEventData); }