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

            gameObject.SetActive(true);

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

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

            Resort(pokerList);
            List <Help1.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].Special - (int)CardType.none >= 0)   //特殊牌型,不用显示每行牌型
                {
                    item.SpecialObj.SetActive(true);
                    item.NormalObj.SetActive(false);
                    item.Special = (int)pd[i].Special;
                    item.SpecialSprite.spriteName = pd[i].Special.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]);
        }
Exemple #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();
        }
Exemple #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);
        }