Exemplo n.º 1
0
        private void ExchangeCard(PokerCard card)
        {
            if (_selectPok1 == null)
            {
                _selectPok1 = card;
                _selectPok1.SetCardSelected(true);
                return;
            }

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

            int cardId1 = _selectPok1.Id;
            int cardId2 = _selectPok2.Id;

            int len = Lines.Length;

            for (int i = 0; i < len; i++)
            {
                var lineInfo = Lines[i].LineInfo;
                var valList  = lineInfo.Dun.Cards;
                int count    = valList.Count;
                for (int j = 0; j < count; j++)
                {
                    if (valList[j] == cardId1)
                    {
                        valList[j] = cardId2;
                        GetLineInfo(valList, i);
                        continue;
                    }

                    if (valList[j] == cardId2)
                    {
                        valList[j] = cardId1;
                        GetLineInfo(valList, i);
                    }
                }
            }

            ResetSelectedCards();
        }
Exemplo n.º 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();
        }