コード例 #1
0
    public void Demo()
    {
        int[] ccccH   = new int[] { 1, 2, 4, 6, 7, 8, 33, 44, 34 };
        int[] ccccF   = new int[] { 11, 12, 13, 14 };
        int[] ccccP1  = new int[] { 1, 2, 4 };
        int[] ccccP2  = new int[] { 6, 7, 8 };
        int[] ccccP3  = new int[] { 33, 44, 34 };
        int[] ccccPAn = new int[] { 23, 02, 17 };

        ((PhomPlayer)playerMe).cardTaLaManager.SetChiaBai(ccccH, true);
        ((PhomPlayer)playerMe).cardTaLaManager.ArrayCardFire.SetActiveCardWithArrID(ccccF);
        ((PhomPlayer)playerMe).cardTaLaManager.SetCardPhom(ccccP1, ccccP2, ccccP3, ccccPAn, true);

        for (int i = 1; i < ListPlayer.Count; i++)
        {
            PhomPlayer pl = (PhomPlayer)ListPlayer[i];
            if (pl != null)
            {
                pl.cardTaLaManager.SetChiaBai(ccccH, false, () => {
                    pl.cardTaLaManager.ArrayCardFire.SetActiveCardWithArrID(ccccF);
                    pl.cardTaLaManager.SetCardPhom(ccccP1, ccccP2, ccccP3, ccccPAn, false);
                });
            }
        }
    }
コード例 #2
0
    internal void OnEatCardSuccess(string thangAn, string thangBiAn, int card)
    {
        //		Debug.LogError (ClientConfig.UserInfo.UNAME + "   Thang An:  " + thangAn);
        //		Debug.LogError ("Thang Bi An:  " + thangBiAn);
        Card       cardAn      = null;
        PhomPlayer plThangBiAn = (PhomPlayer)GetPlayerWithName(thangBiAn);
        PhomPlayer plThangAn   = (PhomPlayer)GetPlayerWithName(thangAn);

        cardAn = plThangBiAn.cardTaLaManager.ArrayCardFire.GetCardbyIDCard(card);
        if (cardAn != null)
        {
            bool isTao = thangAn.ToUpper().Equals(ClientConfig.UserInfo.UNAME.ToUpper());
            if (plThangAn != null)
            {
                plThangAn.cardTaLaManager.SetEatCard(card, isTao, cardAn, () => {
                    if (isTao)
                    {
                        plThangAn.cardTaLaManager.ArrayCardHand.ResetCard();
                        ListIdCardAn.Add(card);
                        //if (plThangAn.cardTaLaManager.NumCardFire() >= 3) {
                        //	SetActiveButton(false, false, false, false, false, true, false);
                        //} else
                        SetActiveButton(false, false, true, false, false, false, true);
                    }
                });
            }
        }
    }
コード例 #3
0
    internal override void AllCardFinish(string nick, int[] card)
    {
        base.AllCardFinish(nick, card);
        PhomPlayer pl = (PhomPlayer)GetPlayerWithName(nick);

        if (pl != null)
        {
            pl.cardTaLaManager.SetCardKhiHetGame(card);
        }
    }
コード例 #4
0
ファイル: CardTaLa.cs プロジェクト: ping203/WebGameNew
    public void ChuyenBai(int idCard, PhomPlayer playerTu, UnityAction callback = null)
    {
        Card cTu  = playerTu.cardTaLaManager.ArrayCardFire.GetCardbyIDCard(idCard);
        Card cDen = GetCardOnArrayCard(ArrayCardFire);

        cDen.SetCardWithId(cTu.ID);

        Vector3 vtFrom = ArrayCardFire.transform.InverseTransformPoint(cTu.transform.position);

        StartCoroutine(cDen.MoveFrom(vtFrom, CONST_DUR, 0, callback));
        cTu.SetVisible(false);
    }
コード例 #5
0
ファイル: CardTaLa.cs プロジェクト: ping203/WebGameNew
    IEnumerator WaitGuiBai(int[] idCards, PhomPlayer playerTu, bool isTao)
    {
        List <int> Phom1 = new List <int>();

        for (int i = 0; i < ArrayCardPhom[0].listCardHand.Count; i++)
        {
            Card c = ArrayCardPhom[0].listCardHand[i];
            if (c.isBatHayChua)
            {
                Phom1.Add(c.ID);
            }
        }

        for (int i = 0; i < idCards.Length; i++)
        {
            Phom1.Add(idCards[i]);
            Card cTu;
            if (isTao)
            {
                cTu = playerTu.cardTaLaManager.ArrayCardHand.GetCardbyIDCard(idCards[i]);
            }
            else
            {
                cTu = playerTu.cardTaLaManager.GetCardOnArrayCard(playerTu.cardTaLaManager.ArrayCardHand);
            }
            cTu.SetVisible(false);
            int indexP = 0;
            if (!AutoChooseCardTaLa.CheckPhom(Phom1.ToArray()))
            {
                Phom1.Remove(idCards[i]);
                indexP = 1;
            }
            ArrayCard arr  = ArrayCardPhom[indexP];
            Card      cDen = GetCardOnArrayCard(arr);
            cDen.transform.localPosition = arr.GetPositonCardActive();
            cDen.setSmall(!isTao);
            cDen.SetCardWithId(idCards[i]);
            Vector3 vtFrom = arr.transform.InverseTransformPoint(isTao ? cTu.transform.position : playerTu.cardTaLaManager.ArrayCardHand.transform.position);
            StartCoroutine(cDen.MoveFrom(vtFrom, CONST_DUR, 0, () => {
                arr.SortCardActive();
                cDen.setSmall(true);
                SortCardPhom(arr);
            }));
            yield return(new WaitForSeconds(0.2f));
        }
        if (isTao)
        {
            yield return(new WaitForSeconds(0.2f));

            playerTu.cardTaLaManager.ArrayCardHand.SortCardActive();
        }
    }
コード例 #6
0
 //Gui bai
 internal void OnAttachCard(string tenThangGuiBai, string guiDenThangNay, int[] phomgui, int[] card)
 {
     try {
         PhomPlayer plTuThangNay  = (PhomPlayer)GetPlayerWithName(tenThangGuiBai);
         PhomPlayer plDenThangNay = (PhomPlayer)GetPlayerWithName(guiDenThangNay);
         if (plTuThangNay != null && plDenThangNay != null)
         {
             plDenThangNay.cardTaLaManager.GuiBai(card, plTuThangNay, tenThangGuiBai.Equals(ClientConfig.UserInfo.UNAME));
         }
     } catch (Exception e) {
         Debug.LogException(e);
     }
 }
コード例 #7
0
 internal override void OnStartForView(string[] playingName, Message msg)
 {
     base.OnStartForView(playingName, msg);
     SetActiveButton(false, false, false, false, false, false, false);
     for (int i = 0; i < ListPlayer.Count; i++)
     {
         PhomPlayer pl = (PhomPlayer)ListPlayer[i];
         if (pl.IsPlaying)
         {
             pl.cardTaLaManager.ArrayCardHand.SetCardWithId52();
         }
     }
 }
コード例 #8
0
    IEnumerator WaitFinish()
    {
        yield return(new WaitForSeconds(3));

        if (playerMe.IsMaster)
        {
            SetActiveButton(true, false, false, false, false, false, false);
        }
        else
        {
            SetActiveButton(false, true, false, false, false, false, false);
        }
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            PhomPlayer pl = (PhomPlayer)ListPlayer[i];
            pl.cardTaLaManager.SetActiveCardHand();
        }
    }
コード例 #9
0
    internal override void StartTableOk(int[] cardHand, Message msg, string[] nickPlay)
    {
        base.StartTableOk(cardHand, msg, nickPlay);

        StopCoroutine(WaitFinish());

        totalCardNoc = nickPlay.Length * 4 - 1;
        SetNumCardLoc(totalCardNoc);
        cardDanhTruocDo = 0;
        ListIdCardAn.Clear();
        StopCoroutine(WaitFinish());
        for (int i = 0; i < nickPlay.Length; i++)
        {
            PhomPlayer pl = (PhomPlayer)GetPlayerWithName(nickPlay[i]);
            if (pl != null)
            {
                pl.cardTaLaManager.SetChiaBai(cardHand, pl.SitOnClient == 0);
            }
        }
    }
コード例 #10
0
    //Boc bai
    internal void OnGetCardNocSuccess(string nick, int card)
    {
        totalCardNoc--;
        SetNumCardLoc(totalCardNoc);
        PhomPlayer pl    = (PhomPlayer)GetPlayerWithName(nick);
        bool       issMe = nick.Equals(ClientConfig.UserInfo.UNAME);

        if (pl != null)
        {
            pl.cardTaLaManager.BocBai(card, issMe, () => {
                //if (issMe) {
                //	if (pl.cardTaLaManager.NumCardFire() >= 3) {
                //		bool isHaP = AutoChooseCardTaLa.CheckPhom(pl.cardTaLaManager.GetCardIdCardHand());
                //		SetActiveButton(false, false, false, false, false, isHaP, true);
                //	} else {
                SetActiveButton(false, false, true, false, false, false, true);
                //	}
                //}
            });
        }
    }
コード例 #11
0
 //chuyen bai
 internal void OnBalanceCard(string tenThangGuiBai, string guiDenThangNay, int card)
 {
     try {
         PhomPlayer plTuThangNay  = (PhomPlayer)GetPlayerWithName(tenThangGuiBai);
         PhomPlayer plDenThangNay = (PhomPlayer)GetPlayerWithName(guiDenThangNay);
         if (plTuThangNay != null && plDenThangNay != null)
         {
             plDenThangNay.cardTaLaManager.ChuyenBai(card, plTuThangNay);
             //plDenThangNay.cardTaLaManager.ChuyenBai(card, plTuThangNay, () => {
             //if (tenThangGuiBai.Equals(ClientConfig.UserInfo.UNAME) && plTuThangNay.IsTurn) {
             //	if (plTuThangNay.cardTaLaManager.NumCardFire() >= 3) {
             //		SetActiveButton(false, false, false, false, false, true, false);
             //	} else
             //		SetActiveButton(false, false, true, false, false, false, true);
             //}
             //});
         }
     } catch (Exception e) {
         Debug.LogException(e);
     }
 }
コード例 #12
0
    internal override void OnFireCard(string nick, string turnName, int[] card)
    {
        base.OnFireCard(nick, turnName, card);
        PhomPlayer plFire = (PhomPlayer)GetPlayerWithName(nick);

        cardDanhTruocDo = card[0];
        if (plFire != null)
        {
            plFire.SetTurn(0, false);
            plFire.cardTaLaManager.OnFireCard(card[0], nick.Equals(ClientConfig.UserInfo.UNAME));

            if (nick.Equals(ClientConfig.UserInfo.UNAME))
            {
                if (plFire.cardTaLaManager.NumCardFire() >= 3)
                {
                    //		int[] arrr = AutoChooseCardTaLa.GetPhomTrenTayOneArray(plFire.cardTaLaManager.GetCardIdCardHand());
                    //		if (arrr.Length <= 0) {
                    //			SetActiveButton(false, false, false, false, false, false, true);
                    //		} else
                    //			SetActiveButton(false, false, false, false, false, true, false);

                    bool isHaP = AutoChooseCardTaLa.CheckPhom(plFire.cardTaLaManager.GetCardIdCardHand());
                    Debug.LogError("vao day ne:  " + isHaP);
                    SetActiveButton(false, false, false, false, false, isHaP, true);
                    //} else {
                    //	SetActiveButton(false, false, true, false, false, false, true);
                    //}
                }
                else
                {
                    SetActiveButton(false, false, false, false, false, false, true);
                }
            }
            else
            {
                SetTurn(turnName, null);
            }
        }
    }
コード例 #13
0
    internal void OnDropPhomSuccess(string nick, int[] arrayPhom)
    {
        PhomPlayer pl = (PhomPlayer)GetPlayerWithName(nick);

        if (pl != null)
        {
            bool         isMe   = nick.Equals(ClientConfig.UserInfo.UNAME);
            List <int[]> phommm = AutoChooseCardTaLa.GetPhomTrenTayMultiArray(arrayPhom);
            for (int i = 0; i < phommm.Count; i++)
            {
                pl.cardTaLaManager.HaBai(phommm[i], isMe, ListIdCardAn);
            }

            //if (isMe) {
            //    int[] p = AutoChooseCardTaLa.GetPhomTrenTayOneArray(pl.cardTaLaManager.GetCardIdCardHand());
            //    if (p.Length <= 0)
            //        SetActiveButton(false, false, true, false, false, false, false, true);
            //    else
            //        SetActiveButton(false, false, true, false, false, true, false, true);
            //}
        }
    }
コード例 #14
0
ファイル: BaseCasino.cs プロジェクト: ping203/WebGameNew
    public void InitInfoPlayer_PHOM()
    {
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            PhomPlayer pl = (PhomPlayer)ListPlayer[i];

            switch (pl.SitOnClient)
            {
            case 0:
                pl.cardTaLaManager.Init(true);
                pl.cardTaLaManager.SetDragDropCard();
                pl.cardTaLaManager.SetPositionArryCard(Align_Anchor.CENTER, Align_Anchor.LEFT, Align_Anchor.CENTER, pl.SitOnClient);
                pl.SetPositionChatLeft(true);
                break;

            case 1:
                pl.cardTaLaManager.Init(false);
                pl.SetPositionChatLeft(false);
                pl.cardTaLaManager.SetPositionArryCard(Align_Anchor.RIGHT, Align_Anchor.RIGHT, Align_Anchor.RIGHT, pl.SitOnClient);
                pl.SetPositionChatAction(Align_Anchor.RIGHT);
                break;

            case 2:
                pl.cardTaLaManager.Init(false);
                pl.cardTaLaManager.SetPositionArryCard(Align_Anchor.LEFT, Align_Anchor.RIGHT, Align_Anchor.CENTER, pl.SitOnClient);
                pl.SetPositionChatLeft(false);
                pl.SetPositionChatAction(Align_Anchor.BOT);
                break;

            case 3:
                pl.cardTaLaManager.Init(false);
                pl.cardTaLaManager.SetPositionArryCard(Align_Anchor.LEFT, Align_Anchor.LEFT, Align_Anchor.LEFT, pl.SitOnClient);
                pl.SetPositionChatLeft(true);
                pl.SetPositionChatAction(Align_Anchor.LEFT);
                break;
            }
        }
    }
コード例 #15
0
    internal override void SetTurn(string nick, Message message)
    {
        base.SetTurn(nick, message);
        try {
            PhomPlayer pl = (PhomPlayer)GetPlayerWithName(nick);
            bool       bocbai = false, anbai = false, haphom = false, danhbai = false;
            if (nick.Equals(ClientConfig.UserInfo.UNAME) || string.IsNullOrEmpty(nick))
            {
                anbai  = false;
                bocbai = true;
                if (playerMe != null)
                {
                    int[] temp = ((PhomPlayer)playerMe).cardTaLaManager.GetCardIdCardHand();
                    if (temp.Length < 10)
                    {
                        bocbai  = cardDanhTruocDo != 0;
                        danhbai = cardDanhTruocDo == 0;
                    }
                    else
                    {
                        bocbai  = false;
                        danhbai = true;
                    }
                    if (pl.cardTaLaManager.NumCardFire() >= 4)
                    {
                        haphom  = true;
                        danhbai = false;
                        anbai   = false;
                        bocbai  = false;
                    }
                    else
                    {
                        ArrayCard cardMe    = ((PhomPlayer)playerMe).cardTaLaManager.ArrayCardHand;
                        int[][]   cardPhoms = RTL.getCardFromPlayer(temp, ListIdCardAn.ToArray(), cardDanhTruocDo);
                        if (cardPhoms != null)
                        {
                            int arrPhom = -1;
                            for (int i = 0; i < cardPhoms.Length; i++)
                            {
                                for (int j = 0; j < cardPhoms[i].Length; j++)
                                {
                                    if (cardDanhTruocDo == cardPhoms[i][j])
                                    {
                                        arrPhom = i;
                                        break;
                                    }
                                }
                                if (arrPhom != -1)
                                {
                                    break;
                                }
                            }

                            if (arrPhom != -1)
                            {
                                for (int j = 0; j < cardPhoms[arrPhom].Length; j++)
                                {
                                    Card c = cardMe
                                             .GetCardbyIDCard(cardPhoms[arrPhom][j]);
                                    if (c != null)
                                    {
                                        c.IsChoose = (true);
                                    }
                                }
                            }
                            anbai = true;
                        }
                    }
                }
            }

            SetActiveButton(false, false, danhbai, bocbai, anbai, haphom, true);
        } catch (Exception e) {
            Debug.LogException(e);
        }
    }
コード例 #16
0
    internal override void OnInfome(Message message)
    {
        base.OnInfome(message);
        try {
            bool bocbai = false, anbai = false, haphom = false, danhbai = false;
            GameControl.instance.TimerTurnInGame = 20;
            playerMe.IsPlaying = (true);
            int   sizeCardHand = message.reader().ReadByte();
            int[] cardHand     = new int[sizeCardHand];
            for (int i = 0; i < sizeCardHand; i++)
            {
                cardHand[i] = message.reader().ReadByte();
            }

            ((PhomPlayer)playerMe).cardTaLaManager.ArrayCardHand.SetActiveCardWithArrID(cardHand);

            int   sizeCardFire = message.reader().ReadByte();
            int[] cardFire     = new int[sizeCardFire];
            for (int i = 0; i < sizeCardFire; i++)
            {
                cardFire[i] = message.reader().ReadByte();
            }
            ((PhomPlayer)playerMe).cardTaLaManager.ArrayCardFire.SetActiveCardWithArrID(cardFire);

            int sizeCardPhom = message.reader().ReadByte();
            if (sizeCardPhom > 0)
            {
                int[] cardPhom = new int[sizeCardPhom];
                for (int i = 0; i < sizeCardFire; i++)
                {
                    cardPhom[i] = message.reader().ReadByte();
                }
                List <int[]> listP = AutoChooseCardTaLa.GetPhomTrenTayMultiArray(cardPhom);
                for (int k = 0; k < listP.Count; k++)
                {
                    ((PhomPlayer)playerMe).cardTaLaManager.HaBai(listP[k], true, ListIdCardAn);
                }
            }

            string turnName = message.reader().ReadUTF();
            int    turnTime = message.reader().ReadInt();

            PhomPlayer plTurn = (PhomPlayer)GetPlayerWithName(turnName);
            if (plTurn != null)
            {
                plTurn.SetTurn(turnTime);
            }

            if (turnName.Equals(ClientConfig.UserInfo.UNAME))
            {
                if (plTurn.cardTaLaManager.NumCardFire() >= 4)
                {
                    haphom = true;
                }
                else
                {
                    int[] cardMe = plTurn.cardTaLaManager.GetCardIdCardHand();
                    if (cardMe.Length < 10)
                    {
                        bocbai = true;
                    }
                    else
                    {
                        danhbai = true;
                    }
                    int[] cardPhom = AutoChooseCardTaLa.GetPhomAnDuoc(cardMe, cardDanhTruocDo, ListIdCardAn.ToArray());

                    if (cardPhom != null)
                    {
                        anbai  = true;
                        bocbai = true;
                    }
                }
                //    SetActiveButton(false, false, true, sizeCardFire > 0);
                //} else {
                //    SetActiveButton(false, false, false, false);
            }

            SetActiveButton(false, false, danhbai, bocbai, anbai, haphom, false);
        } catch (Exception e) {
            Debug.LogException(e);
        }
    }
コード例 #17
0
    internal override void InfoCardPlayerInTbl(Message message, string turnName, int time, sbyte numP)
    {
        base.InfoCardPlayerInTbl(message, turnName, time, numP);
        try {
            int numCardNoc = 0;
            for (int i = 0; i < numP; i++)
            {
                string     nameP = message.reader().ReadUTF();
                PhomPlayer pl    = (PhomPlayer)GetPlayerWithName(nameP);
                if (pl != null)
                {
                    pl.IsPlaying = (true);
                    int[] temp = new int[9];
                    for (int j = 0; j < temp.Length; j++)
                    {
                        temp[j] = 52;
                    }
                    pl.cardTaLaManager.SetChiaBai(temp, false);

                    int sizeCardAn = message.reader().ReadInt();
                    for (int j = 0; j < sizeCardAn; j++)
                    {
                        pl.cardTaLaManager.SetCardAn(message.reader().ReadInt(), j);
                    }
                    int   sizeRub  = message.reader().ReadInt();
                    int[] cardDanh = new int[sizeRub];
                    for (int j = 0; j < sizeRub; j++)
                    {
                        cardDanh[j] = message.reader().ReadInt();
                    }
                    pl.cardTaLaManager.ArrayCardFire.SetActiveCardWithArrID(cardDanh);

                    numCardNoc += sizeRub;

                    int sizePhom = message.reader().ReadByte();
                    if (sizePhom > 0)
                    {
                        int[] phom = new int[sizePhom];
                        for (int j = 0; j < sizePhom; j++)
                        {
                            phom[j] = message.reader().ReadByte();
                        }
                        List <int[]> listP = AutoChooseCardTaLa.GetPhomTrenTayMultiArray(phom);
                        for (int k = 0; k < listP.Count; k++)
                        {
                            pl.cardTaLaManager.HaBai(listP[k], false);
                        }
                    }
                }
            }
            SetNumCardLoc(numP * 4 - numCardNoc);

            GameControl.instance.TimerTurnInGame = time;
            //SetTurn(turnName, null);
            BasePlayer plTurn = GetPlayerWithName(turnName);
            if (plTurn != null)
            {
                plTurn.SetTurn(time);
            }
            if (turnName.Equals(ClientConfig.UserInfo.UNAME))
            {
                SetActiveButton(false, false, true, true, false, false, false);                //kiem tra an dc hay ko
            }
            else
            {
                SetActiveButton(false, false, false, false, false, false, false);
            }
        } catch (Exception e) {
            Debug.LogException(e);
        }
    }
コード例 #18
0
ファイル: CardTaLa.cs プロジェクト: ping203/WebGameNew
 public void GuiBai(int[] idCards, PhomPlayer playerTu, bool isTao)
 {
     StartCoroutine(WaitGuiBai(idCards, playerTu, isTao));
 }