Esempio n. 1
0
    internal override void StartTableOk(int[] cardHand, Message msg, string[] nickPlay)
    {
        base.StartTableOk(cardHand, msg, nickPlay);
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            ((LiengPlayer)ListPlayer[i]).MoneyChip = 0;
        }
        groupMoneyTo.OnHide();
        MinToMoney = GameConfig.BetMoney * 2;
        MaxToMoney = ClientConfig.UserInfo.CASH_FREE - MinToMoney;

        SumChipControl.MoneyChip = 0;
        tongMoney = 0;

        //Debug.LogError("Card Hand   " + cardHand.Length);
        int[] ccc = new int[2];
        int   ii  = 0;

        for (int i = 0; i < cardHand.Length; i++)
        {
            //Debug.LogError("Card Hand  i " + cardHand[i]);
            if (cardHand[i] >= 0 && cardHand[i] < 52)
            {
                ccc[ii] = cardHand[i];
                ii++;
            }
        }
        list_my_card.Clear();
        list_my_card.AddRange(ccc);
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            LiengPlayer player = (LiengPlayer)ListPlayer[i];
            if (player != null)
            {
                player.MoneyChip = GameConfig.BetMoney;
                player.MoveChip(GameConfig.BetMoney, SumChipControl.transform.position);
                if (player.SitOnClient == 0)
                {
                    player.CardHand.SetAllDark(true);
                    //player.SetTypeCard(PokerCard.getTypeOfCardsPoker(list_my_card.ToArray()));
                    //player.SetTypeCard(
                    TYPE_CARD type  = TypeCardMauBinh.GetTypeCardMauBinh(list_my_card.ToArray());
                    int       type2 = PokerCard.getTypeOfCardsPoker(list_my_card.ToArray());

                    //Debug.LogError("11111111111Type card:  " + type);
                    //Debug.LogError("22222222222Type card:  " + type2);

                    player.CardHand.ChiaBaiTienLen(ccc, true);
                    player.CardHand.SetTouchCardHand(true);
                }
                else
                {
                    player.CardHand.ChiaBaiTienLen(new int[] { 52, 52 }, true);
                }
            }
            tongMoney += GameConfig.BetMoney;
        }
        SumChipControl.OnShow();
        SumChipControl.MoneyChip = tongMoney;
    }
Esempio n. 2
0
 void GetCardNoc(ArrayCard ArrayCardHand, int idCard, bool isTao)
 {
     if (ArrayCardHand.listCardHand[1].ID == 52)
     {
         ArrayCardHand.listCardHand[1].SetCardWithId(idCard);
     }
     else
     {
         Card c = GetCardOnArrayCard(ArrayCardHand);
         //if (isTao) {
         c.SetCardWithId(idCard);
         c.transform.localPosition = ArrayCardHand.GetPositonCardActive();
         c.SetDarkCard(false);
         c.SetTouched(isTao);
         c.IsChoose = false;
         //} else
         //	c.SetCardWithId(53);
         //Vector3 vt = ArrayCardHand.POS_CENTER;//ArrayCardHand.transform.InverseTransformPoint(ArrayCardHand.vtPosCenter);
         Vector3 vt = ArrayCardHand.transform.InverseTransformPoint(dealerPos.position);
         StartCoroutine(c.MoveFrom(vt, 0.4f, 0, () => {
             //ArrayCardHand.ResetCard(true);
             Card ctemp = new Card();
             ctemp      = c;
             ArrayCardHand.listCardHand.Remove(c);
             ArrayCardHand.listCardHand.Add(ctemp);
             ArrayCardHand.SortCardActive(true, 0.2f);
         }));
     }
     if (isTao)
     {
         TYPE_CARD type = TypeCardMauBinh.GetTypeCardMauBinh(list_my_card.ToArray());
         Debug.LogError("Kieu bai cua toi" + type);
     }
 }
Esempio n. 3
0
    IEnumerator SoChi(int[] arrChi, int chi, int typeC, bool isTao)
    {
        yield return(new WaitForEndOfFrame());

        #region Them
        Vector3 vt;
        if (!isOne)          //chi == 2 ||
        {
            isOne = true;
            yield return(new WaitForSeconds(1));

            for (int i = 0; i < arrayCard.Length; i++)
            {
                int count = (i == 0 ? 3 : 5);
                vt = arrayCard [i].transform.localPosition;
                arrayCard [i].transform.localScale = Vector3.zero;
                if (isTao)
                {
                    arrayCard [i].MaxWidth = count * MaxWidthMe;
                    vt.y = PosYMe [i];
                }
                else
                {
                    arrayCard [i].MaxWidth = count * (MaxWidthOther + 20);
                    vt.y = 80 - i * 40;
                }

                arrayCard [i].SortCardActive(true);
                arrayCard [i].transform.localPosition = vt;
                arrayCard [i].transform.DOScale(1, 0.2f);
            }

            yield return(new WaitForSeconds(1));
        }
        #endregion

        int typeCC = (int)TypeCardMauBinh.GetTypeCardMauBinh(arrChi);
        arrChi = TypeCardMauBinh.SortDescendingArrCard(arrChi);
        for (int i = 0; i < arrayCard.Length; i++)
        {
            if (i != chi)
            {
                arrayCard [i].transform.DOScale(1, 0.1f);                 // = Vector3.one;
                arrayCard [i].transform.SetSiblingIndex(i);
            }
        }
        arrayCard [chi].transform.SetSiblingIndex(4);
        arrayCard [chi].transform.DOScale(1.2f, 0.2f);         // = Vector3.one;
        vt = arrayCard [chi].transform.localPosition;

        if (isTao)
        {
            vt.y += 40;
        }
        else
        {
            vt.y += 80;
        }

        player.SetTypeCard(GameConfig.STR_TYPE_CARD [typeCC], vt, isTao);         //sua
        arrayCard [chi].SetActiveCardWithArrID(arrChi);

        if (chi == 0)
        {
            yield return(new WaitForSeconds(2));

            arrayCard [chi].transform.DOScale(1f, 0.2f);
            arrayCard [chi].transform.SetAsFirstSibling();
//			EffectScale (arrayCard [2].transform, 1.1f, () => {
//				arrayCard [1].transform.SetAsFirstSibling ();
//				EffectScale (arrayCard [1].transform, 1.1f, () => {
//					arrayCard [0].transform.SetAsFirstSibling ();
//					EffectScale (arrayCard [0].transform, 1.1f, () => {
//					});
//				});
//			});
//			yield return new WaitForSeconds (2);
//			SetActiveCard ();
        }
    }
Esempio n. 4
0
    void SetLoaiBai(int[] arr)
    {
        int[] chi1 = new int[5];
        int[] chi2 = new int[5];
        int[] chi3 = new int[3];
        for (int i = 0; i < arr.Length; i++)
        {
            if (i < 5)
            {
                chi1 [i] = arr [i];
            }
            else if (i < 10)
            {
                chi2 [i - 5] = arr [i];
            }
            else
            {
                chi3 [i - 10] = arr [i];
            }
        }


        int thangtrang = TypeCardMauBinh.IsThangTrang(arr);

        if (thangtrang != -1)
        {
            for (int i = 0; i < txt_typecards.Length; i++)
            {
                txt_typecards [i].gameObject.SetActive(false);
            }
            txt_typecards [1].gameObject.SetActive(true);
            txt_typecards [1].text = GameConfig.STR_THANG_TRANG [thangtrang];
            return;
        }

        TYPE_CARD type1 = TypeCardMauBinh.GetTypeCardMauBinh(chi1);
        TYPE_CARD type2 = TypeCardMauBinh.GetTypeCardMauBinh(chi2);
        TYPE_CARD type3 = TypeCardMauBinh.GetTypeCardMauBinh(chi3);

//		string str = "";
//		for (int i = 0; i < chi1.Length; i++) {
//			str += TypeCardMauBinh.GetValue (chi1 [i]);
//		}
//		Debug.LogError (type1 + "\n" + str);
//		str = "";
//		for (int i = 0; i < chi2.Length; i++) {
//			str += TypeCardMauBinh.GetValue (chi2 [i]);
//		}
//		Debug.LogError (type2 + "\n" + str);
//
//		str = "";
//		for (int i = 0; i < chi3.Length; i++) {
//			str += TypeCardMauBinh.GetValue (chi3 [i]);
//		}
//		Debug.LogError (type3 + "\n" + str);

        SetLoaiBaiCuaChi(2, (int)type1);
        SetLoaiBaiCuaChi(1, (int)type2);
        SetLoaiBaiCuaChi(0, (int)type3);

        if (TypeCardMauBinh.IsLung(chi1, chi2, chi3))
        {
            for (int i = 0; i < txt_typecards.Length; i++)
            {
                txt_typecards [i].gameObject.SetActive(false);
            }
            txt_typecards [1].gameObject.SetActive(true);
            txt_typecards [1].text = "Binh Lủng";
        }
    }