Exemplo n.º 1
0
    /// <summary>
    /// 排序卡牌的UI
    /// </summary>
    /// <param name="cards">有序序列</param>
    public void SortCardUI(List <Card> cards)
    {
        CardUI[] cardUIs = CreatePoint.GetComponentsInChildren <CardUI>();

        for (int i = 0; i < cards.Count; i++)
        {
            for (int j = 0; j < cardUIs.Length; j++)
            {
                if (cards[i] == cardUIs[j].Card)
                {
                    cardUIs[j].SetPosition(CreatePoint, i);
                }
            }
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// 获取选中的牌的集合
 /// </summary>
 /// <returns></returns>
 public List <Card> FindCards()
 {
     cards   = new List <Card>();
     cardsUI = new List <CardUI>();
     CardUI[] uIs = CreatePoint.GetComponentsInChildren <CardUI>();
     for (int i = 0; i < uIs.Length; i++)
     {
         if (uIs[i].IsSelected)
         {
             cards.Add(uIs[i].Card);
             cardsUI.Add(uIs[i]);
         }
     }
     ToolsManager.SortList(cards, true);//排列选中的牌
     return(cards);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 找到选中的牌
 /// </summary>
 /// <returns>选中的牌</returns>
 public List <Card> FindSelected()
 {
     CardUI[] cardUIs = CreatePoint.GetComponentsInChildren <CardUI>();
     tempCard = new List <Card>();
     tempUI   = new List <CardUI>();
     for (int i = 0; i < cardUIs.Length; i++)
     {
         if (cardUIs[i].IsSelected)
         {
             tempUI.Add(cardUIs[i]);
             tempCard.Add(cardUIs[i].Card);
         }
     }
     //***//
     Tools.Sort(tempCard, true);
     return(tempCard);
 }
    /// <summary>
    /// 清空卡牌
    /// </summary>
    /// <param name="type"></param>
    public void ClearList(ShowPoint type)
    {
        switch (type)
        {
        case ShowPoint.Desk:
            Cards.Clear();
            CardUI[] cardUI = CreatePoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUI.Length; i++)
            {
                cardUI[i].Destory();
            }
            break;

        case ShowPoint.Player:
            m_PlayerList.Clear();
            CardUI[] PcardUI = PlayPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < PcardUI.Length; i++)
            {
                PcardUI[i].Destory();
            }
            break;

        case ShowPoint.ComputerRight:
            m_RComputerList.Clear();
            CardUI[] RcardUI = ComputerRightPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < RcardUI.Length; i++)
            {
                RcardUI[i].Destory();
            }
            break;

        case ShowPoint.ComputerLeft:
            m_LComputerList.Clear();
            CardUI[] LcardUI = ComputerLeftPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < LcardUI.Length; i++)
            {
                LcardUI[i].Destory();
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// 桌面清空
    /// </summary>
    /// <param name="pos"></param>
    public void Clear(ShowPoint pos)
    {
        switch (pos)
        {
        case ShowPoint.Desk:
            Cards.Clear();
            CardUI[] cardUIs = CreatePoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUIs.Length; i++)
            {
                cardUIs[i].Destroy();
            }
            break;

        case ShowPoint.Player:
            PlayerCardList.Clear();
            CardUI[] cardUIPlayer = PlayerPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUIPlayer.Length; i++)
            {
                cardUIPlayer[i].Destroy();
            }
            break;

        case ShowPoint.ComputerRight:
            ComputerRightCardList.Clear();
            CardUI[] cardUIRight = ComputerRightPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUIRight.Length; i++)
            {
                cardUIRight[i].Destroy();
            }
            break;

        case ShowPoint.ComputerLeft:
            ComputerLeftCardList.Clear();
            CardUI[] cardUILeft = ComputerLeftPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUILeft.Length; i++)
            {
                cardUILeft[i].Destroy();
            }
            break;

        default:
            break;
        }
    }
 /// <summary>
 /// 出牌成功后删除出的牌
 /// </summary>
 public void DestoryCard()
 {
     CardUI[] cardUIs = CreatePoint.GetComponentsInChildren <CardUI>();
     foreach (Card item in SelectedCard)
     {
         foreach (CardUI uI in cardUIs)
         {
             if (item == uI.Card)
             {
                 uI.Destory();
                 Cards.Remove(item);
             }
         }
     }
     //排序UI显示
     //更新剩余牌数显示
     CardUISort(Cards);
     m_characterUI.SetRemainCard(RemainCardCount);
 }
Exemplo n.º 7
0
 private void DestroyCards()
 {
     //删数据
     //删UI
     CardUI[] cardsUi = CreatePoint.GetComponentsInChildren <CardUI>();
     for (int i = 0; i < cardsUi.Length; i++)
     {
         for (int j = 0; j < SelectCards.Count; j++)
         {
             //是否出牌与UI一样
             if (SelectCards[j] == cardsUi[i].Card)
             {
                 cardsUi[i].Destroy();
                 Cards.Remove(SelectCards[j]);
             }
         }
     }
     //Ui排序
     SortCardUI(Cards);
     characterUI.SetRemain(CardCount);
 }