Пример #1
0
        private void RemoveSlotFromLayout(List <List <MiniCardSlot> > slotList, MiniCardSlot slot)
        {
            if (slot == null)
            {
                return;
            }

            SetSlotIdle(slot);

            if (slotList == null)
            {
                return;
            }

            for (int c = 0; c < slotList.Count; c++)
            {
                var col = slotList[c];
                col.Remove(slot);

                if (col.Count <= 0)
                {
                    slotList.RemoveAt(c);
                    c--;
                }
            }
        }
Пример #2
0
        private void SetHuanGongState(
            Text huanGongUserTxt,
            MiniCardSlot huanGongPokerSlot,
            Text huanGongDestTxt,
            User huanGongUser,
            Poker huanGongPoker,
            User huanGongDestUser)
        {
            if (!huanGongUserTxt.gameObject.activeSelf)
            {
                huanGongUserTxt.gameObject.SetActive(true);
            }

            var nickname = FormatNickname(huanGongUser, "爱掼蛋玩家");

            if (huanGongPoker == null)
            {
                huanGongUserTxt.text = "等待 " + nickname + " 还贡";

                if (huanGongPokerSlot.gameObject.activeSelf)
                {
                    huanGongPokerSlot.gameObject.SetActive(false);
                }

                if (huanGongDestTxt.gameObject.activeSelf)
                {
                    huanGongDestTxt.gameObject.SetActive(false);
                }
            }
            else
            {
                huanGongUserTxt.text = nickname + " 还贡";

                if (!huanGongPokerSlot.gameObject.activeSelf)
                {
                    huanGongPokerSlot.gameObject.SetActive(true);
                }

                huanGongPokerSlot.CardHelper = CardHelper;
                huanGongPokerSlot.Poker      = huanGongPoker;

                var destNickname = FormatNickname(huanGongDestUser, null);
                if (destNickname != null)
                {
                    if (!huanGongDestTxt.gameObject.activeSelf)
                    {
                        huanGongDestTxt.gameObject.SetActive(true);
                    }

                    huanGongDestTxt.text = "给 " + destNickname;
                }
                else
                {
                    if (huanGongDestTxt.gameObject.activeSelf)
                    {
                        huanGongDestTxt.gameObject.SetActive(false);
                    }
                }
            }
        }
Пример #3
0
        private void SetJinGongState(
            Text jinGongUserTxt,
            MiniCardSlot jinGongPokerSlot,
            Text jinGongDestTxt,
            User jinGongUser,
            Poker jinGongPoker,
            User jinGongDestUser)
        {
            if (!jinGongUserTxt.gameObject.activeSelf)
            {
                jinGongUserTxt.gameObject.SetActive(true);
            }

            var nickname = FormatNickname(jinGongUser, "爱掼蛋玩家");

            if (jinGongPoker == null)
            {
                jinGongUserTxt.text = "等待 " + nickname + " 进贡";

                if (jinGongPokerSlot.gameObject.activeSelf)
                {
                    jinGongPokerSlot.gameObject.SetActive(false);
                }

                if (jinGongDestTxt.gameObject.activeSelf)
                {
                    jinGongDestTxt.gameObject.SetActive(false);
                }
            }
            else
            {
                jinGongUserTxt.text = nickname + " 进贡";

                if (!jinGongPokerSlot.gameObject.activeSelf)
                {
                    jinGongPokerSlot.gameObject.SetActive(true);
                }

                jinGongPokerSlot.CardHelper = CardHelper;
                jinGongPokerSlot.Poker      = jinGongPoker;

                var destNickname = FormatNickname(jinGongDestUser, null);
                if (destNickname != null)
                {
                    if (!jinGongDestTxt.gameObject.activeSelf)
                    {
                        jinGongDestTxt.gameObject.SetActive(true);
                    }

                    jinGongDestTxt.text = "给 " + destNickname;
                }
                else
                {
                    if (jinGongDestTxt.gameObject.activeSelf)
                    {
                        jinGongDestTxt.gameObject.SetActive(false);
                    }
                }
            }
        }
Пример #4
0
        private void SetSlotIdle(MiniCardSlot slot)
        {
            slot.Clear();
            slot.gameObject.SetActive(false);

            if (!_idleSlots.Contains(slot))
            {
                _idleSlots.Enqueue(slot);
            }
        }
Пример #5
0
 private void ResizeSlot(MiniCardSlot slot, float width, float height)
 {
     slot.RectTransform.sizeDelta  = new Vector2(width, height);
     slot.RectTransform.localScale = new Vector3(1, 1, 1);
 }
Пример #6
0
 private void MoveSlot(MiniCardSlot slot, float x, float y, int siblingIndex)
 {
     slot.RectTransform.SetSiblingIndex(siblingIndex);
     slot.RectTransform.anchoredPosition = new Vector2(x, y);
 }