/// <summary> /// This method create an new object Card and add it into the ArrayList /// </summary> /// <param name="pbName">The name of the card</param> /// <param name="pbUid">The uid (RFID) of the card</param> public void AddCardToList(string pbName, string pbUid) { pbName = (pbName == Card.DEFAULT_NAME) ? pbName + CardsList.Count : pbName; Card card = new Card(pbName, pbUid); CardsList.Add(card); }
/// <summary> /// 检测扑克个数 /// </summary> protected override void InitPokerList() { if (CardsList.Count == CardCount) { return; } if (CardsList.Count > CardCount) { //删除多余的牌 int count = CardsList.Count - CardCount; for (int i = 0; i < count; i++) { var temp = CardsList[i]; CardsList.Remove(temp); Destroy(temp); } } else { int count = CardCount - CardsList.Count; for (int i = 0; i < count; i++) { PokerCard clone = Instantiate(CardPrefab); clone.transform.parent = PokerParent; clone.name = "poker " + i; clone.transform.localScale = Vector3.one * .6f; clone.GetComponent <PokerCard>().SetCardDepth(130 + i * 3); CardsList.Add(clone); AddPokerEvent(clone); } } }
}/// <summary> /// 添加一张牌 /// </summary> /// <param name="comparedValue">牌的大小比较值</param> /// <param name="color_"></param> /// <param name="name_"></param> protected void AddSinglerCard(int comparedValue, string color_, string name_) { Card newCard = new Card(comparedValue, color_, name_) { Order = Random.Next(CardNameList.Length) }; CardsList.Add(newCard); }
/// <summary> /// 添加一张牌(例如:牌中大王) /// </summary> /// <param name="color_">花色</param> /// <param name="name_">点数名称</param> protected void AddSinglerCard(string color_, string name_) { Card newCard = new Card(CardsList.Count + 1, color_, name_) { Order = Random.Next(CardNameList.Length) }; CardsList.Add(newCard); }/// <summary>
/// <summary> /// 牌类循环生成规则 /// </summary> protected virtual void BuildNewCards() { for (int k = 1; k <= Cirlcal; k++) { for (int i = 0; i < CardColor.Count; i++) { var color = CardColor[i]; for (int j = 0; j < CardNameList.Length; j++) { Card card = new Card(j, color, CardNameList[j]); CardsList.Add(card); } } } Specific(); }
public async void RefreshList() { if (!IsUnitTesting) { MetricsManager.TrackEvent("Cards List Refreshed"); } IsLoading = true; List <Card> cards = await _azure.GetAllCards(_auth.CurrentUser); CardsList.Clear(); foreach (Card c in cards) { CardsList.Add(c); } NumberOfCards = CardsList.Count.ToString(); IsLoading = false; }