Ejemplo n.º 1
0
    internal override void OnFireCard(string nick, string turnName, int[] card)
    {
        base.OnFireCard(nick, turnName, card);
        AutoChooseCardSam.CardTrenBan.Clear();
        AutoChooseCardSam.CardTrenBan.AddRange(card);
        nickFire = nick;
        SamPlayer plTurn = (SamPlayer)GetPlayerWithName(nick);

        if (plTurn != null)
        {
            plTurn.SetTurn(0);
            if (nick.Equals(ClientConfig.UserInfo.UNAME))
            {
                for (int i = 0; i < card.Length; i++)
                {
                    ListCardOfMe.Remove(card[i]);
                }
                cardTable.MinhDanh(card, plTurn.CardHand, () => {
                    ((SamPlayer)playerMe).CardHand.SortCardActive();
                });
            }
            else
            {
                cardTable.SinhCardGiuaCMNBan(card, plTurn.CardHand.transform);
                int numC = plTurn.NumCard - card.Length;
                plTurn.SetNumCard(numC);
            }
        }
        else
        {
            cardTable.SinhCardGiuaCMNBan(card, ((SamPlayer)playerMe).CardHand.transform);
        }

        if (turnName.ToLower().Equals(ClientConfig.UserInfo.UNAME.ToLower()))
        {
            SetActiveButton(false, false, true, true);
            if (AutoChooseCardSam.CardTrenBan.Count > 0)
            {
                int[] result = AutoChooseCardSam.ChooseCard(ListCardOfMe.ToArray());
                ((SamPlayer)playerMe).CardHand.SetChooseCard(result);
                //if (result == null) {//sua
                //    playerMe.SetTurn(true, 5);
                //    SetActiveButton(false, false, false, true);
                //    Invoke("KhongDanhDuocThiBo", 5);
                //} else {
                //    if (result.Length <= 0) {
                //        pl.SetTurn(true, 5);
                //        SetActiveButton(false, false, false, true);
                //        Invoke("KhongDanhDuocThiBo", 5);
                //    }
                //}
            }
        }
    }
Ejemplo n.º 2
0
 internal override void InfoCardPlayerInTbl(Message message, string turnName, int time, sbyte numP)
 {
     base.InfoCardPlayerInTbl(message, turnName, time, numP);
     try {
         for (int i = 0; i < numP; i++)
         {
             string    nameP   = message.reader().ReadUTF();
             sbyte     numCard = message.reader().ReadByte();
             SamPlayer pl      = (SamPlayer)GetPlayerWithName(nameP);
             if (pl != null)
             {
                 pl.IsPlaying = (true);
                 int[] temp = new int[numCard];
                 for (int j = 0; j < temp.Length; j++)
                 {
                     temp[j] = 52;
                 }
                 pl.CardHand.SetCardWithId52();
                 pl.CardHand.SetActiveCardHand(true);
                 pl.SetNumCard(numCard);
             }
         }
         GameControl.instance.TimerTurnInGame = time;
         BasePlayer plTurn = GetPlayerWithName(turnName);
         if (plTurn != null)
         {
             plTurn.SetTurn(time);
         }
         if (turnName.Equals(ClientConfig.UserInfo.UNAME))
         {
             SetActiveButton(false, false, true, true);
         }
         else
         {
             SetActiveButton(false, false, false, false);
         }
         string nickbaoxam = message.reader().ReadUTF();
         OnNickBaoSam(nickbaoxam);
     } catch (Exception e) {
         Debug.LogException(e);
     }
 }