예제 #1
0
        public override void ShowChoiseView(ISFSObject cardData)
        {
            base.ShowChoiseView(cardData);
            InitPokerList();        //初始化左侧的牌
            RepositionCards();      //将左侧的牌排列成三行

            gameObject.SetActive(true);

            int[] array = cardData.GetIntArray("cards");

            HelpLz     help      = new HelpLz();
            List <int> pokerList = array.ToList();

            Resort(pokerList);
            List <HelpLz.PlayerDuns> pd = help.getPlayerDuns(pokerList);

            while (pd.Count > 0 && pd[0].Duns[0] == null)
            {
                pd.Remove(pd[0]);
            }

            int itemCount = pd.Count > 3 ? 3 : pd.Count;

            //初始化数据
            for (int i = 0; i < itemCount; i++)
            {
                ChoiseItem item = _choiseItems[i];
                item.gameObject.SetActive(true);
                if ((int)pd[i].SpecialType - (int)CardType.none >= 0)   //特殊牌型,不用显示每行牌型
                {
                    item.SpecialObj.SetActive(true);
                    item.NormalObj.SetActive(false);
                    item.Special = (int)pd[i].SpecialType;
                    item.SpecialSprite.spriteName = pd[i].SpecialType.ToString();
                    item.SpecialSprite.MakePixelPerfect();
                    item.SetChoiseItem(pd[i].Duns);
                }
                else    //普通牌型,要显示每组牌的牌型
                {
                    item.SpecialObj.SetActive(false);
                    item.NormalObj.SetActive(true);

                    item.SetChoiseItem(pd[i].Duns);
                }
            }
            OnClickPlane(_choiseItems[0]);
        }
예제 #2
0
        public override void OnClickCard(PokerCard card)
        {
            if (_selectPok1 == null)
            {
                _selectPok1 = card;
                _selectPok1.SetCardSelected(true);
                return;
            }

            if (_selectPok2 == null)
            {
                if (_selectPok1.Equals(card))
                {
                    ResetSelectedCards();
                    return;
                }
                _selectPok2 = card;
            }

            int        index1   = CardsList.IndexOf(_selectPok1);
            int        index2   = CardsList.IndexOf(_selectPok2);
            List <int> tempList = new List <int>(_lastList);
            int        tempInt  = tempList[index1];

            tempList[index1] = tempList[index2];
            tempList[index2] = tempInt;

            ExchangePokersPosition(_selectPok1, _selectPok2);
            var tempObj = CardsList[index1];

            CardsList[index1] = CardsList[index2];
            CardsList[index2] = tempObj;
            _lastList         = tempList;

            foreach (ChoiseItem item in _choiseItems)
            {
                item.SelectMark.SetActive(false);
            }
            _lastChoiseItem = null;
            ResetSelectedCards();
        }
예제 #3
0
        public void OnClickPlane(ChoiseItem choise)
        {
            if (choise == null)
            {
                foreach (ChoiseItem item in _choiseItems)
                {
                    item.SelectMark.SetActive(false);
                }
                return;
            }

            _lastChoiseItem = choise;

            foreach (ChoiseItem item in _choiseItems)
            {
                item.SelectMark.SetActive(item.Equals(choise));
            }

            ChoisePlane(choise.CardsList);
            _lastList = new List <int>(choise.CardsList);
        }