private void GenerateCardUI(CardContent cc) { var go = GameObject.Instantiate(cardGo, deckPos.transform.position, deckPos.transform.rotation, deckPos.transform); go.SetCard(cc, false, false); cc.bUI = go; }
public void DeselectCard(CardContent cc) { if (outList.Contains(cc)) { outList.Remove(cc); } }
private List <CardContent> GetCurrentList(CardContent cc) { switch (cc.bUI.position) { case CardPosition.Hand: return(handPile); case CardPosition.Deck: return(deckPile); case CardPosition.Discard: return(discardPile); case CardPosition.Used: return(usedPile); case CardPosition.Exhaust: return(exhaustPile); case CardPosition.Temp: return(tempPile); default: return(deckPile); } }
/// <summary> /// 设置卡牌信息 /// </summary> /// <param name="cc">卡牌</param> /// <param name="canSelect">是否能显示选择框</param> /// <param name="canScale">是否鼠标移入有放大</param> public void SetCard(CardContent cc, bool canSelect = false, bool canScale = true) { this.cc = cc; this.name = cc.name; this.canSelect = canSelect; this.canZoom = canScale; RefreshUI(); }
private IEnumerator IGoTo(CardContent cc, CardPosition position) { GetCurrentList(cc).Remove(cc); cc.bUI.position = position; switch (position) { case CardPosition.Deck: deckPile.Add(cc); cc.bUI.transform.SetParent(deckPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); yield return(new WaitForSeconds(nextstep)); break; case CardPosition.Discard: discardPile.Add(cc); cc.bUI.transform.SetParent(discardPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); yield return(new WaitForSeconds(nextstep)); break; case CardPosition.Exhaust: exhaustPile.Add(cc); cc.bUI.transform.SetParent(exhaustPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); yield return(new WaitForSeconds(nextstep)); break; case CardPosition.Hand: handPile.Add(cc); cc.bUI.transform.SetParent(handPos.transform, true); break; case CardPosition.Used: usedPile.Add(cc); cc.bUI.transform.SetParent(usedPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); yield return(new WaitForSeconds(nextstep)); break; case CardPosition.Temp: tempPile.Add(cc); break; } yield break; }
public IEnumerator IDraw(List <CardContent> outlist, int count) { var leftCount = count; while (leftCount > 0) { if (deckPile.Count == 0) { if (discardPile.Count > 0) { yield return(IRefreshUI()); yield return(IShuffle()); continue; } else { break; } } else { CardContent card = deckPile[0]; yield return(IGoTo(card, CardPosition.Hand)); leftCount--; card.OnDraw(); if (outlist != null) { outlist.Add(card); } if (leftCount == 0) { break; } } } yield return(IRefreshUI()); yield break; }
//等决定动画后再逐步废除 private void GoTo(CardContent cc, CardPosition position) { GetCurrentList(cc).Remove(cc); cc.bUI.position = position; switch (position) { case CardPosition.Deck: deckPile.Add(cc); cc.bUI.transform.SetParent(deckPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); break; case CardPosition.Discard: discardPile.Add(cc); cc.bUI.transform.SetParent(discardPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); break; case CardPosition.Exhaust: exhaustPile.Add(cc); cc.bUI.transform.SetParent(exhaustPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); break; case CardPosition.Hand: handPile.Add(cc); cc.bUI.transform.SetParent(handPos.transform, true); break; case CardPosition.Used: usedPile.Add(cc); cc.bUI.transform.SetParent(usedPos.transform); cc.bUI.transform.DOLocalMove(Vector3.zero, duration); break; case CardPosition.Temp: tempPile.Add(cc); break; } }
public void GenerateCardTo(CardContent cc, CardPosition position) { GenerateCardUI(cc); GoTo(cc, position); cc.RefreshUI(); }
public void TempUse(CardContent cc) { GoTo(cc, CardPosition.Temp); }
public void ReturnToHand(CardContent cc) { GoTo(cc, CardPosition.Hand); RefreshUI(); }
public void ReturnToDeck(CardContent cc) { GoTo(cc, CardPosition.Deck); RefreshUI(); }
public void Used(CardContent cc) { GoTo(cc, CardPosition.Used); RefreshUI(); }
public void Exhaust(CardContent cc) { GoTo(cc, CardPosition.Exhaust); RefreshUI(); }
public void Discard(CardContent cc) { GoTo(cc, CardPosition.Discard); cc.OnDiscard(); RefreshUI(); }
public void SelectCard(CardContent cc) => outList.Add(cc);