示例#1
0
        /// <summary>
        /// 显示手牌
        /// </summary>
        /// <param name="handCard"></param>
        public async void ShowHandCard(DDZCard handCard, bool hasAni = false)
        {
            if (handCard == null)
            {
                return;
            }

            this.ReSelect();

            this.HideHandCard();

            if (hasAni)
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_dealcard);
            }

            horizontalLayoutGroup.spacing = handCard.Card.Length > 17 ? DDZGameConfigComponent.Instance.handCardSortWidth : DDZGameConfigComponent.Instance.handCardNormalSortWidth;

            for (int i = 0; i < handCard.Card.Length; i++)
            {
                var cardValue = handCard.Card[i];

                DDZPokerItem item = handCardDic[i];

                if (hasAni)
                {
                    await Task.Delay(100);
                }

                int realId = DDZGameHelper.ChangeSeat(DDZGameConfigComponent.Instance.LordID);

                item.GetComponent <DDZPokerItemUIComponent>().SetPokerImageSprite(cardValue, realId == 0);
            }
        }
示例#2
0
        public DDZPokerItem Create(int index, Component parent)
        {
            DDZPokerItem item = ComponentFactory.CreateWithParent <DDZPokerItem>(parent);

            item.index = index;

            item.AddComponent <DDZPokerItemUIComponent>();

            return(item);
        }
示例#3
0
        public void Init()
        {
            for (int i = 0; i < 3; i++)
            {
                GameObject _card = _rf.Get <GameObject>("dp" + i);

                DDZPokerItem item = DDZUIFactory.pokerItem.Create(i, this);

                dpDic[i] = item;

                item.GetComponent <DDZPokerItemUIComponent>().SetPanel(_card, i);
            }
        }
示例#4
0
        private void GenerateOther(Dictionary <int, DDZPokerItem> p1, GameObject out1, GameObject out1_1)
        {
            for (int i = 0; i < 20; i++)
            {
                GameObject parentObj = i >= 10 ? out1_1 : out1;

                GameObject _card = UnityEngine.Object.Instantiate(DDZOutCard, parentObj.transform);

                _card.SetActive(false);

                _card.transform.localScale = Vector3.one * 1f;

                DDZPokerItem item = DDZUIFactory.pokerItem.Create(i, this);

                p1[i] = item;

                item.GetComponent <DDZPokerItemUIComponent>().SetPanel(_card, i);
            }
        }
示例#5
0
        public void Init()
        {
            for (int i = 0; i < 20; i++)
            {
                GameObject _card = UnityEngine.Object.Instantiate(DDZHandCard, this.panel.transform);

                _card.SetActive(false);

                _card.name = i.ToString();

                _card.transform.localScale = Vector3.one * 1.81f;

                DDZPokerItem item = DDZUIFactory.pokerItem.Create(i, this);

                handCardDic[i] = item;

                item.GetComponent <DDZPokerItemUIComponent>().SetPanel(_card, i, true);
            }
        }
示例#6
0
        /// <summary>
        /// 将出的牌绘制出来
        /// </summary>
        /// <param name="seatID"></param>
        /// <param name="_card"></param>
        public void PlayCardBySeatID(int seatID, DDZCard _card)
        {
            if (_card.Card == null)
            {
                return;
            }

            var curOutList = this.outCardDic[seatID];

            this.ClearOutList(curOutList);

            for (int i = 0; i < _card.Card.Length; i++)
            {
                var cardValue = _card.Card[i];

                DDZPokerItem item = curOutList[i];

                int lordID = DDZGameHelper.ChangeSeat(DDZGameConfigComponent.Instance.LordID);

                item.GetComponent <DDZPokerItemUIComponent>().SetPokerImageSprite(cardValue, lordID == seatID);
            }
        }
示例#7
0
        private void Init()
        {
            //生成自己出牌区域的牌

            Dictionary <int, DDZPokerItem> p0 = new Dictionary <int, DDZPokerItem>();

            for (int i = 0; i < 20; i++)
            {
                GameObject _card = UnityEngine.Object.Instantiate(DDZOutCard, this.OutCard0.transform);

                _card.SetActive(false);

                _card.transform.localScale = Vector3.one * 1f;

                DDZPokerItem item = DDZUIFactory.pokerItem.Create(i, this);

                p0[i] = item;

                item.GetComponent <DDZPokerItemUIComponent>().SetPanel(_card, i);
            }

            outCardDic[0] = p0;

            //生成另外两家的出牌区域的牌

            Dictionary <int, DDZPokerItem> p1 = new Dictionary <int, DDZPokerItem>();

            Dictionary <int, DDZPokerItem> p2 = new Dictionary <int, DDZPokerItem>();

            this.GenerateOther(p1, OutCard1, OutCard1_1);

            this.GenerateOther(p2, OutCard2, OutCard2_1);

            outCardDic[1] = p1;

            outCardDic[2] = p2;
        }