Esempio n. 1
0
        /// <summary>
        /// 设置扑克牌
        /// </summary>
        /// <param name="poker"></param>
        public void SetPokerImageSprite(byte pokerId, bool isDiZhu = false)
        {
            this.Panel.SetActive(true);

            this.pokerId = pokerId;

            this.isDiZhu = isDiZhu;

            this.pokerInt = PokerCardsHelper.GetPokerOfInt(pokerId);

            this.pokerValue = DDZGameHelper.GetPokerNum(pokerId);

            _poker.sprite = SpriteHelper.GetPokerSprite(PokerCardsHelper.GetPokerOfInt(pokerId));

            this._dizhu.SetActive(isDiZhu);
        }
Esempio n. 2
0
        public DDZInteractivePlugin Awake(GameObject panel)
        {
            this.panel = panel;

            _rf = this.panel.GetComponent <ReferenceCollector>();

            Clock = _rf.Get <GameObject>("Clock");

            Num = _rf.Get <GameObject>("Num").GetComponent <Text>();

            TipBtn = _rf.Get <GameObject>("TipBtn").GetComponent <Button>();

            Clock.SetActive(false);

            clockComponent = AddComponent <DDZClockComponent>().Awake(Num.gameObject);

            ButtonHelper.RegisterButtonEvent(_rf, "NotOutBtn", () =>
            {
                Game.PopupComponent.SetClickLock();

                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                DDZConfig.GameScene.RequestPlayCard(1, new DDZCard());
            });

            ButtonHelper.RegisterButtonEvent(_rf, "ReSetBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                DDZConfig.GameScene.DDZHandCardPlugin.ReSelect();
            });

            ButtonHelper.RegisterButtonEvent(_rf, "TipBtn", () =>
            {
                Game.PopupComponent.SetClickLock();

                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                DDZConfig.GameScene.DDZHandCardPlugin.ReSelect();

                var tipCardDic = DDZConfig.GameScene.DDZAIComponent.GetTipCards();

                if (tipCardDic != null && tipCardDic.Count > 0)
                {
                    Log.Debug("获得的提示长度是:" + tipCardDic.Count);

                    if (tipCardIndex == -1)
                    {
                        tipCardIndex = 0;
                    }

                    if (tipCardIndex > tipCardDic.Count - 1)
                    {
                        tipCardIndex = 0;
                    }

                    List <int> tipCards = tipCardDic[tipCardIndex];

                    DDZConfig.GameScene.DDZHandCardPlugin.SelectTipCard(tipCards);

                    tipCardIndex++;
                }
                else
                {
                    Game.PopupComponent.ShowTips(DataCenterComponent.Instance.tipInfo.NoTipCardsTip);
                }
            });

            ButtonHelper.RegisterButtonEvent(_rf, "OutBtn", () =>
            {
                Game.PopupComponent.SetClickLock();

                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                DDZCard _data = new DDZCard();

                List <byte> outCardList = DDZConfig.GameScene.DDZHandCardPlugin.GetOutCardList();

                _data.Card = PbHelper.CopyFrom(outCardList);

                foreach (var item in outCardList)
                {
                    Log.Debug("牌值:" + PokerCardsHelper.GetPokerOfInt(item));

                    Log.Debug("中文牌:" + PokerCardsHelper.GetPokerString(item));
                }

                _data.CardsNum = outCardList.Count;

                Log.Debug("出牌的长度:" + _data.CardsNum);

                //增加判断:出牌是否为空
                if (_data.CardsNum <= 0)
                {
                    DDZConfig.GameScene.DDZMaskPlugin.Show(2);
                }
                else
                {
                    DDZConfig.GameScene.RequestPlayCard(0, _data);
                }
            });

            this.Reset();

            return(this);
        }