Esempio n. 1
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);
            }
        }
    }
Esempio n. 2
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);
        }
    }