예제 #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);
        }
예제 #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);
        }
예제 #3
0
        public void FromHandToFoldArea(JlGameCardItem jlGameCardItem, bool rejoin = false)
        {
            var cardDepth = 30;
            var posTemp   = FoldCardArea.position;

            jlGameCardItem.transform.parent = FoldCardArea.transform;
            Vector3 scaleTemp = Vector3.one * 0.75f;

            posTemp.x = posTemp.x + (++_foldCardIndex) * -0.1500f;
            jlGameCardItem.SetCardDepth(cardDepth - _foldCardIndex);
            jlGameCardItem.SetCardDeath();

            var moveTime = 0.4f;

            if (rejoin)
            {
                moveTime = 0;
            }
            iTween.MoveTo(jlGameCardItem.gameObject, posTemp, moveTime);
            iTween.ScaleTo(jlGameCardItem.gameObject, scaleTemp, moveTime);
        }
예제 #4
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));
        }
예제 #5
0
        //开始时接牌
        public void GetCardsOnStart(JlGameCardItem jlGameCard, bool isSelf, int cardNum)
        {
            CardItemList.Add(jlGameCard);
            jlGameCard.SetCardDepth(StartCardIndex + 3);
            jlGameCard.transform.SetParent(CardsArea);
            Vector3 posTemp = CardsArea.localPosition;
            Vector3 scaleTemp;

            if (isSelf)
            {
                jlGameCard.MyCardFlag = true;
                scaleTemp             = Vector3.one;
                posTemp = new Vector3(StartCardIndex * 80f, 0, posTemp.z);
                StartCardIndex++;
            }
            else
            {
                scaleTemp = Vector3.one * 0.35f;
                posTemp   = new Vector3(0, StartCardIndex * 2.16f, posTemp.z);
                StartCardIndex++;
            }
            TweenPosition.Begin(jlGameCard.gameObject, 0.4f, posTemp);
            TweenScale.Begin(jlGameCard.gameObject, 0.4f, scaleTemp);
        }
예제 #6
0
        private void RejoinCardDeal(object data)
        {
            var playerArr = _gdata.PlayerList;

            _gdata.GetPlayer <JlGameSelfPlayer>().RejoinFresh = new EventDelegate(OnTrusteeshipBtnClick);

            for (int i = 0; i < playerArr.Length; i++)
            {
                _gdata.GetPlayer <JlGamePlayer>(i).CreateCards(JlGameCardItem, i == 0, _gdata.GetPlayerInfo <JlGameUserInfo>(i).CardLen, _gdata.GetPlayerInfo <JlGameUserInfo>(i).Cards, OnClickCard);
            }

            ReadyBtn.gameObject.SetActive(!_gdata.GetPlayer <JlGamePlayer>().ReadyState);
            var cardData = (ISFSObject)data;
            var color1   = cardData.GetIntArray("color1");
            var color2   = cardData.GetIntArray("color2");
            var color3   = cardData.GetIntArray("color3");
            var color4   = cardData.GetIntArray("color4");

            if (color1.Length != 0)
            {
                foreach (var t in color1)
                {
                    JlGameCardItem jlGameCard = Instantiate(JlGameCardItem);
                    jlGameCard.Value = t;
                    OutCardAreas[0].FromHandToOutArea(jlGameCard, true);
                }
            }
            if (color2.Length != 0)
            {
                foreach (var t in color2)
                {
                    JlGameCardItem jlGameCard = Instantiate(JlGameCardItem);
                    jlGameCard.Value = t;
                    OutCardAreas[1].FromHandToOutArea(jlGameCard, true);
                }
            }
            if (color3.Length != 0)
            {
                foreach (var t in color3)
                {
                    JlGameCardItem jlGameCard = Instantiate(JlGameCardItem);
                    jlGameCard.Value = t;
                    OutCardAreas[2].FromHandToOutArea(jlGameCard, true);
                }
            }
            if (color4.Length != 0)
            {
                foreach (var t in color4)
                {
                    JlGameCardItem jlGameCard = Instantiate(JlGameCardItem);
                    jlGameCard.Value = t;
                    OutCardAreas[3].FromHandToOutArea(jlGameCard, true);
                }
            }

            var killDragon = cardData.ContainsKey("killDragon") ? cardData.GetBoolArray("killDragon") : null;
            var isDragon   = cardData.ContainsKey("isDragon") ? cardData.GetBoolArray("isDragon") : null;

            if (killDragon != null || isDragon != null)
            {
                StartCoroutine(PlayDragon(killDragon, isDragon, true));
            }
        }