Beispiel #1
0
        public void FromHandToOutArea(JlGameCardItem jlGameCardItem, bool rejoin = false)
        {
            var posTemp = transform.localPosition;

            jlGameCardItem.transform.parent = transform;
            Vector3 scaleTemp = Vector3.one * 0.5f;

            _flyTime = rejoin ? 0 : 0.4f;

            posTemp.x = (jlGameCardItem.Card.Value - 1) * 54.8f;
            posTemp.y = 0;
            if (OutCards.Count != 0)
            {
                if (jlGameCardItem.Value < OutCards[0].Value)
                {
                    OutCards[0].SelectShade.gameObject.SetActive(OutCards.Count > 1);
                    OutCards.Insert(0, jlGameCardItem);
                }
                if (jlGameCardItem.Value > OutCards[OutCards.Count - 1].Value)
                {
                    OutCards[OutCards.Count - 1].SelectShade.gameObject.SetActive(OutCards.Count > 1);

                    OutCards.Add(jlGameCardItem);
                }
            }
            else
            {
                OutCards.Add(jlGameCardItem);
            }

            var depth = 0;

            switch (jlGameCardItem.Card.Colour)
            {
            case 4:
                depth += 40;
                break;

            case 2:
                depth += 30;
                break;

            case 3:
                depth += 20;
                break;

            case 1:
                depth += 10;
                break;
            }
            jlGameCardItem.SetCardDepth(jlGameCardItem.Card.Id + depth);
            jlGameCardItem.GetComponent <BoxCollider>().enabled = false;
            TweenPosition.Begin(jlGameCardItem.gameObject, _flyTime, posTemp);
            TweenScale.Begin(jlGameCardItem.gameObject, _flyTime, scaleTemp);
        }
Beispiel #2
0
        public void CreateCards(JlGameCardItem jlGameCardItem, bool isSelf, int len, int[] cards, UIEventListener.VoidDelegate click = null)
        {
            for (int i = 0; i < len; i++)
            {
                JlGameCardItem jlGameCard = (JlGameCardItem)Instantiate(jlGameCardItem, new Vector3(0.002f * i - 0.1f, 0, 0), Quaternion.identity);
                jlGameCard.GetComponent <UIEventListener>().onClick = click;
                jlGameCard.transform.SetParent(CardsArea);
                jlGameCard.transform.localScale = Vector3.one * 0.4f;
                jlGameCard.SetCardDepth(i + 3);
                jlGameCard.SetBackKey();

                Vector3 posTemp = CardsArea.localPosition;
                Vector3 scaleTemp;
                if (isSelf)
                {
                    jlGameCard.MyCardFlag = true;
                    posTemp   = new Vector3(StartCardIndex * 80f, 0, posTemp.z);
                    scaleTemp = Vector3.one;
                    StartCardIndex++;
                }
                else
                {
                    scaleTemp = Vector3.one * 0.35f;
                    posTemp   = new Vector3(0, StartCardIndex * 2.16f, posTemp.z);
                    StartCardIndex++;
                }

                jlGameCard.transform.localPosition = posTemp;
                jlGameCard.transform.localScale    = scaleTemp;
                CardItemList.Add(jlGameCard);
            }

            SetCardValue(cards, len);

            List <JlGameCardItem> foldCards = new List <JlGameCardItem>();

            if (GetInfo <JlGameUserInfo>().FoldCards != null)
            {
                for (int i = 0; i < GetInfo <JlGameUserInfo>().FoldCards.Length; i++)
                {
                    JlGameCardItem foldJlGameCard = (JlGameCardItem)Instantiate(jlGameCardItem);
                    foldJlGameCard.Value = GetInfo <JlGameUserInfo>().FoldCards[i];
                    foldCards.Add(foldJlGameCard);
                }
            }

            CreatFoldCard(foldCards);
            FreshFoldCardShow(GetInfo <JlGameUserInfo>().FoldNum, len, GetInfo <JlGameUserInfo>().FoldScore);
        }
Beispiel #3
0
        public void CreateAllCards(object data)
        {
            var cardData      = (ISFSObject)data;
            var cards         = cardData.GetIntArray("cards");
            var cardsNum      = cardData.GetUtfStringArray("cardsNum");
            var selfSeat      = cardData.GetInt("selfSeat");
            var allCardsCount = 0;

            _gdata.GetPlayer <JlGameSelfPlayer>().RejoinFresh = new EventDelegate(OnTrusteeshipBtnClick);
            foreach (var t in cardsNum)
            {
                allCardsCount += int.Parse(t);
            }
            for (int i = 0; i < allCardsCount; i++)
            {
                JlGameCardItem mJlGameCard = (JlGameCardItem)Instantiate(JlGameCardItem, new Vector3(0.002f * i - 0.1f, 0, 0), Quaternion.identity);
                mJlGameCard.transform.SetParent(StartArea);
                mJlGameCard.SetCardDepth(i);
                mJlGameCard.transform.localScale = Vector3.one * 0.4f;
                mJlGameCard.GetComponent <UIEventListener>().onClick = OnClickCard;
                CardsList.Add(mJlGameCard);
            }
            StartCoroutine(AllocateCard(cards, cardsNum, selfSeat));
        }