Пример #1
0
 public void ClearPopCard()
 {
     RX_CardManager.ClearPool();
     UISprite[] sprites = seat_container.GetComponentsInChildren <UISprite>();
     sprites[0] = null;
     RX_CardManager.AddPool(sprites);
     foreach (RX_Card card in Card_list)
     {
         card.IsPop = false;
     }
     LayoutCardList();
     LayoutCardList();
 }
Пример #2
0
        public RX_CardSet PopCardSet()
        {
            //FindAll 需要传入一个谓词条件....
            List <RX_Card> list = this.Card_list.FindAll((RX_Card obj) => { return(obj.IsPop); });
            //create a new cardSet,which player have selected
            RX_CardSet card_set = new RX_CardSet();

            card_set.Card_lister = list;

            //check the whether the cardSet is effect
            if (RX_CardType.IsBigBoom(card_set) ||
                RX_CardType.IsBoom(card_set) ||
                RX_CardType.IsDan(card_set) ||
                RX_CardType.IsDui(card_set) ||
                RX_CardType.IsFeijibudai(card_set) ||
                RX_CardType.IsFeijidai(card_set) ||
                RX_CardType.IsLianDui(card_set) ||
                RX_CardType.IsSanBuDai(card_set) ||
                RX_CardType.IsSandaiyi(card_set) ||
                RX_CardType.IsShunzi(card_set) ||
                RX_CardType.IsSidaier(card_set)
                )
            {
                //check can give a hand?
                if (RX_Manager.prevCardSet == null ||
                    (card_set.Card_lister.Count == RX_Manager.prevCardSet.Card_lister.Count && (int)card_set.Card_level > (int)RX_Manager.prevCardSet.Card_level && card_set.Card_type == RX_Manager.prevCardSet.Card_type) ||
                    (card_set.Card_type == RX_CARD_SET.RX_TYPE_BOOM && RX_Manager.prevCardSet.Card_type != RX_CARD_SET.RX_TYPE_BOOM && RX_Manager.prevCardSet.Card_type != RX_CARD_SET.RX_TYPE_WANGZHA) ||
                    card_set.Card_type == RX_CARD_SET.RX_TYPE_WANGZHA
                    )
                {
                    //clear previous spritePool and add the current cardsSprites to the pool
                    RX_CardManager.ClearPool();
                    UISprite[]      sprites = seat_container.GetComponentsInChildren <UISprite>();
                    List <UISprite> param   = new List <UISprite>();
                    for (int i = 0; i < sprites.Length; i++)
                    {
                        foreach (RX_Card item in card_set.Card_lister)
                        {
                            if (item.ToString() == sprites[i].name)
                            {
                                //change the sprite's parent, prevent it been destroyed
                                sprites[i].transform.SetParent(GameObject.Find("Control - Handed").transform);
                                param.Add(sprites[i]);
                                sprites[i] = new UISprite();
                                break;
                            }
                        }
                    }
                    RX_CardManager.SetHandedSprites(seat_pos, param);
                    sprites[0] = null;
                    RX_CardManager.AddPool(sprites);

                    ////RemoveAll 需要传入一个谓词条件....instantiate new cards on the screen!
                    this.Card_list.RemoveAll((RX_Card obj) => { return(obj.IsPop); });
                    //re layout after deleted the pop cards
                    this.LayoutCardList();
                    return(card_set);
                }
                return(null);
            }
            else
            {
                return(null);
            }
        }