Ejemplo n.º 1
0
    internal override void StartTableOk(int[] cardHand, Message msg, string[] nickPlay)
    {
        base.StartTableOk(cardHand, msg, nickPlay);
        int turntimeMB = 60;

        try {
            turntimeMB = msg.reader().ReadByte();
        } catch (Exception e) {
            Debug.LogException(e);
        }
        for (int i = 0; i < nickPlay.Length; i++)
        {
            MauBinhPlayer pl = (MauBinhPlayer)GetPlayerWithName(nickPlay [i]);
            if (pl != null)
            {
                pl.cardMauBinh.SetActiveCard();
                if (pl.SitOnClient == 0)
                {
                    pl.cardMauBinh.SetCard(cardHand, true, () => {
                        SetActiveButton(true, true, false, true);
                        SetLoaiBai(cardHand);
                    });
                }
                else
                {
                    pl.cardMauBinh.SetCard(cardHand, false);
                }
            }
        }
        timeCountDown.SetTime(turntimeMB);
        SetLoaiBai(cardHand);
    }
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();
                bool   isDangXep = message.reader().ReadBoolean();

                MauBinhPlayer pl = (MauBinhPlayer)GetPlayerWithName(nameP);
                if (pl != null)
                {
                    pl.IsPlaying = true;
                    pl.SetXepXong(!isDangXep);
//					int[] temp = new int[13];
//					for (int j = 0; j < temp.Length; j++) {
//						temp [j] = 52;
//					}

                    StartCoroutine(pl.cardMauBinh.SetDangChoi(!isDangXep));
                }
            }
            GameControl.instance.TimerTurnInGame = time;
            timeCountDown.SetTime(time);
        } catch (Exception e) {
            Debug.LogException(e);
        }
    }
Ejemplo n.º 3
0
 public MauBinhInput(MauBinh mbStage, MauBinhPlayer player, ArrayCard cardHand, ArrayCard[] cardChi, Card card)
 {
     this.cardHand = cardHand;
     this.cardChi  = cardChi;
     this.card     = card;
     this.mbStage  = mbStage;
     this.player   = player;
 }
Ejemplo n.º 4
0
    void OnLung(string namePlayer, long moneyEarn)
    {
        MauBinhPlayer pl = (MauBinhPlayer)GetPlayerWithName(namePlayer);

        if (pl != null)
        {
            pl.SetLung();
            pl.SetEffect(MoneyHelper.FormatMoneyNormal(moneyEarn));
        }
    }
Ejemplo n.º 5
0
 public void Demo()
 {
     int[] arrr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
     ((MauBinhPlayer)playerMe).cardMauBinh.SetCard(arrr, true);
     for (int i = 1; i < ListPlayer.Count; i++)
     {
         MauBinhPlayer pl = (MauBinhPlayer)ListPlayer [i];
         if (pl != null)
         {
             pl.cardMauBinh.SetCard(arrr, false);
         }
     }
 }
Ejemplo n.º 6
0
    internal void OnWinMauBinh(Message message)
    {
        string nameP = message.reader().ReadUTF();
        int    typeC = message.reader().ReadByte();

        MauBinhPlayer pl = (MauBinhPlayer)GetPlayerWithName(nameP);

        if (pl != null)
        {
            pl.SetMauBinh(typeC);
        }
        SetActiveButton(false, false, false, false);
    }
Ejemplo n.º 7
0
    internal override void OnFinishGame(Message message)
    {
        SetActiveButton(false, false, false, false);
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            MauBinhPlayer pl = (MauBinhPlayer)ListPlayer [i];
            if (pl != null)
            {
                pl.SetDisableAction();
//				pl.cardMauBinh.SetActiveCard ();
            }
        }
    }
Ejemplo n.º 8
0
    public void OnFinalMauBinh(Message message)
    {
        string        nameP = message.reader().ReadUTF();
        MauBinhPlayer pl    = (MauBinhPlayer)GetPlayerWithName(nameP);

        if (pl != null)
        {
            pl.cardMauBinh.SetSoBai(pl.SitOnClient == 0);
            pl.SetXepXong(true);
        }
        if (nameP.Equals(ClientConfig.UserInfo.UNAME))
        {
            SetActiveButton(false, false, true, false);
        }
    }
Ejemplo n.º 9
0
 internal override void AllCardFinish(string nick, int[] card)
 {
     base.AllCardFinish(nick, card);
     try {
         if (card.Length > 0)
         {
             int[]         cardChi1 = new int[] { card [0], card [1], card [2], card [3], card [4] };
             int[]         cardChi2 = new int[] { card [5], card [6], card [7], card [8], card [9] };
             int[]         cardChi3 = new int[] { card [10], card [11], card [12] };
             MauBinhPlayer pl       = (MauBinhPlayer)GetPlayerWithName(nick);
             if (pl != null)
             {
                 pl.cardMauBinh.SetCardKetThuc(cardChi1, cardChi2, cardChi3, pl.SitOnClient == 0);
             }
         }
     } catch (Exception e) {
         Debug.LogException(e);
     }
     SetActiveButton(false, false, false, false);
 }
Ejemplo n.º 10
0
    internal override void OnStartForView(string[] playingName, Message msg)
    {
        base.OnStartForView(playingName, msg);
        SetActiveButton(false, false, false, false);
        int[] cardHand = new int[13];
        for (int i = 0; i < cardHand.Length; i++)
        {
            cardHand [i] = 52;
        }
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            if (ListPlayer [i].IsPlaying)
            {
                MauBinhPlayer pl = (MauBinhPlayer)ListPlayer [i];
                if (pl != null)
                {
                    pl.cardMauBinh.SetCard(cardHand, false);
                }
            }
        }

        timeCountDown.SetTime(60);
    }
Ejemplo n.º 11
0
    public void InitInfoPlayer_MAUBINH()
    {
        for (int i = 0; i < ListPlayer.Count; i++)
        {
            MauBinhPlayer pl = (MauBinhPlayer)ListPlayer[i];

            switch (pl.SitOnClient)
            {
            case 0:
                pl.cardMauBinh.Init(true);
                pl.cardMauBinh.SetPositionArryCard(Align_Anchor.CENTER);
                pl.SetPositionChatLeft(true);
                break;

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

            case 2:
                pl.cardMauBinh.Init(false);
                pl.cardMauBinh.SetPositionArryCard(Align_Anchor.LEFT);
                pl.SetPositionChatLeft(false);
                pl.SetPositionChatAction(Align_Anchor.BOT);
                break;

            case 3:
                pl.cardMauBinh.Init(false);
                pl.cardMauBinh.SetPositionArryCard(Align_Anchor.LEFT);
                pl.SetPositionChatLeft(true);
                pl.SetPositionChatAction(Align_Anchor.LEFT);
                break;
            }
        }
    }
Ejemplo n.º 12
0
    internal void OnRankMauBinh(Message message)
    {
        SetActiveButton(false, false, false, false);
        timeCountDown.SetTime(0);

        int chi = message.reader().ReadByte();
        int size, i;

        if (chi != 4 && chi != 5)
        {
            size = message.reader().ReadByte();
            for (i = 0; i < size; i++)
            {
                string namePlayer = message.reader().ReadUTF();
                int    typeCard   = message.reader().ReadByte();
                long   moneyEarn  = message.reader().ReadLong();

                int   size2   = message.reader().ReadByte();
                int[] cardChi = new int[size2];
                for (int k = 0; k < size2; k++)
                {
                    cardChi [k] = message.reader().ReadByte();
                }
                MauBinhPlayer pl = (MauBinhPlayer)GetPlayerWithName(namePlayer);
                if (pl != null)
                {
                    int iCard = 0;
                    if (chi == 1)
                    {
                        iCard = 2;
                    }
                    else if (chi == 2)
                    {
                        iCard = 1;
                    }
                    else if (chi == 3)
                    {
                        iCard = 0;
                    }
                    pl.cardMauBinh.ShowChi(cardChi, iCard, typeCard, pl.SitOnClient == 0);
                    if (moneyEarn != 0)
                    {
                        pl.SetEffect(moneyEarn > 0 ? "+" + MoneyHelper.FormatMoneyNormal(moneyEarn) : MoneyHelper.FormatMoneyNormal(moneyEarn));
                    }
                }
            }
        }
        else if (chi == 4)
        {
            size = message.reader().ReadByte();
            for (i = 0; i < size; i++)
            {
                string namePlayer = message.reader().ReadUTF();
                long   moneyEarn  = message.reader().ReadLong();
                OnSapBaChi(namePlayer, moneyEarn);
            }
        }
        else if (chi == 5)
        {
            size = message.reader().ReadByte();
            for (i = 0; i < size; i++)
            {
                string namePlayer = message.reader().ReadUTF();
                long   moneyEarn  = message.reader().ReadLong();
                OnLung(namePlayer, moneyEarn);
            }
        }
    }